@r_masseater/msch 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -38,7 +38,9 @@ oxlint のバージョンは、@effect/tsgo が対応するものに合わせる
38
38
 
39
39
  ## msch の検査
40
40
 
41
- リポジトリのルートで `msch` を実行すると、値の集合と形の重複、overrides の要不要、テストのためだけのコード、見えない文字、Python の使用を調べる。
41
+ リポジトリのルートで `msch` を実行すると、値の集合と形の重複、overrides の要不要、テストのためだけのコード、見えない文字、Python の使用、ルート以外の案内文書を調べる。
42
+ 外部から読んだ値を Effect Schema で確かめるときは、`satisfies Schema.Decoder<ライブラリの型>` か変数の型注釈でライブラリの型に結びつける。結びつけた Schema は、ライブラリの形の写しとして指摘しない。
42
43
  見えない文字は、ゼロ幅の文字・書字方向を変える制御文字・タグ文字のように、エディタやレビューで見えずに意味を変えうる文字で、`git ls-files` に載るテキストのファイルから探す。ファイル先頭の BOM と、NUL を含むバイナリは対象にしない。
43
44
  Python は使わない方針なので、`.py`・`pyproject.toml`・`uv.lock` などのファイルを指摘する。スクリプト・CI・設定の中で `python3`・`pip`・`uv`・`poetry` を呼ぶ箇所と、`actions/setup-python` などの action、`mise.toml` に書いた Python の道具も指摘する。
45
+ 案内文書は、`AGENTS.md`・`CLAUDE.md` をルートにだけ置かせ、README はルートか、`private` でない package.json の隣(npm のページに出るもの)にだけ置かせる。
44
46
  指摘があれば終了コードは 1 になる。`--json` を付けると結果を JSON で出す。
@@ -1,6 +1,6 @@
1
1
  import { Array, Context, Effect, FileSystem, Layer, Option, Order, Path, Predicate, Record, Schema, Stream, String as String$1, pipe } from "effect";
2
2
  import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
3
- import { isArrayLiteralExpression, isBinaryExpression, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportDeclaration, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSignatureDeclaration, isSourceFile, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
3
+ import { isArrayLiteralExpression, isBinaryExpression, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportDeclaration, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
4
4
  import { API, IndexKind } from "typescript/sync";
5
5
  import { layer } from "@effect/platform-node/NodeServices";
6
6
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
@@ -238,7 +238,8 @@ const RuleNameSchema = Schema.Literals([
238
238
  "removable-override",
239
239
  "hidden-unicode",
240
240
  "python-file",
241
- "python-command"
241
+ "python-command",
242
+ "nested-docs"
242
243
  ]);
243
244
  const ProblemSchema = Schema.Struct({
244
245
  file: Schema.String,
@@ -274,6 +275,6 @@ const describeFinding = (problem) => `[${problem.rule}] ${problem.message}`;
274
275
  const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;
275
276
  // src/cli-contract.ts
276
277
  const JSON_FLAG = "--json";
277
- export { isSignatureDeclaration as $, API as A, isCallExpression as B, MANIFEST_FILE as C, workspaceDependencies as D, readManifest as E, getLeadingCommentRanges as F, isInterfaceDeclaration as G, isElementAccessExpression as H, getNameOfDeclaration as I, isNewExpression as J, isModuleBlock as K, getTextOfJSDocComment as L, InternalSymbolName as M, SyntaxKind as N, RepositoryFiles as O, getJSDocTags as P, isPropertyAssignment as Q, isArrayLiteralExpression as R, uniqueByReference as S, dependencyEntries as T, isEnumDeclaration as U, isClassDeclaration as V, isIdentifier as W, isObjectLiteralExpression as X, isNumericLiteral as Y, isPropertyAccessExpression as Z, lineOf as _, problemAt as a, isUnionTypeNode as at, resolvedSymbol as b, childrenOf as c, isVariableStatement as ct, declarationsOf as d, isSourceFile as et, descendantsOf as f, isTypeDeclaration as g, isGenericDeclaration as h, formatProblem as i, isTypeReferenceNode as it, IndexKind as j, nodeRepositoryFiles as k, columnOf as l, isExternalDeclaration as m, ProblemList as n, isTypeAliasDeclaration as nt, sortProblems as o, isVariableDeclaration as ot, importedModulesOf as p, isModuleDeclaration as q, describeFinding as r, isTypeLiteralNode as rt, NODE_MODULES_SEGMENT as s, isVariableDeclarationList as st, JSON_FLAG as t, isStringLiteral as tt, contains as u, propertyNamesOf as v, NODE_MODULES as w, symbolAt as x, referencedSymbols as y, isBinaryExpression as z };
278
+ export { isSatisfiesExpression as $, API as A, isCallExpression as B, MANIFEST_FILE as C, workspaceDependencies as D, readManifest as E, getLeadingCommentRanges as F, isInterfaceDeclaration as G, isElementAccessExpression as H, getNameOfDeclaration as I, isNewExpression as J, isModuleBlock as K, getTextOfJSDocComment as L, InternalSymbolName as M, SyntaxKind as N, RepositoryFiles as O, getJSDocTags as P, isPropertyAssignment as Q, isArrayLiteralExpression as R, uniqueByReference as S, dependencyEntries as T, isEnumDeclaration as U, isClassDeclaration as V, isIdentifier as W, isObjectLiteralExpression as X, isNumericLiteral as Y, isPropertyAccessExpression as Z, lineOf as _, problemAt as a, isTypeLiteralNode as at, resolvedSymbol as b, childrenOf as c, isVariableDeclaration as ct, declarationsOf as d, isSignatureDeclaration as et, descendantsOf as f, isTypeDeclaration as g, isGenericDeclaration as h, formatProblem as i, isTypeAliasDeclaration as it, IndexKind as j, nodeRepositoryFiles as k, columnOf as l, isVariableDeclarationList as lt, isExternalDeclaration as m, ProblemList as n, isSpreadElement as nt, sortProblems as o, isTypeReferenceNode as ot, importedModulesOf as p, isModuleDeclaration as q, describeFinding as r, isStringLiteral as rt, NODE_MODULES_SEGMENT as s, isUnionTypeNode as st, JSON_FLAG as t, isSourceFile as tt, contains as u, isVariableStatement as ut, propertyNamesOf as v, NODE_MODULES as w, symbolAt as x, referencedSymbols as y, isBinaryExpression as z };
278
279
 
279
- //# sourceMappingURL=cli-contract-BRpk_UKr.mjs.map
280
+ //# sourceMappingURL=cli-contract-CkYucdU4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-contract-BRpk_UKr.mjs","names":["Str","Arr","nodeServicesLayer","Rec","Arr","Str","Arr","Str","Arr"],"sources":["../src/repository-files.ts","../src/dependencies.ts","../src/syntax.ts","../src/problem.ts","../src/cli-contract.ts"],"sourcesContent":["import { layer as nodeServicesLayer } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { Option } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\"];\n\nclass RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/repository-files/RepositoryFiles\") {}\n\nconst nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitFiles = (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n Effect.gen(function* listFiles() {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", ...args], {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n listedFiles: (root) => gitFiles(root, LISTED_ARGS),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer));\n\nexport { RepositoryFiles, nodeRepositoryFiles };\n","import {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Schema,\n String as Str,\n Record as Rec,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\ninterface DependencyEntry {\n readonly packageName: string;\n readonly specifier: string;\n readonly declarationsPath: string;\n}\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\n\nconst PackageManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: DependencyMap,\n devDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n exports: Schema.optional(Schema.Unknown),\n types: Schema.optional(Schema.String),\n typings: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n});\n\ntype Manifest = typeof PackageManifest.Type;\n\nconst MANIFEST_FILE = \"package.json\";\nconst NODE_MODULES = \"node_modules\";\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst ROOT_SUBPATH = \".\";\nconst SUBPATH_PREFIX = \"./\";\nconst WILDCARD = \"*\";\nconst TYPES_CONDITION = \"types\";\nconst TYPES_SCOPE = \"@types/\";\nconst TYPES_SCOPE_SEPARATOR = \"__\";\nconst CONDITION_DEPTH_LIMIT = 8;\nconst ROOT_DEPTH = 0;\nconst DEPTH_STEP = 1;\nconst DECLARATIONS_SUFFIX = /\\.d\\.[cm]?ts$|\\.[cm]?tsx?$/u;\nconst SCRIPT_SUFFIX = /\\.(?<module>[cm]?)js$/u;\n\nconst readManifest = Effect.fn(\"readManifest\")(function* readManifest(directory: string) {\n const files = yield* RepositoryFiles;\n const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const text = yield* Effect.fromOption(manifestText);\n return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);\n}, Effect.option);\n\nconst conditionsOf = (held: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(held)) {\n return [];\n }\n return Rec.toEntries(held);\n};\n\nconst typesConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n const entries = conditionsOf(held);\n const declared = Arr.findFirst(entries, ([condition, target]) =>\n Option.liftPredicate(\n target,\n (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate),\n ),\n ).pipe(Option.filter(Predicate.isString));\n return Option.orElse(declared, () =>\n Arr.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)),\n );\n};\n\nconst anyConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (Predicate.isString(held)) {\n return Option.some(held);\n }\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n return Arr.findFirst(conditionsOf(held), ([, nested]) =>\n anyConditionIn(nested, depth + DEPTH_STEP),\n );\n};\n\nconst targetPathsOf = (target: unknown): readonly string[] =>\n Arr.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);\n\ninterface SubpathTarget {\n readonly subpath: string;\n readonly target: unknown;\n}\n\nconst subpathTargetsOf = (exportsField: unknown): readonly SubpathTarget[] => {\n if (Predicate.isString(exportsField)) {\n return [{ subpath: ROOT_SUBPATH, target: exportsField }];\n }\n const entries = conditionsOf(exportsField);\n if (\n !pipe(\n entries,\n Arr.some(([subpath]) => Str.startsWith(ROOT_SUBPATH)(subpath)),\n )\n ) {\n return Arr.match(entries, {\n onEmpty: () => [],\n onNonEmpty: () => [{ subpath: ROOT_SUBPATH, target: exportsField }],\n });\n }\n return pipe(\n entries,\n Arr.filter(([subpath]) => subpath === ROOT_SUBPATH || Str.startsWith(SUBPATH_PREFIX)(subpath)),\n Arr.filter(([subpath]) => !Str.includes(WILDCARD)(subpath)),\n Arr.map(([subpath, target]) => ({ subpath, target })),\n );\n};\n\nconst declarationsCandidateFor = (entryPath: string): Option.Option<string> => {\n if (DECLARATIONS_SUFFIX.test(entryPath)) {\n return Option.some(entryPath);\n }\n if (!SCRIPT_SUFFIX.test(entryPath)) {\n return Option.none();\n }\n return Option.some(Str.replace(SCRIPT_SUFFIX, \".d.$<module>ts\")(entryPath));\n};\n\nconst firstDeclarationsAmong = Effect.fn(\"firstDeclarationsAmong\")(function* firstDeclarations(\n directory: string,\n entryPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const candidates = Arr.getSomes(\n pipe(\n entryPaths,\n Arr.map((entryPath) => declarationsCandidateFor(entryPath)),\n ),\n );\n const existing = yield* Effect.filter(\n pipe(\n candidates,\n Arr.map((candidate) => files.join(directory, candidate)),\n ),\n (candidate) => files.exists(candidate),\n );\n return yield* Option.match(Arr.head(existing), {\n onNone: (): Effect.Effect<Option.Option<string>> => Effect.succeedNone,\n onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome),\n });\n});\n\nconst importNameOf = (packageName: string): string => {\n if (!Str.startsWith(TYPES_SCOPE)(packageName)) {\n return packageName;\n }\n const unscoped = Str.slice(TYPES_SCOPE.length)(packageName);\n if (!Str.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) {\n return unscoped;\n }\n return `@${Str.replace(TYPES_SCOPE_SEPARATOR, \"/\")(unscoped)}`;\n};\n\nconst specifierFor = (packageName: string, subpath: string): string => {\n const importName = importNameOf(packageName);\n if (subpath === ROOT_SUBPATH) {\n return importName;\n }\n return `${importName}/${Str.slice(SUBPATH_PREFIX.length)(subpath)}`;\n};\n\nconst rootEntryPaths = (manifest: Manifest): readonly string[] =>\n Arr.getSomes([\n Option.fromUndefinedOr(manifest.types),\n Option.fromUndefinedOr(manifest.typings),\n Option.fromUndefinedOr(manifest.main),\n ]);\n\nconst subpathEntriesOf = Effect.fn(\"subpathEntriesOf\")(function* subpathEntriesOf(\n packageName: string,\n directory: string,\n manifest: Manifest,\n) {\n const found = yield* Effect.forEach(subpathTargetsOf(manifest.exports), ({ subpath, target }) =>\n firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(\n Effect.map(\n Option.map((declarationsPath) => ({\n packageName,\n specifier: specifierFor(packageName, subpath),\n declarationsPath,\n })),\n ),\n ),\n );\n return Arr.getSomes(found);\n});\n\nconst entriesOfDependency = Effect.fn(\"entriesOfDependency\")(function* entriesOfDependency(\n packageName: string,\n directory: string,\n) {\n const manifest = yield* readManifest(directory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);\n const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);\n if (\n pipe(\n subpathEntries,\n Arr.some((entry) => entry.specifier === rootSpecifier),\n )\n ) {\n return subpathEntries;\n }\n const rootDeclarations = yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value));\n const rootEntries = rootDeclarations.pipe(\n Option.map((declarationsPath) => ({ packageName, specifier: rootSpecifier, declarationsPath })),\n Option.toArray,\n );\n return [...rootEntries, ...subpathEntries];\n});\n\nconst declaredDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n }),\n Arr.filter(([, range]) => !Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({ ...manifest.dependencies, ...manifest.devDependencies }),\n Arr.filter(([, range]) => Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst entryOrder = Order.mapInput(Order.String, (entry: DependencyEntry) => entry.specifier);\n\nconst dependencyEntries = Effect.fn(\"dependencyEntries\")(function* dependencyEntries(\n packageDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(packageDirectory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) =>\n entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)),\n );\n return Arr.sort(\n Arr.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier),\n entryOrder,\n );\n});\n\nexport { MANIFEST_FILE, NODE_MODULES, dependencyEntries, readManifest, workspaceDependencies };\nexport type { DependencyEntry, Manifest };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./dependencies.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nconst POSITION_BASE = 1;\n\nconst uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nconst childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile);\n\nconst isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nconst declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\n\nconst resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nconst symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nconst referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nconst lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nconst columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nconst contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nconst isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nconst propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nconst importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n\nexport {\n NODE_MODULES_SEGMENT,\n POSITION_BASE,\n childrenOf,\n columnOf,\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n isExternalDeclaration,\n isGenericDeclaration,\n isTypeDeclaration,\n lineOf,\n propertyNamesOf,\n referencedSymbols,\n resolvedSymbol,\n symbolAt,\n uniqueByReference,\n};\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n]);\n\ntype RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\ntype Problem = typeof ProblemSchema.Type;\n\nconst ProblemList = Schema.Array(ProblemSchema);\n\nconst CANDIDATE_LIMIT = 3;\n\ninterface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nconst problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nconst sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nconst describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nconst formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n\nexport { CANDIDATE_LIMIT, ProblemList, describeFinding, formatProblem, problemAt, sortProblems };\nexport type { Finding, Problem, RuleName };\n","const JSON_FLAG = \"--json\";\n\nexport { JSON_FLAG };\n"],"mappings":";;;;;;;AAeA,MAAM,qBAAqB;AAC3B,MAAM,cAAc;CAAC;CAAY;CAAY;AAAoB;AAEjE,IAAM,kBAAN,cAA8B,QAAQ,QAgBpC,CAAC,CAAC,oDAAoD,CAAC,CAAC,CAAC;AAE3D,MAAM,sBAAsB,MAAM,OAChC,iBACA,OAAO,IAAI,UAAU,sBAAsB;CACzC,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,YAAY,MAAc,SAC9B,OAAO,IAAI,UAAU,YAAY;EAK/B,MAAM,SAAS,QAAO,OAJA,aAAa,KAAK,OAAO;GAAC;GAAY;GAAM,GAAG;EAAI,GAAG;GAC1E,KAAK;GACL,OAAO;EACT,CAAC,EAAA,CAC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;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAM,gBAAgB,aACpBA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAM,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAEnF,MAAM,iBACH,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO;;AC5E1G,MAAM,YAAY"}
1
+ {"version":3,"file":"cli-contract-CkYucdU4.mjs","names":["Str","Arr","nodeServicesLayer","Rec","Arr","Str","Arr","Str","Arr"],"sources":["../src/repository-files.ts","../src/dependencies.ts","../src/syntax.ts","../src/problem.ts","../src/cli-contract.ts"],"sourcesContent":["import { layer as nodeServicesLayer } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { Option } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\"];\n\nclass RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/repository-files/RepositoryFiles\") {}\n\nconst nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitFiles = (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n Effect.gen(function* listFiles() {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", ...args], {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n listedFiles: (root) => gitFiles(root, LISTED_ARGS),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer));\n\nexport { RepositoryFiles, nodeRepositoryFiles };\n","import {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Schema,\n String as Str,\n Record as Rec,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\ninterface DependencyEntry {\n readonly packageName: string;\n readonly specifier: string;\n readonly declarationsPath: string;\n}\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\n\nconst PackageManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: DependencyMap,\n devDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n exports: Schema.optional(Schema.Unknown),\n types: Schema.optional(Schema.String),\n typings: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n});\n\ntype Manifest = typeof PackageManifest.Type;\n\nconst MANIFEST_FILE = \"package.json\";\nconst NODE_MODULES = \"node_modules\";\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst ROOT_SUBPATH = \".\";\nconst SUBPATH_PREFIX = \"./\";\nconst WILDCARD = \"*\";\nconst TYPES_CONDITION = \"types\";\nconst TYPES_SCOPE = \"@types/\";\nconst TYPES_SCOPE_SEPARATOR = \"__\";\nconst CONDITION_DEPTH_LIMIT = 8;\nconst ROOT_DEPTH = 0;\nconst DEPTH_STEP = 1;\nconst DECLARATIONS_SUFFIX = /\\.d\\.[cm]?ts$|\\.[cm]?tsx?$/u;\nconst SCRIPT_SUFFIX = /\\.(?<module>[cm]?)js$/u;\n\nconst readManifest = Effect.fn(\"readManifest\")(function* readManifest(directory: string) {\n const files = yield* RepositoryFiles;\n const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const text = yield* Effect.fromOption(manifestText);\n return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);\n}, Effect.option);\n\nconst conditionsOf = (held: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(held)) {\n return [];\n }\n return Rec.toEntries(held);\n};\n\nconst typesConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n const entries = conditionsOf(held);\n const declared = Arr.findFirst(entries, ([condition, target]) =>\n Option.liftPredicate(\n target,\n (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate),\n ),\n ).pipe(Option.filter(Predicate.isString));\n return Option.orElse(declared, () =>\n Arr.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)),\n );\n};\n\nconst anyConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (Predicate.isString(held)) {\n return Option.some(held);\n }\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n return Arr.findFirst(conditionsOf(held), ([, nested]) =>\n anyConditionIn(nested, depth + DEPTH_STEP),\n );\n};\n\nconst targetPathsOf = (target: unknown): readonly string[] =>\n Arr.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);\n\ninterface SubpathTarget {\n readonly subpath: string;\n readonly target: unknown;\n}\n\nconst subpathTargetsOf = (exportsField: unknown): readonly SubpathTarget[] => {\n if (Predicate.isString(exportsField)) {\n return [{ subpath: ROOT_SUBPATH, target: exportsField }];\n }\n const entries = conditionsOf(exportsField);\n if (\n !pipe(\n entries,\n Arr.some(([subpath]) => Str.startsWith(ROOT_SUBPATH)(subpath)),\n )\n ) {\n return Arr.match(entries, {\n onEmpty: () => [],\n onNonEmpty: () => [{ subpath: ROOT_SUBPATH, target: exportsField }],\n });\n }\n return pipe(\n entries,\n Arr.filter(([subpath]) => subpath === ROOT_SUBPATH || Str.startsWith(SUBPATH_PREFIX)(subpath)),\n Arr.filter(([subpath]) => !Str.includes(WILDCARD)(subpath)),\n Arr.map(([subpath, target]) => ({ subpath, target })),\n );\n};\n\nconst declarationsCandidateFor = (entryPath: string): Option.Option<string> => {\n if (DECLARATIONS_SUFFIX.test(entryPath)) {\n return Option.some(entryPath);\n }\n if (!SCRIPT_SUFFIX.test(entryPath)) {\n return Option.none();\n }\n return Option.some(Str.replace(SCRIPT_SUFFIX, \".d.$<module>ts\")(entryPath));\n};\n\nconst firstDeclarationsAmong = Effect.fn(\"firstDeclarationsAmong\")(function* firstDeclarations(\n directory: string,\n entryPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const candidates = Arr.getSomes(\n pipe(\n entryPaths,\n Arr.map((entryPath) => declarationsCandidateFor(entryPath)),\n ),\n );\n const existing = yield* Effect.filter(\n pipe(\n candidates,\n Arr.map((candidate) => files.join(directory, candidate)),\n ),\n (candidate) => files.exists(candidate),\n );\n return yield* Option.match(Arr.head(existing), {\n onNone: (): Effect.Effect<Option.Option<string>> => Effect.succeedNone,\n onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome),\n });\n});\n\nconst importNameOf = (packageName: string): string => {\n if (!Str.startsWith(TYPES_SCOPE)(packageName)) {\n return packageName;\n }\n const unscoped = Str.slice(TYPES_SCOPE.length)(packageName);\n if (!Str.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) {\n return unscoped;\n }\n return `@${Str.replace(TYPES_SCOPE_SEPARATOR, \"/\")(unscoped)}`;\n};\n\nconst specifierFor = (packageName: string, subpath: string): string => {\n const importName = importNameOf(packageName);\n if (subpath === ROOT_SUBPATH) {\n return importName;\n }\n return `${importName}/${Str.slice(SUBPATH_PREFIX.length)(subpath)}`;\n};\n\nconst rootEntryPaths = (manifest: Manifest): readonly string[] =>\n Arr.getSomes([\n Option.fromUndefinedOr(manifest.types),\n Option.fromUndefinedOr(manifest.typings),\n Option.fromUndefinedOr(manifest.main),\n ]);\n\nconst subpathEntriesOf = Effect.fn(\"subpathEntriesOf\")(function* subpathEntriesOf(\n packageName: string,\n directory: string,\n manifest: Manifest,\n) {\n const found = yield* Effect.forEach(subpathTargetsOf(manifest.exports), ({ subpath, target }) =>\n firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(\n Effect.map(\n Option.map((declarationsPath) => ({\n packageName,\n specifier: specifierFor(packageName, subpath),\n declarationsPath,\n })),\n ),\n ),\n );\n return Arr.getSomes(found);\n});\n\nconst entriesOfDependency = Effect.fn(\"entriesOfDependency\")(function* entriesOfDependency(\n packageName: string,\n directory: string,\n) {\n const manifest = yield* readManifest(directory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);\n const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);\n if (\n pipe(\n subpathEntries,\n Arr.some((entry) => entry.specifier === rootSpecifier),\n )\n ) {\n return subpathEntries;\n }\n const rootDeclarations = yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value));\n const rootEntries = rootDeclarations.pipe(\n Option.map((declarationsPath) => ({ packageName, specifier: rootSpecifier, declarationsPath })),\n Option.toArray,\n );\n return [...rootEntries, ...subpathEntries];\n});\n\nconst declaredDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n }),\n Arr.filter(([, range]) => !Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({ ...manifest.dependencies, ...manifest.devDependencies }),\n Arr.filter(([, range]) => Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst entryOrder = Order.mapInput(Order.String, (entry: DependencyEntry) => entry.specifier);\n\nconst dependencyEntries = Effect.fn(\"dependencyEntries\")(function* dependencyEntries(\n packageDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(packageDirectory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) =>\n entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)),\n );\n return Arr.sort(\n Arr.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier),\n entryOrder,\n );\n});\n\nexport { MANIFEST_FILE, NODE_MODULES, dependencyEntries, readManifest, workspaceDependencies };\nexport type { DependencyEntry, Manifest };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./dependencies.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nconst POSITION_BASE = 1;\n\nconst uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nconst childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile);\n\nconst isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nconst declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\n\nconst resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nconst symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nconst referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nconst lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nconst columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nconst contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nconst isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nconst propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nconst importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n\nexport {\n NODE_MODULES_SEGMENT,\n POSITION_BASE,\n childrenOf,\n columnOf,\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n isExternalDeclaration,\n isGenericDeclaration,\n isTypeDeclaration,\n lineOf,\n propertyNamesOf,\n referencedSymbols,\n resolvedSymbol,\n symbolAt,\n uniqueByReference,\n};\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"nested-docs\",\n]);\n\ntype RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\ntype Problem = typeof ProblemSchema.Type;\n\nconst ProblemList = Schema.Array(ProblemSchema);\n\nconst CANDIDATE_LIMIT = 3;\n\ninterface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nconst problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nconst sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nconst describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nconst formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n\nexport { CANDIDATE_LIMIT, ProblemList, describeFinding, formatProblem, problemAt, sortProblems };\nexport type { Finding, Problem, RuleName };\n","const JSON_FLAG = \"--json\";\n\nexport { JSON_FLAG };\n"],"mappings":";;;;;;;AAeA,MAAM,qBAAqB;AAC3B,MAAM,cAAc;CAAC;CAAY;CAAY;AAAoB;AAEjE,IAAM,kBAAN,cAA8B,QAAQ,QAgBpC,CAAC,CAAC,oDAAoD,CAAC,CAAC,CAAC;AAE3D,MAAM,sBAAsB,MAAM,OAChC,iBACA,OAAO,IAAI,UAAU,sBAAsB;CACzC,MAAM,KAAK,OAAO,WAAW;CAC7B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C3B,MAAM,OAAO,IAAI;CACjB,QAAQ,SAAS,IAAI;CACrB;CACA;AACF;AAEF,MAAM,eAAqC,MAAM,WAAW;CAC1D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,MAAM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAM,gBAAgB,aACpBA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAM,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAEnF,MAAM,iBACH,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO;;AC7E1G,MAAM,YAAY"}
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as isSignatureDeclaration, A as API, B as isCallExpression, C as MANIFEST_FILE, D as workspaceDependencies, E as readManifest, F as getLeadingCommentRanges, G as isInterfaceDeclaration, H as isElementAccessExpression, I as getNameOfDeclaration, J as isNewExpression, K as isModuleBlock, L as getTextOfJSDocComment, M as InternalSymbolName, N as SyntaxKind, O as RepositoryFiles, P as getJSDocTags, Q as isPropertyAssignment, R as isArrayLiteralExpression, S as uniqueByReference, T as dependencyEntries, U as isEnumDeclaration, V as isClassDeclaration, W as isIdentifier, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isPropertyAccessExpression, _ as lineOf, a as problemAt, at as isUnionTypeNode, b as resolvedSymbol, c as childrenOf, ct as isVariableStatement, d as declarationsOf, et as isSourceFile, f as descendantsOf, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isTypeReferenceNode, j as IndexKind, k as nodeRepositoryFiles, l as columnOf, m as isExternalDeclaration, n as ProblemList, nt as isTypeAliasDeclaration, o as sortProblems, ot as isVariableDeclaration, p as importedModulesOf, q as isModuleDeclaration, rt as isTypeLiteralNode, s as NODE_MODULES_SEGMENT, st as isVariableDeclarationList, tt as isStringLiteral, u as contains, v as propertyNamesOf, w as NODE_MODULES, x as symbolAt, y as referencedSymbols, z as isBinaryExpression } from "./cli-contract-BRpk_UKr.mjs";
2
+ import { $ as isSatisfiesExpression, A as API, B as isCallExpression, C as MANIFEST_FILE$1, D as workspaceDependencies, E as readManifest, F as getLeadingCommentRanges, G as isInterfaceDeclaration, H as isElementAccessExpression, I as getNameOfDeclaration, J as isNewExpression, K as isModuleBlock, L as getTextOfJSDocComment, M as InternalSymbolName, N as SyntaxKind, O as RepositoryFiles, P as getJSDocTags, Q as isPropertyAssignment, R as isArrayLiteralExpression, S as uniqueByReference, T as dependencyEntries, U as isEnumDeclaration, V as isClassDeclaration, W as isIdentifier, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isPropertyAccessExpression, _ as lineOf, a as problemAt, at as isTypeLiteralNode, b as resolvedSymbol, c as childrenOf, ct as isVariableDeclaration, d as declarationsOf, et as isSignatureDeclaration, f as descendantsOf, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isTypeAliasDeclaration, j as IndexKind, k as nodeRepositoryFiles, l as columnOf, lt as isVariableDeclarationList, m as isExternalDeclaration, n as ProblemList, nt as isSpreadElement, o as sortProblems, ot as isTypeReferenceNode, p as importedModulesOf, q as isModuleDeclaration, rt as isStringLiteral, s as NODE_MODULES_SEGMENT, st as isUnionTypeNode, tt as isSourceFile, u as contains, ut as isVariableStatement, v as propertyNamesOf, w as NODE_MODULES, x as symbolAt, y as referencedSymbols, z as isBinaryExpression } from "./cli-contract-CkYucdU4.mjs";
3
3
  import { Array, Cause, Effect, FileSystem, Function, Layer, Number as Number$1, Option, Order, Path, Record, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
4
4
  import { layer } from "@effect/platform-node/NodeServices";
5
5
  import { ChildProcess } from "effect/process";
@@ -322,6 +322,17 @@ const indexEntry = (cache) => (checker) => (entry) => Effect.sync(() => cache.in
322
322
  "msch.library.shapes": index.shapes.length
323
323
  })), Effect.map(({ index }) => index), Effect.withSpan("indexLibraryEntry", { attributes: { "msch.library.specifier": entry.specifier } }));
324
324
  const libraryIndex = (cache) => (checker) => (entries) => pipe(entries, Effect.forEach(indexEntry(cache)(checker)), Effect.map(mergeIndexes), Effect.withSpan("libraryIndex"));
325
+ // src/derivation.ts
326
+ const contractOf = (node) => {
327
+ const { parent } = node;
328
+ if (isSatisfiesExpression(parent) && parent.expression === node) return [parent.type];
329
+ if (isVariableDeclaration(parent) && parent.initializer === node) return Option.toArray(Option.fromUndefinedOr(parent.type));
330
+ return [];
331
+ };
332
+ const derivedDeclarationsOf = (checker) => (node) => {
333
+ const scopes = Array.prepend(contractOf(node), node);
334
+ return new Set(pipe(scopes, Array.flatMap((scope) => referencedSymbols(checker)(scope)), Array.flatMap((symbol) => declarationsOf(symbol)), Array.map((declaration) => declarationKey(locationOf(declaration)))));
335
+ };
325
336
  // src/shapes.ts
326
337
  const MINIMUM_SHAPE_PROPERTIES = 3;
327
338
  const EXACT = 0;
@@ -377,7 +388,6 @@ const localPropertiesOf = (checker) => (symbols) => pipe(Array.zip(symbols, chec
377
388
  name: symbol.name,
378
389
  type
379
390
  })));
380
- const derivedDeclarationsOf = (checker) => (node) => new Set(pipe(referencedSymbols(checker)(node), Array.flatMap((symbol) => declarationsOf(symbol)), Array.map((declaration) => declarationKey(locationOf(declaration)))));
381
391
  const matchOrder = Order.mapInput(Order.Number, (match) => match.extra);
382
392
  const shapeProblem = (site, matches) => {
383
393
  const shown = pipe(Array.take(matches, 3), Array.map((match) => describeLibraryType(match.shape)), Array.join(", "));
@@ -390,14 +400,18 @@ const shapeProblem = (site, matches) => {
390
400
  message: `This shape copies ${shown}. ${advice}`
391
401
  })(site.node);
392
402
  };
403
+ const candidatesOf = (context, open) => (site, locals) => {
404
+ const derived = derivedDeclarationsOf(context.checker)(site.node);
405
+ const named = pipe(context.shapes, Array.filter(hasEveryName(locals)));
406
+ if (pipe(named, Array.some((shape) => derived.has(declarationKey(shape.declaration))))) return [];
407
+ const candidates = pipe(named, Array.map((shape) => matchOf(context, open)(locals, shape)), Array.getSomes);
408
+ return Array.sort(candidates, matchOrder);
409
+ };
393
410
  const shapeProblemOf = (context, open) => (site) => {
394
411
  const symbols = context.checker.getPropertiesOfType(site.type);
395
412
  if (symbols.length < MINIMUM_SHAPE_PROPERTIES) return Option.none();
396
413
  const locals = localPropertiesOf(context.checker)(symbols);
397
- const derived = derivedDeclarationsOf(context.checker)(site.node);
398
- const candidates = pipe(context.shapes, Array.filter(hasEveryName(locals)), Array.filter((shape) => !derived.has(declarationKey(shape.declaration))), Array.map((shape) => matchOf(context, open)(locals, shape)), Array.getSomes);
399
- const matches = Array.sort(candidates, matchOrder);
400
- return Option.liftPredicate(matches, Array.isReadonlyArrayNonEmpty).pipe(Option.map((found) => shapeProblem(site, found)));
414
+ return Option.liftPredicate(candidatesOf(context, open)(site, locals), Array.isReadonlyArrayNonEmpty).pipe(Option.map((found) => shapeProblem(site, found)));
401
415
  };
402
416
  const shapeProblemsIn = (context) => (sourceFile) => {
403
417
  const sites = shapeSitesIn(context.checker)(sourceFile);
@@ -411,7 +425,10 @@ const namedValuesOf = (checker) => (symbol) => {
411
425
  return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));
412
426
  };
413
427
  const hasFiniteContext = (checker) => (node) => Option.fromUndefinedOr(checker.getContextualType(node)).pipe(Option.flatMap(finiteValuesOf(checker)), Option.isSome);
414
- const isNamedValue = (element) => isIdentifier(element) || isPropertyAccessExpression(element) || isElementAccessExpression(element);
428
+ const isNamedValue = (element) => {
429
+ if (isSpreadElement(element)) return isNamedValue(element.expression);
430
+ return isIdentifier(element) || isPropertyAccessExpression(element) || isElementAccessExpression(element);
431
+ };
415
432
  const namesEveryElement = (array) => pipe(array.elements, Array.every((element) => isNamedValue(element)));
416
433
  const expressionValuesOf = (checker) => (node) => {
417
434
  if (hasFiniteContext(checker)(node)) return Option.none();
@@ -665,7 +682,7 @@ const listConfigFiles = (directory) => Effect.gen(function* configFilesUnder() {
665
682
  const parseConfig = (api) => (configPath) => Option.some(api.parseConfigFile(configPath)).pipe(Option.filter((parsed) => Array.isReadonlyArrayNonEmpty(parsed.fileNames)));
666
683
  const nearestPackageDirectory = (directory, root) => Effect.gen(function* nearestPackage() {
667
684
  const files = yield* RepositoryFiles;
668
- const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));
685
+ const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE$1));
669
686
  const parent = files.dirname(directory);
670
687
  if (hasManifest || directory === root || parent === directory) return directory;
671
688
  return yield* nearestPackageDirectory(parent, root);
@@ -796,15 +813,15 @@ const NUL = "\0";
796
813
  const START = 0;
797
814
  const HEX = 16;
798
815
  const CODE_POINT_WIDTH = 4;
799
- const READ_CONCURRENCY$1 = 64;
800
- const RULE = "hidden-unicode";
816
+ const READ_CONCURRENCY$2 = 64;
817
+ const RULE$1 = "hidden-unicode";
801
818
  const hexOf = (character) => pipe(String$1.codePointAt(START)(character), Option.getOrElse(() => START), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
802
819
  const problemOf = (file, source) => (found) => {
803
820
  const hex = hexOf(found[START]);
804
821
  return {
805
822
  file,
806
823
  ...positionOf(source)(found.index ?? START),
807
- rule: RULE,
824
+ rule: RULE$1,
808
825
  message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
809
826
  };
810
827
  };
@@ -822,16 +839,48 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
822
839
  onNone: () => [],
823
840
  onSome: (source) => problemsIn(file, source)
824
841
  })));
825
- }, { concurrency: READ_CONCURRENCY$1 });
842
+ }, { concurrency: READ_CONCURRENCY$2 });
826
843
  return Array.flatten(found);
827
844
  });
828
- // src/output.ts
829
- const taggedError$1 = Schema.TaggedError;
830
- var ProblemsFound = class extends taggedError$1()("ProblemsFound", { count: Schema.Finite }) {};
845
+ // src/nested-docs.ts
846
+ const RULE = "nested-docs";
847
+ const SEPARATOR = "/";
848
+ const MANIFEST_FILE = "package.json";
849
+ const FIRST = 1;
850
+ const READ_CONCURRENCY$1 = 64;
851
+ const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
852
+ const README = /^README(?:\.[^/]+)?$/iu;
853
+ const PublishedManifest = Schema.fromJsonString(Schema.Struct({ private: Schema.optional(Schema.Boolean) }));
854
+ const isNested = (name) => String$1.includes(SEPARATOR)(name);
855
+ const isPublishedPackage = Effect.fn("isPublishedPackage")(function* isPublishedPackage(root, directory) {
856
+ const files = yield* RepositoryFiles;
857
+ const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));
858
+ return pipe(text, Option.flatMap(Schema.decodeUnknownOption(PublishedManifest)), Option.exists((manifest) => manifest.private !== true));
859
+ });
860
+ const problemFor = (file, message) => ({
861
+ file,
862
+ line: FIRST,
863
+ column: FIRST,
864
+ rule: RULE,
865
+ message
866
+ });
867
+ const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
868
+ const README_MESSAGE = "belongs only at the repository root or next to the package.json of a published package. Move its content into the root README.md and delete this file.";
869
+ const problemIn = Effect.fn("problemIn")(function* problemIn(root, name) {
870
+ const files = yield* RepositoryFiles;
871
+ const base = files.basename(name);
872
+ const file = files.join(root, name);
873
+ if (AGENT_DOCS.test(base)) return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));
874
+ if (!README.test(base)) return Option.none();
875
+ if (yield* isPublishedPackage(root, files.dirname(name))) return Option.none();
876
+ return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));
877
+ });
831
878
  /** @internal */
832
- const writeStdout = Effect.fn("writeStdout")(function* writeStdout(text) {
833
- const stdio = yield* Stdio.Stdio;
834
- yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);
879
+ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(root) {
880
+ const names = yield* (yield* RepositoryFiles).listedFiles(root);
881
+ const nested = pipe(names, Array.filter(isNested));
882
+ const found = yield* Effect.forEach(nested, (name) => problemIn(root, name), { concurrency: READ_CONCURRENCY$1 });
883
+ return Array.getSomes(found);
835
884
  });
836
885
  // src/override-findings.ts
837
886
  const describeVersions = (versions) => Option.getOrElse(Option.liftPredicate(Array.join(versions, ","), (joined) => joined !== ""), () => "-");
@@ -1024,8 +1073,8 @@ const RESOLUTION_FILES = [
1024
1073
  ];
1025
1074
  const RESOLUTION_CONCURRENCY = 4;
1026
1075
  const SUCCEEDED = 0;
1027
- const taggedError = Schema.TaggedError;
1028
- var OverrideResolutionFailed = class extends taggedError()("OverrideResolutionFailed", {
1076
+ const taggedError$1 = Schema.TaggedError;
1077
+ var OverrideResolutionFailed = class extends taggedError$1()("OverrideResolutionFailed", {
1029
1078
  override: Schema.String,
1030
1079
  output: Schema.String
1031
1080
  }) {};
@@ -1185,6 +1234,26 @@ const checkPython = Effect.fn("checkPython")(function* checkPython(root) {
1185
1234
  const present = yield* Effect.filter(pipe(listed, Array.filter(isPython)), ({ file }) => files.exists(file));
1186
1235
  return [...pipe(present, Array.map(fileProblem)), ...Array.flatten(scanned)];
1187
1236
  });
1237
+ // src/all-checks.ts
1238
+ /** @internal */
1239
+ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
1240
+ const found = yield* Effect.all([
1241
+ checkRepository(root),
1242
+ checkOverrides(root),
1243
+ checkHiddenUnicode(root),
1244
+ checkPython(root),
1245
+ checkNestedDocs(root)
1246
+ ], { concurrency: "unbounded" });
1247
+ return Array.flatten(found);
1248
+ });
1249
+ // src/output.ts
1250
+ const taggedError = Schema.TaggedError;
1251
+ var ProblemsFound = class extends taggedError()("ProblemsFound", { count: Schema.Finite }) {};
1252
+ /** @internal */
1253
+ const writeStdout = Effect.fn("writeStdout")(function* writeStdout(text) {
1254
+ const stdio = yield* Stdio.Stdio;
1255
+ yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);
1256
+ });
1188
1257
  // src/runtime.ts
1189
1258
  const reportFailure = (cause) => Effect.gen(function* report() {
1190
1259
  const stdio = yield* Stdio.Stdio;
@@ -1211,13 +1280,8 @@ runCli(Effect.gen(function* msch() {
1211
1280
  const files = yield* RepositoryFiles;
1212
1281
  const args = yield* stdio.args;
1213
1282
  const root = files.resolve(".");
1214
- const found = yield* Effect.all([
1215
- checkRepository(root),
1216
- checkOverrides(root),
1217
- checkHiddenUnicode(root),
1218
- checkPython(root)
1219
- ], { concurrency: "unbounded" });
1220
- const problems = sortProblems(Array.flatten(found));
1283
+ const found = yield* checkAll(root);
1284
+ const problems = sortProblems(found);
1221
1285
  if (args.includes("--json")) {
1222
1286
  const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);
1223
1287
  return yield* writeStdout(text);
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["Arr","Arr","Fn","SCOPE_PREFIX","packageOf","Str","Arr","Arr","Str","Arr","Arr","Arr","Arr","Arr","Arr","Rec","Num","Str","Arr","Arr","Str","Fn","Arr","START","FIRST_COLUMN","Str","Arr","READ_CONCURRENCY","Str","Arr","taggedError","Arr","Arr","Rec","Str","LOCKFILE","Str","Arr","Str","Arr","nodeServicesLayer","Arr"],"sources":["../src/slots.ts","../src/values.ts","../src/flows.ts","../src/owners.ts","../src/library.ts","../src/shapes.ts","../src/sites.ts","../src/value-checks.ts","../src/analysis.ts","../src/duplicates.ts","../src/telemetry.ts","../src/project.ts","../src/check.ts","../src/text-position.ts","../src/hidden-unicode.ts","../src/output.ts","../src/override-findings.ts","../src/override-resolution.ts","../src/overrides.ts","../src/python.ts","../src/runtime.ts","../src/cli.ts"],"sourcesContent":["import { Array as Arr, Option } from \"effect\";\n\nimport {\n isCallExpression,\n isNewExpression,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\ntype AnnotatedDeclaration =\n | ParameterDeclaration\n | VariableDeclaration\n | PropertySignatureDeclaration\n | PropertyDeclaration;\n\nconst ANNOTATED_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.Parameter,\n SyntaxKind.VariableDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotated = (declaration: Declaration): declaration is AnnotatedDeclaration =>\n ANNOTATED_KINDS.has(declaration.kind);\n\nconst annotationOf = (declaration: Declaration): Option.Option<TypeNode> =>\n Option.liftPredicate(declaration, isAnnotated).pipe(\n Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)),\n );\n\nconst argumentSlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const call = expression.parent;\n if (!isCallExpression(call) && !isNewExpression(call)) {\n return Option.none();\n }\n const { arguments: listed } = call;\n const callArguments: readonly Expression[] = listed ?? [];\n const index = callArguments.indexOf(expression);\n return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.filter(isSignatureDeclaration),\n Option.flatMap((declaration) => Arr.get(declaration.parameters, index)),\n );\n };\n\nconst propertySlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const assignment = expression.parent;\n if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(\n Option.flatMap((objectType) =>\n Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText())),\n ),\n Option.flatMap((property) => Arr.head(declarationsOf(property))),\n );\n };\n\nconst variableSlot = (expression: Expression): Option.Option<Declaration> => {\n const declaration = expression.parent;\n if (!isVariableDeclaration(declaration) || declaration.initializer !== expression) {\n return Option.none();\n }\n return Option.some(declaration);\n};\n\nconst slotOf =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> =>\n argumentSlot(checker)(expression).pipe(\n Option.orElse(() => propertySlot(checker)(expression)),\n Option.orElse(() => variableSlot(expression)),\n );\n\nconst contextSymbolsOf =\n (checker: Checker) =>\n (expression: Expression): readonly TypeSymbol[] => {\n const alias = Option.fromUndefinedOr(checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) => Option.fromUndefinedOr(contextual.getAliasSymbol())),\n );\n if (Option.isSome(alias)) {\n return [alias.value];\n }\n return slotOf(checker)(expression).pipe(\n Option.flatMap(annotationOf),\n Option.map((annotation) => referencedSymbols(checker)(annotation)),\n Option.getOrElse(() => []),\n );\n };\n\nexport { annotationOf, contextSymbolsOf, slotOf };\n","import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\ntype Value = string | number;\n\ninterface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nconst valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nconst literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nconst literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nconst schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nconst finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nconst vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nconst isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nconst sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nconst formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n\nexport {\n finiteValuesOf,\n formatValues,\n isSubsetOf,\n literalUnionOf,\n literalValuesOf,\n sameValues,\n schemaTypeOf,\n valueKey,\n vocabularyOf,\n};\nexport type { Value, Vocabulary };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getNameOfDeclaration,\n isClassDeclaration,\n isElementAccessExpression,\n isIdentifier,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isSignatureDeclaration,\n isTypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n ClassDeclaration,\n Declaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SignatureDeclaration,\n SourceFile,\n TypeSymbol,\n Type,\n} from \"./compiler.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n NODE_MODULES_SEGMENT,\n symbolAt,\n} from \"./syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\ninterface FlowContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly sites: readonly ValueSite[];\n}\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\nconst MODULE_PREFIX = /^\".*?\"\\./u;\n\nconst packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nconst externalDeclarationOf =\n (context: FlowContext) =>\n (symbol: TypeSymbol): Option.Option<Declaration> =>\n Arr.findFirst(declarationsOf(symbol), (declaration) =>\n isExternalDeclaration(context.program)(declaration),\n );\n\nconst aliasTarget =\n (context: FlowContext) =>\n (type: Type): Option.Option<string> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) =>\n externalDeclarationOf(context)(alias).pipe(\n Option.map(\n (declaration) =>\n `${Str.replace(MODULE_PREFIX, \"\")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`,\n ),\n ),\n ),\n );\n\nconst isNamedContainer = (\n node: Node,\n): node is SignatureDeclaration | InterfaceDeclaration | ClassDeclaration =>\n isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);\n\nconst slotTarget =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<string> =>\n slotOf(context.checker)(expression).pipe(\n Option.filter((slot) => isExternalDeclaration(context.program)(slot)),\n Option.filter((slot) =>\n Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot))),\n ),\n Option.map((slot) => {\n const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(\n Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))),\n Option.map((name) => ` of ${name.getText()}`),\n Option.getOrElse(() => \"\"),\n );\n const name = Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(\n Option.map((found) => found.getText()),\n Option.getOrElse(() => \"value\"),\n );\n return `${name}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;\n }),\n );\n\nconst libraryTargetOf =\n (context: FlowContext) =>\n (expression: Expression, contextual: Type): Option.Option<string> =>\n aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));\n\nconst siteWithin =\n (context: FlowContext) =>\n (node: Node): Option.Option<ValueSite> =>\n Arr.findFirst(context.sites, (site) => contains(node)(site.node));\n\nconst aliasSite =\n (context: FlowContext) =>\n (type: Type): Option.Option<ValueSite> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) => Arr.findFirst(declarationsOf(alias), isTypeAliasDeclaration)),\n Option.flatMap(siteWithin(context)),\n );\n\nconst annotationSite =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n symbolAt(context.checker)(expression).pipe(\n Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)),\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.flatMap(annotationOf),\n Option.flatMap((annotation) =>\n siteWithin(context)(annotation).pipe(\n Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))),\n ),\n ),\n );\n\nconst siteBehind =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(\n Option.orElse(() => annotationSite(context)(expression)),\n );\n\nconst isFlowSource = (node: Node): node is Expression =>\n isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst flowOf =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<Flow> =>\n Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) =>\n Option.all([\n vocabularyOf(context.checker)(contextual),\n libraryTargetOf(context)(expression, contextual),\n ]),\n ),\n Option.flatMap(([vocabulary, target]) =>\n siteBehind(context)(expression).pipe(\n Option.filter((site) => isSubsetOf(site.values, vocabulary.values)),\n Option.map((site) => ({ site, target })),\n ),\n ),\n );\n\nconst flowsIn =\n (context: FlowContext) =>\n (sourceFile: SourceFile): readonly Flow[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isFlowSource(node)),\n Arr.map((node) => flowOf(context)(node)),\n ),\n );\n\nexport { flowsIn };\nexport type { Flow, FlowContext };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"./compiler.ts\";\nimport { problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"./syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface Owner {\n readonly conceptId: string;\n readonly key: string;\n readonly name: string;\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly packageName: Option.Option<string>;\n readonly values: readonly Value[];\n}\n\ninterface OwnerScan {\n readonly owners: readonly Owner[];\n readonly problems: readonly Problem[];\n}\n\ninterface Annotated {\n readonly node: Node;\n readonly conceptId: string;\n}\n\nconst OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nconst ownerKeyOf = (declaration: Declaration): Option.Option<string> => {\n if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) {\n return Option.none();\n }\n return Option.some(`${declaration.getSourceFile().fileName}#${declaration.name.text}`);\n};\n\nconst annotationsOf = (node: Node): readonly Annotated[] =>\n pipe(\n getJSDocTags(node),\n Arr.filter((tag) => tag.tagName.text === OWNER_TAG),\n Arr.map((tag) => ({ node, conceptId: Str.trim(getTextOfJSDocComment(tag.comment) ?? \"\") })),\n );\n\nconst ANNOTATABLE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.VariableDeclaration,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyAssignment,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotatable = (node: Node): boolean => ANNOTATABLE_KINDS.has(node.kind);\n\nconst isConstList = (list: VariableDeclarationList): boolean =>\n Option.fromUndefinedOr(list.getFirstToken()).pipe(\n Option.exists((token) => token.kind === SyntaxKind.ConstKeyword),\n );\n\nconst isModuleStatementList = (list: VariableDeclarationList): boolean =>\n isVariableStatement(list.parent) && isSourceFile(list.parent.parent);\n\nconst isModuleConstList = (node: Node): node is VariableDeclarationList =>\n isVariableDeclarationList(node) && isModuleStatementList(node) && isConstList(node);\n\nconst isModuleConst = (node: Node): node is VariableDeclaration =>\n isVariableDeclaration(node) && isIdentifier(node.name) && isModuleConstList(node.parent);\n\nconst objectValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalValuesOf(\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => checker.getTypeOfSymbol(property)),\n ),\n );\n\nconst ownerValuesOf =\n (checker: Checker) =>\n (declaration: VariableDeclaration): Option.Option<readonly Value[]> => {\n const type = checker.getTypeAtLocation(declaration.name);\n return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));\n };\n\nconst annotationProblem = (message: string): ((node: Node) => Problem) =>\n problemAt({ rule: \"owner-annotation\", message });\n\nconst scanned = (owners: readonly Owner[], problems: readonly Problem[]): OwnerScan => ({\n owners,\n problems,\n});\n\nconst ownerOf =\n (project: Project) =>\n (annotated: Annotated): OwnerScan => {\n const { node, conceptId } = annotated;\n if (!isModuleConst(node)) {\n return scanned(\n [],\n [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)],\n );\n }\n if (conceptId === \"\") {\n return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);\n }\n const values = ownerValuesOf(project.checker)(node);\n return Option.match(Option.all([values, ownerKeyOf(node)]), {\n onNone: () =>\n scanned(\n [],\n [annotationProblem(`The owner of ${conceptId} holds no finite value set.`)(node)],\n ),\n onSome: ([ownedValues, key]) =>\n scanned(\n [\n {\n conceptId,\n key,\n name: node.name.getText(),\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n packageName: project.packageName,\n values: ownedValues,\n },\n ],\n [],\n ),\n });\n };\n\nconst annotatedIn = (sourceFile: SourceFile): readonly Annotated[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isAnnotatable(node)),\n Arr.flatMap((node) => annotationsOf(node)),\n );\n\nconst ownerProblem =\n (message: string) =>\n (owner: Owner): Problem => ({\n file: owner.file,\n line: owner.line,\n column: owner.column,\n rule: \"owner-annotation\",\n message,\n });\n\nconst conflictProblems = (owners: readonly Owner[]): readonly Problem[] =>\n pipe(\n owners,\n Arr.flatMap((owner, index) => {\n const earlier = Arr.take(owners, index);\n const sameConcept = pipe(\n earlier,\n Arr.filter((other) => other.conceptId === owner.conceptId),\n );\n const sameSet = pipe(\n earlier,\n Arr.filter(\n (other) => other.conceptId !== owner.conceptId && sameValues(other.values, owner.values),\n ),\n );\n return [\n ...pipe(\n Arr.take(sameConcept, FIRST_OWNER_COUNT),\n Arr.map(() =>\n ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner),\n ),\n ),\n ...pipe(\n Arr.take(sameSet, FIRST_OWNER_COUNT),\n Arr.map((other) =>\n ownerProblem(\n `The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`,\n )(owner),\n ),\n ),\n ];\n }),\n );\n\nconst ownersIn = (project: Project): OwnerScan => {\n const results = pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n annotatedIn(sourceFile),\n Arr.map((annotated) => ownerOf(project)(annotated)),\n ),\n ),\n );\n return scanned(\n pipe(\n results,\n Arr.flatMap((result) => result.owners),\n ),\n pipe(\n results,\n Arr.flatMap((result) => result.problems),\n ),\n );\n};\n\nconst combineOwnerScans = (scans: readonly OwnerScan[]): OwnerScan => {\n const owners = Arr.dedupeWith(\n pipe(\n scans,\n Arr.flatMap((scan) => scan.owners),\n ),\n (left, right) => left.key === right.key,\n );\n const problems = [\n ...pipe(\n scans,\n Arr.flatMap((scan) => scan.problems),\n ),\n ...conflictProblems(owners),\n ];\n return { owners, problems };\n};\n\nexport { OWNER_TAG, combineOwnerScans, ownerKeyOf, ownersIn };\nexport type { Owner, OwnerScan };\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { InternalSymbolName, isModuleDeclaration, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Declaration, Node, SyntaxKind, TypeSymbol, Type } from \"./compiler.ts\";\nimport type { DependencyEntry } from \"./dependencies.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"./syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"./values.ts\";\nimport type { Vocabulary } from \"./values.ts\";\n\ninterface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\ninterface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\ninterface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\ninterface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\ninterface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nconst isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nconst describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nconst locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nconst declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\ninterface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\ninterface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nconst libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nconst libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n Effect.forEach(indexEntry(cache)(checker)),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n\nexport {\n declarationKey,\n describeLibraryType,\n isObjectType,\n libraryCache,\n libraryIndex,\n locationOf,\n};\nexport type {\n CachedIndex,\n DeclarationLocation,\n LibraryCache,\n LibraryIndex,\n LibraryShape,\n LibraryType,\n LibraryVocabulary,\n};\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { declarationKey, describeLibraryType, isObjectType, locationOf } from \"./library.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"./library.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport {\n declarationsOf,\n descendantsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n referencedSymbols,\n} from \"./syntax.ts\";\nimport { schemaTypeOf } from \"./values.ts\";\n\ninterface ShapeContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface ShapeSite {\n readonly node: Node;\n readonly type: Type;\n}\n\ninterface ShapeMatch {\n readonly shape: LibraryShape;\n readonly extra: number;\n}\n\nconst MINIMUM_SHAPE_PROPERTIES = 3;\nconst EXACT = 0;\n\nconst augmentsAModule = (node: Node): boolean => {\n const block = node.parent;\n return (\n isModuleBlock(block) && isModuleDeclaration(block.parent) && isStringLiteral(block.parent.name)\n );\n};\n\nconst isPlainInterface = (node: Node): node is InterfaceDeclaration =>\n isInterfaceDeclaration(node) && !isGenericDeclaration(node) && !augmentsAModule(node);\n\nconst isPlainTypeLiteral = (node: Node): node is TypeAliasDeclaration =>\n isTypeAliasDeclaration(node) && !isGenericDeclaration(node) && isTypeLiteralNode(node.type);\n\nconst isDeclaredShape = (node: Node): node is InterfaceDeclaration | TypeAliasDeclaration =>\n isPlainInterface(node) || isPlainTypeLiteral(node);\n\nconst declaredShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> =>\n Option.liftPredicate(node, isDeclaredShape).pipe(\n Option.map((declaration) => checker.getTypeAtLocation(declaration.name)),\n );\n\nconst schemaShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> => {\n if (!isCallExpression(node)) {\n return Option.none();\n }\n const { arguments: callArguments } = node;\n if (\n !pipe(\n callArguments,\n Arr.some((argument) => isObjectLiteralExpression(argument)),\n )\n ) {\n return Option.none();\n }\n return schemaTypeOf(checker)(checker.getTypeAtLocation(node)).pipe(\n Option.filter((type) => isObjectType(checker)(type)),\n );\n };\n\nconst shapeSitesIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly ShapeSite[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.map((node) =>\n declaredShapeOf(checker)(node).pipe(\n Option.orElse(() => schemaShapeOf(checker)(node)),\n Option.map((type) => ({ node, type })),\n ),\n ),\n ),\n );\n\ninterface LocalProperty {\n readonly name: string;\n readonly type: Type;\n}\n\ninterface OpenTypeIds {\n readonly any: number;\n readonly unknown: number;\n}\n\nconst openTypeIdsOf = (checker: Checker): OpenTypeIds => ({\n any: checker.getAnyType().id,\n unknown: checker.getUnknownType().id,\n});\n\ntype IndexedDeclaration =\n | TypeAliasDeclaration\n | InterfaceDeclaration\n | EnumDeclaration\n | VariableDeclaration;\n\nconst isIndexedDeclaration = (node: Node): node is IndexedDeclaration =>\n isTypeDeclaration(node) || isVariableDeclaration(node);\n\nconst declarationAt =\n (program: Program) =>\n (location: DeclarationLocation): Option.Option<IndexedDeclaration> =>\n Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(\n Option.flatMap((sourceFile) =>\n Arr.findFirst(\n descendantsOf(sourceFile),\n (node): node is IndexedDeclaration =>\n node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node),\n ),\n ),\n );\n\nconst symbolOfDeclaration =\n (checker: Checker) =>\n (declaration: IndexedDeclaration): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(declaration.name));\n\nconst shapeTypeOf =\n (context: ShapeContext) =>\n (shape: LibraryShape): Option.Option<Type> => {\n const { checker } = context;\n return declarationAt(context.program)(shape.declaration).pipe(\n Option.flatMap((declaration) =>\n symbolOfDeclaration(checker)(declaration).pipe(\n Option.flatMap((symbol) => {\n if (shape.form === \"declared\") {\n return Option.some(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return schemaTypeOf(checker)(checker.getTypeOfSymbolAtLocation(symbol, declaration));\n }),\n ),\n ),\n );\n };\n\nconst hasEveryName =\n (locals: readonly LocalProperty[]) =>\n (shape: LibraryShape): boolean => {\n const names: ReadonlySet<string> = new Set(shape.propertyNames);\n return pipe(\n locals,\n Arr.every((local) => names.has(local.name)),\n );\n };\n\nconst sameProperty =\n (checker: Checker, open: OpenTypeIds) =>\n (localType: Type, library: TypeSymbol): boolean => {\n const libraryType = checker.getTypeOfSymbol(library);\n return (\n libraryType.id !== open.any &&\n libraryType.id !== open.unknown &&\n checker.isTypeAssignableTo(localType, libraryType) &&\n checker.isTypeAssignableTo(libraryType, localType)\n );\n };\n\nconst matchOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (locals: readonly LocalProperty[], shape: LibraryShape): Option.Option<ShapeMatch> => {\n const { checker } = context;\n const matches = shapeTypeOf(context)(shape).pipe(\n Option.exists((shapeType) =>\n pipe(\n locals,\n Arr.every((local) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(\n Option.exists((library) => sameProperty(checker, open)(local.type, library)),\n ),\n ),\n ),\n ),\n );\n if (!matches) {\n return Option.none();\n }\n return Option.some({ shape, extra: shape.propertyNames.length - locals.length });\n };\n\nconst localPropertiesOf =\n (checker: Checker) =>\n (symbols: readonly TypeSymbol[]): readonly LocalProperty[] =>\n pipe(\n Arr.zip(symbols, checker.getTypeOfSymbol(symbols)),\n Arr.map(([symbol, type]) => ({ name: symbol.name, type })),\n );\n\nconst derivedDeclarationsOf =\n (checker: Checker) =>\n (node: Node): ReadonlySet<string> =>\n new Set(\n pipe(\n referencedSymbols(checker)(node),\n Arr.flatMap((symbol) => declarationsOf(symbol)),\n Arr.map((declaration) => declarationKey(locationOf(declaration))),\n ),\n );\n\nconst matchOrder = Order.mapInput(Order.Number, (match: ShapeMatch) => match.extra);\n\nconst shapeProblem = (site: ShapeSite, matches: readonly ShapeMatch[]): Problem => {\n const shown = pipe(\n Arr.take(matches, CANDIDATE_LIMIT),\n Arr.map((match) => describeLibraryType(match.shape)),\n Arr.join(\", \"),\n );\n const advice = Option.match(\n Arr.findFirst(matches, (match) => match.extra === EXACT),\n {\n onNone: () =>\n \"Derive it from the library type, for example with Pick, instead of copying its properties.\",\n onSome: () => \"Use the library type instead of copying it.\",\n },\n );\n return problemAt({ rule: \"library-shape\", message: `This shape copies ${shown}. ${advice}` })(\n site.node,\n );\n};\n\nconst shapeProblemOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite): Option.Option<Problem> => {\n const symbols = context.checker.getPropertiesOfType(site.type);\n if (symbols.length < MINIMUM_SHAPE_PROPERTIES) {\n return Option.none();\n }\n const locals = localPropertiesOf(context.checker)(symbols);\n const derived = derivedDeclarationsOf(context.checker)(site.node);\n const candidates = pipe(\n context.shapes,\n Arr.filter(hasEveryName(locals)),\n Arr.filter((shape) => !derived.has(declarationKey(shape.declaration))),\n Arr.map((shape) => matchOf(context, open)(locals, shape)),\n Arr.getSomes,\n );\n const matches = Arr.sort(candidates, matchOrder);\n return Option.liftPredicate(matches, Arr.isReadonlyArrayNonEmpty).pipe(\n Option.map((found) => shapeProblem(site, found)),\n );\n };\n\nconst shapeProblemsIn =\n (context: ShapeContext) =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const sites = shapeSitesIn(context.checker)(sourceFile);\n if (!Arr.isReadonlyArrayNonEmpty(sites)) {\n return [];\n }\n const open = openTypeIdsOf(context.checker);\n return Arr.getSomes(\n pipe(\n sites,\n Arr.map((site) => shapeProblemOf(context, open)(site)),\n ),\n );\n };\n\nexport { shapeProblemsIn };\nexport type { ShapeContext };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isElementAccessExpression,\n isEnumDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n isTypeReferenceNode,\n isUnionTypeNode,\n} from \"./compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"./compiler.ts\";\nimport {\n childrenOf,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n} from \"./syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface ValueSite {\n readonly node: Node;\n readonly values: readonly Value[];\n readonly sources: readonly TypeSymbol[];\n}\n\nconst namedValuesOf =\n (checker: Checker) =>\n (symbol: TypeSymbol): Option.Option<readonly Value[]> => {\n if (\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isTypeDeclaration(declaration)),\n )\n ) {\n return finiteValuesOf(checker)(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));\n };\n\nconst hasFiniteContext =\n (checker: Checker) =>\n (node: Expression): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst isNamedValue = (element: Expression): boolean =>\n isIdentifier(element) ||\n isPropertyAccessExpression(element) ||\n isElementAccessExpression(element);\n\nconst namesEveryElement = (array: ArrayLiteralExpression): boolean =>\n pipe(\n array.elements,\n Arr.every((element) => isNamedValue(element)),\n );\n\nconst expressionValuesOf =\n (checker: Checker) =>\n (node: Expression): Option.Option<readonly Value[]> => {\n if (hasFiniteContext(checker)(node)) {\n return Option.none();\n }\n const type = checker.getTypeAtLocation(node);\n if (isArrayLiteralExpression(node)) {\n return Option.liftPredicate(node, (array) => !namesEveryElement(array)).pipe(\n Option.flatMap(() => finiteValuesOf(checker)(type)),\n );\n }\n return schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf));\n };\n\nconst selectsKeys =\n (checker: Checker) =>\n (node: UnionTypeNode, values: readonly Value[]): boolean => {\n const { parent } = node;\n if (!isTypeReferenceNode(parent)) {\n return false;\n }\n const typeArguments: readonly TypeNode[] = parent.typeArguments ?? [];\n return pipe(\n typeArguments,\n Arr.filter((argument) => argument !== node),\n Arr.some((argument) =>\n isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument))),\n ),\n );\n };\n\nconst unionValuesOf =\n (checker: Checker) =>\n (node: UnionTypeNode): Option.Option<readonly Value[]> =>\n literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(\n Option.filter((values) => !selectsKeys(checker)(node, values)),\n );\n\nconst isExpressionSite = (node: Node): node is ArrayLiteralExpression | CallExpression =>\n isArrayLiteralExpression(node) || isCallExpression(node);\n\nconst expressionSiteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> =>\n Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));\n\nconst siteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> => {\n if (isUnionTypeNode(node)) {\n return unionValuesOf(checker)(node);\n }\n if (isEnumDeclaration(node)) {\n return literalUnionOf(checker.getTypeAtLocation(node.name));\n }\n return expressionSiteValuesOf(checker)(node);\n };\n\nconst derivationScopeOf = (node: Node): Node => {\n if (isTypeReferenceNode(node.parent)) {\n return node.parent;\n }\n return node;\n};\n\nconst sourcesOf =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] =>\n pipe(\n referencedSymbols(checker)(derivationScopeOf(node)),\n Arr.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))),\n );\n\nconst sitesUnder =\n (checker: Checker) =>\n (node: Node): readonly ValueSite[] => {\n const nested = pipe(\n childrenOf(node),\n Arr.flatMap((child) => sitesUnder(checker)(child)),\n );\n if (Arr.isReadonlyArrayNonEmpty(nested)) {\n return nested;\n }\n return siteValuesOf(checker)(node).pipe(\n Option.map((values) => ({ node, values, sources: sourcesOf(checker)(node) })),\n Option.toArray,\n );\n };\n\nexport { sitesUnder };\nexport type { ValueSite };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"./compiler.ts\";\nimport type { Flow } from \"./flows.ts\";\nimport { describeLibraryType } from \"./library.ts\";\nimport type { LibraryVocabulary } from \"./library.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"./syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\ninterface SiteVerdict {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst OWNER_SEARCH_DEPTH = 4;\nconst NOTHING_HIDDEN = 0;\n\nconst directOwners =\n (context: ValueContext) =>\n (symbol: TypeSymbol): readonly Owner[] => {\n const keys = Arr.getSomes(\n pipe(\n declarationsOf(symbol),\n Arr.map((declaration) => ownerKeyOf(declaration)),\n ),\n );\n return pipe(\n context.owners,\n Arr.filter((owner) => keys.includes(owner.key)),\n );\n };\n\nconst isFollowable = (declaration: Declaration): boolean =>\n !declaration.getSourceFile().isDeclarationFile &&\n (isTypeAliasDeclaration(declaration) || isVariableDeclaration(declaration));\n\nconst ownersBehind =\n (context: ValueContext) =>\n (symbol: TypeSymbol, ancestors: readonly TypeSymbol[]): readonly Owner[] => {\n const direct = directOwners(context)(symbol);\n if (Arr.isReadonlyArrayNonEmpty(direct) || ancestors.length >= OWNER_SEARCH_DEPTH) {\n return direct;\n }\n const visited = [...ancestors, symbol];\n return uniqueByReference(\n pipe(\n declarationsOf(symbol),\n Arr.filter((declaration) => isFollowable(declaration)),\n Arr.flatMap((declaration) => referencedSymbols(context.checker)(declaration)),\n Arr.filter((referenced) => !visited.includes(referenced)),\n Arr.flatMap((referenced) => ownersBehind(context)(referenced, visited)),\n ),\n );\n };\n\nconst describeOwners = (owners: readonly Owner[]): string =>\n pipe(\n owners,\n Arr.map((owner) => `${owner.conceptId} (${owner.name})`),\n Arr.join(\", \"),\n );\n\nconst verdict = (problems: readonly Problem[], unowned: readonly ValueSite[]): SiteVerdict => ({\n problems,\n unowned,\n});\n\nconst derivedVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = uniqueByReference(\n pipe(\n site.sources,\n Arr.flatMap((source) => ownersBehind(context)(source, [])),\n ),\n );\n const held = pipe(\n owners,\n Arr.flatMap((owner) => owner.values),\n );\n const added = pipe(\n site.values,\n Arr.filter((value) => !isSubsetOf([value], held)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(owners) || !Arr.isReadonlyArrayNonEmpty(added)) {\n return verdict([], []);\n }\n const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;\n return verdict([problemAt({ rule: \"owner-extension\", message })(site.node)], []);\n };\n\nconst libraryCandidates =\n (context: ValueContext) =>\n (site: ValueSite): readonly string[] => {\n const flowing = Arr.dedupe(\n pipe(\n context.flows,\n Arr.filter((flow) => flow.site.node === site.node),\n Arr.map((flow) => flow.target),\n ),\n );\n if (Arr.isReadonlyArrayNonEmpty(flowing)) {\n return flowing;\n }\n if (\n !pipe(\n site.values,\n Arr.some((value) => typeof value === \"string\"),\n )\n ) {\n return [];\n }\n const imported = importedModulesOf(site.node.getSourceFile());\n return Arr.dedupe(\n pipe(\n context.vocabularies,\n Arr.filter((library) => imported.includes(library.specifier)),\n Arr.filter((library) => isSubsetOf(site.values, library.vocabulary.values)),\n Arr.map((library) => describeLibraryType(library)),\n ),\n );\n };\n\nconst listCandidates = (candidates: readonly string[]): string => {\n const shown = pipe(Arr.take(candidates, CANDIDATE_LIMIT), Arr.join(\", \"));\n const hidden = candidates.length - CANDIDATE_LIMIT;\n if (hidden > NOTHING_HIDDEN) {\n return `${shown} and ${String(hidden)} more`;\n }\n return shown;\n};\n\nconst originalVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = pipe(\n context.owners,\n Arr.filter((owner) => isSubsetOf(site.values, owner.values)),\n );\n if (Arr.isReadonlyArrayNonEmpty(owners)) {\n const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;\n return verdict([problemAt({ rule: \"owner-value-set\", message })(site.node)], []);\n }\n const candidates = libraryCandidates(context)(site);\n if (Arr.isReadonlyArrayNonEmpty(candidates)) {\n const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;\n return verdict([problemAt({ rule: \"library-value-set\", message })(site.node)], []);\n }\n return verdict([], [site]);\n };\n\nconst siteVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n if (Arr.isReadonlyArrayNonEmpty(site.sources)) {\n return derivedVerdict(context)(site);\n }\n return originalVerdict(context)(site);\n };\n\nconst VALUE_PARENT_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ReturnStatement,\n SyntaxKind.ArrayLiteralExpression,\n SyntaxKind.ConditionalExpression,\n SyntaxKind.ParenthesizedExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.JsxExpression,\n]);\n\nconst isCallArgument = (node: Node, parent: Node): boolean =>\n (isCallExpression(parent) || isNewExpression(parent)) && parent.expression !== node;\n\nconst isInitializer = (node: Node, parent: Node): boolean =>\n (isPropertyAssignment(parent) || isVariableDeclaration(parent)) && parent.initializer === node;\n\nconst isRightOperand = (node: Node, parent: Node): boolean =>\n isBinaryExpression(parent) && parent.right === node;\n\nconst VALUE_SLOTS = [isCallArgument, isInitializer, isRightOperand];\n\nconst isValuePosition = (node: Node): boolean => {\n const { parent } = node;\n return (\n VALUE_PARENT_KINDS.has(parent.kind) ||\n pipe(\n VALUE_SLOTS,\n Arr.some((isSlot) => isSlot(node, parent)),\n )\n );\n};\n\nconst ownedLiteralProblem =\n (context: ValueContext) =>\n (literal: StringLiteral | NumericLiteral): Option.Option<Problem> =>\n Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(\n Option.filter((contextual) =>\n vocabularyOf(context.checker)(contextual).pipe(\n Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues),\n ),\n ),\n Option.map(() =>\n pipe(\n contextSymbolsOf(context.checker)(literal),\n Arr.flatMap((symbol) => ownersBehind(context)(symbol, [])),\n uniqueByReference,\n Arr.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Arr.map(String)))),\n ),\n ),\n Option.filter((owners) => Arr.isReadonlyArrayNonEmpty(owners)),\n Option.map((owners) =>\n problemAt({\n rule: \"owned-literal\",\n message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`,\n })(literal),\n ),\n );\n\nconst ownedLiteralProblems =\n (context: ValueContext) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly Problem[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isStringLiteral(node) || isNumericLiteral(node)),\n Arr.filter((node) => isValuePosition(node)),\n Arr.filter(\n (node) =>\n !pipe(\n excluded,\n Arr.some((outer) => contains(outer)(node)),\n ),\n ),\n Arr.map((node) => ownedLiteralProblem(context)(node)),\n ),\n );\n\nexport { ownedLiteralProblems, siteVerdict };\nexport type { SiteVerdict, ValueContext };\n","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport { isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node, VariableDeclaration } from \"./compiler.ts\";\nimport { flowsIn } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesUnder } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contains, descendantsOf } from \"./syntax.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\ninterface ProjectAnalysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst isVisibleTo =\n (project: Project) =>\n (owner: Owner): boolean =>\n pipe(\n project.sourceFiles,\n Arr.some((sourceFile) => sourceFile.fileName === owner.file),\n ) ||\n Option.exists(\n owner.packageName,\n (name) =>\n Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name),\n );\n\nconst ownerDeclarationsIn = (\n project: Project,\n owners: readonly Owner[],\n): readonly VariableDeclaration[] => {\n const keys = new Set(\n pipe(\n owners,\n Arr.map((owner) => owner.key),\n ),\n );\n return pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isVariableDeclaration(node)),\n Arr.filter((declaration) => Option.exists(ownerKeyOf(declaration), (key) => keys.has(key))),\n ),\n ),\n );\n};\n\nconst isInside =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nconst sitesOutside =\n (checker: Checker) =>\n (project: Project, outers: readonly Node[]): readonly ValueSite[] =>\n pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)),\n Arr.filter((site) => !isInside(outers)(site.node)),\n );\n\nconst nodesOf = (sites: readonly ValueSite[]): readonly Node[] =>\n pipe(\n sites,\n Arr.map((site) => site.node),\n );\n\nconst analyzeProject =\n (owners: readonly Owner[]) =>\n (project: Project): ProjectAnalysis => {\n const { checker } = project;\n const ownerDeclarations = ownerDeclarationsIn(project, owners);\n const sites = sitesOutside(checker)(project, ownerDeclarations);\n const flowContext = { checker, program: project.program, sites };\n const context = {\n checker,\n owners: pipe(\n owners,\n Arr.filter((owner) => isVisibleTo(project)(owner)),\n ),\n vocabularies: project.library.vocabularies,\n flows: pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => flowsIn(flowContext)(sourceFile)),\n ),\n };\n const verdicts = pipe(\n sites,\n Arr.map((site) => siteVerdict(context)(site)),\n );\n const excluded = [...ownerDeclarations, ...nodesOf(sites)];\n const shapeContext = { checker, program: project.program, shapes: project.library.shapes };\n return {\n problems: [\n ...pipe(\n verdicts,\n Arr.flatMap((found) => found.problems),\n ),\n ...pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => [\n ...ownedLiteralProblems(context)(sourceFile, excluded),\n ...shapeProblemsIn(shapeContext)(sourceFile),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n };\n };\n\nexport { analyzeProject };\nexport type { ProjectAnalysis };\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\nimport { formatValues, valueKey } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\ninterface UnownedSite {\n readonly scope: PackageScope;\n readonly file: string;\n readonly start: number;\n readonly line: number;\n readonly column: number;\n readonly values: readonly Value[];\n}\n\nconst DUPLICATE_THRESHOLD = 1;\n\nconst unownedSiteOf =\n (scope: PackageScope) =>\n (site: ValueSite): UnownedSite => ({\n scope,\n file: site.node.getSourceFile().fileName,\n start: site.node.getStart(),\n line: lineOf(site.node),\n column: columnOf(site.node),\n values: site.values,\n });\n\nconst canDerive = (left: UnownedSite, right: UnownedSite): boolean =>\n left.scope.name === right.scope.name ||\n left.scope.dependencies.includes(right.scope.name) ||\n right.scope.dependencies.includes(left.scope.name);\n\nconst siteKey = (site: UnownedSite): string => `${site.file}#${String(site.start)}`;\n\nconst valueSetKey = (site: UnownedSite): string => {\n const keys = pipe(\n site.values,\n Arr.map((value) => valueKey(value)),\n );\n return pipe(Arr.sort(keys, Order.String), Arr.join(\"\\0\"));\n};\n\nconst duplicateProblems =\n (relative: (file: string) => string) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const unique = Arr.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));\n const groups = Rec.values(Arr.groupBy(unique, (site) => valueSetKey(site)));\n return pipe(\n groups,\n Arr.filter((group) => group.length > DUPLICATE_THRESHOLD),\n Arr.flatMap((group) =>\n pipe(\n group,\n Arr.flatMap((site): readonly Problem[] => {\n const related = pipe(\n group,\n Arr.filter((other) => other !== site && canDerive(site, other)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(related)) {\n return [];\n }\n const others = pipe(\n related,\n Arr.map((other) => `${relative(other.file)}:${String(other.line)}`),\n Arr.join(\", \"),\n );\n return [\n {\n file: site.file,\n line: site.line,\n column: site.column,\n rule: \"duplicate-value-set\",\n message: `The values ${formatValues(site.values)} are also declared at ${others}. Register one owner with /** @${OWNER_TAG} <concept> */ and derive the others from it.`,\n },\n ];\n }),\n ),\n ),\n );\n };\n\nexport { duplicateProblems, unownedSiteOf };\nexport type { PackageScope, UnownedSite };\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"./compiler.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* pipe(\n pids,\n Effect.forEach((pid) => residentBytesOf(pid)),\n );\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nconst annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n\nexport { annotateResources };\n","import { Array as Arr, Effect, Function as Fn, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { API, getLeadingCommentRanges } from \"./compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"./compiler.ts\";\nimport {\n MANIFEST_FILE,\n NODE_MODULES,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"./dependencies.ts\";\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\ninterface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst listConfigFiles = (\n directory: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const visible = pipe(\n names,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name) && !SKIPPED_DIRECTORIES.has(name)),\n Arr.map((name) => files.join(directory, name)),\n );\n const nested = yield* Fn.pipe(\n visible,\n Effect.forEach((entryPath) =>\n files.isDirectory(entryPath).pipe(\n Effect.flatMap(\n Option.match({\n onNone: (): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.succeed([]),\n onSome: (\n directoryEntry,\n ): Effect.Effect<readonly string[], never, RepositoryFiles> => {\n if (directoryEntry) {\n return listConfigFiles(entryPath);\n }\n return Effect.succeed(\n Arr.filter([entryPath], () => files.basename(entryPath) === CONFIG_FILE),\n );\n },\n }),\n ),\n ),\n ),\n );\n return Arr.sort(nested.flat(), Order.String);\n });\n\nconst parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\ninterface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\ninterface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nconst typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nconst withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nconst mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* pipe(\n fileNames,\n Effect.forEach((fileName) => files.readFile(fileName)),\n );\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n\nexport { listConfigFiles, mentions, typeScriptCompiler, withProject };\nexport type { Compiler, Project, Workspace };\n","import { Effect, Option, Array as Arr, pipe } from \"effect\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope, UnownedSite } from \"./duplicates.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.ts\";\nimport { sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { listConfigFiles, mentions, typeScriptCompiler, withProject } from \"./project.ts\";\nimport type { Project, Workspace } from \"./project.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst scanOwners = Effect.fn(\"scanOwners\")(function* scanOwners(\n workspace: Workspace,\n configPaths: readonly string[],\n) {\n const ownerConfigs = yield* pipe(\n configPaths,\n Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)),\n );\n const scans = yield* pipe(\n ownerConfigs,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))),\n ),\n );\n return combineOwnerScans(Arr.getSomes(scans));\n});\n\nconst scopeOf = (project: Project, configPath: string): PackageScope => ({\n name: Option.getOrElse(project.packageName, () => configPath),\n dependencies: project.workspaceDependencies,\n});\n\ninterface Analysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly UnownedSite[];\n}\n\nconst analyzeProjects =\n (workspace: Workspace, owners: readonly Owner[]) =>\n (configPaths: readonly string[]): Effect.Effect<readonly Analysis[], never, RepositoryFiles> =>\n pipe(\n configPaths,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject(owners)(project);\n const scope = scopeOf(project, configPath);\n return {\n problems: analysis.problems,\n unowned: pipe(analysis.unowned, Arr.map(unownedSiteOf(scope))),\n };\n }).pipe(Effect.withSpan(\"analyzeProject\")),\n ),\n ),\n Effect.map(Arr.getSomes),\n );\n\nconst checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(root: string) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const generated = yield* files.generatedFiles(root);\n const workspace: Workspace = { compiler, root, generated };\n const configPaths = yield* listConfigFiles(root);\n const ownerScan: OwnerScan = yield* scanOwners(workspace, configPaths);\n const analyses = yield* analyzeProjects(workspace, ownerScan.owners)(configPaths);\n const relative = (file: string): string => files.relative(root, file);\n const unowned = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.unowned),\n );\n return sortProblems([\n ...ownerScan.problems,\n ...pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.problems),\n ),\n ...duplicateProblems(relative)(unowned),\n ]);\n}, Effect.scoped);\n\nexport { checkRepository };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nconst positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n\nexport { positionOf };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst HIDDEN =\n /[\\u00AD\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u2069\\uFEFF]|[\\u{E0000}-\\u{E007F}]/gu;\n\nconst NUL = \"\\0\";\nconst START = 0;\nconst HEX = 16;\nconst CODE_POINT_WIDTH = 4;\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"hidden-unicode\";\n\nconst hexOf = (character: string): string =>\n pipe(\n Str.codePointAt(START)(character),\n Option.getOrElse(() => START),\n (code) => code.toString(HEX),\n Str.toUpperCase,\n Str.padStart(CODE_POINT_WIDTH, \"0\"),\n );\n\nconst problemOf =\n (file: string, source: string) =>\n (found: RegExpMatchArray): Problem => {\n const hex = hexOf(found[START]);\n return {\n file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\\\u${hex}.`,\n };\n };\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n if (Str.includes(NUL)(source)) {\n return [];\n }\n return pipe(Arr.fromIterable(Str.matchAll(HIDDEN)(source)), Arr.map(problemOf(file, source)));\n};\n\n/** @internal */\nconst checkHiddenUnicode = Effect.fn(\"checkHiddenUnicode\")(function* checkHiddenUnicode(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(file, source),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\nexport { checkHiddenUnicode };\n","import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nclass ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nconst writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n\nexport { ProblemsFound, writeStdout };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst describeVersions = (versions: readonly string[]): string =>\n Option.getOrElse(\n Option.liftPredicate(Arr.join(versions, \",\"), (joined) => joined !== \"\"),\n () => \"-\",\n );\n\nconst describeChanges = (report: OverrideReport): string => {\n const versions = pipe(\n report.changes,\n Arr.map(\n (change) =>\n `${change.name} ${describeVersions(change.before)} -> ${describeVersions(change.after)}`,\n ),\n );\n const contexts = Arr.filter([\"the peer contexts\"], () => report.peerContextsChanged);\n return Arr.join([...versions, ...contexts], \"; \");\n};\n\ninterface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nconst overrideProblem =\n (located: LocatedOverride) =>\n (report: OverrideReport): Option.Option<Problem> => {\n const at = { file: located.file, line: located.line, column: located.column };\n if (report.verdict === \"unused\") {\n return Option.some({\n ...at,\n rule: \"unused-override\",\n message: `Every package resolves the same way without the override ${report.key}. Remove it.`,\n });\n }\n if (report.verdict === \"verify\") {\n return Option.some({\n ...at,\n rule: \"removable-override\",\n message: `Removing the override ${report.key} changes ${describeChanges(report)} without new peer issues or advisories. Remove it and run verify.`,\n });\n }\n return Option.none();\n };\n\nexport { overrideProblem };\nexport type { LocatedOverride };\n","import { Array as Arr, Option, Order, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { LineCounter, isMap, isScalar, parseAllDocuments, parseDocument } from \"yaml\";\n\nconst VerdictSchema = Schema.Literals([\"unused\", \"keep\", \"verify\"]);\n\nconst PackageChangeSchema = Schema.Struct({\n name: Schema.String,\n before: Schema.Array(Schema.String),\n after: Schema.Array(Schema.String),\n});\n\nconst OverrideReportSchema = Schema.Struct({\n key: Schema.String,\n verdict: VerdictSchema,\n changes: Schema.Array(PackageChangeSchema),\n peerContextsChanged: Schema.Boolean,\n peerIssues: Schema.Array(Schema.String),\n advisories: Schema.Array(Schema.String),\n});\n\ntype OverrideReport = typeof OverrideReportSchema.Type;\ntype PackageChange = typeof PackageChangeSchema.Type;\n\nconst PeerParentSchema = Schema.Struct({ name: Schema.String, version: Schema.String });\n\nconst PeerIssueSchema = Schema.Struct({\n parents: Schema.Array(PeerParentSchema),\n wantedRange: Schema.String,\n foundVersion: Schema.optionalKey(Schema.String),\n});\n\ntype PeerIssue = typeof PeerIssueSchema.Type;\n\nconst ProjectPeerIssuesSchema = Schema.Struct({\n bad: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n missing: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n conflicts: Schema.Array(Schema.String),\n});\n\ntype ProjectPeerIssues = typeof ProjectPeerIssuesSchema.Type;\n\nconst PeerIssuesLog = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.Literal(\"pnpm:peer-dependency-issues\"),\n issuesByProjects: Schema.Record(Schema.String, ProjectPeerIssuesSchema),\n }),\n);\n\ninterface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\ninterface Resolution extends Findings {\n readonly versions: Readonly<Record<string, readonly string[]>>;\n readonly snapshots: readonly string[];\n}\n\nconst AdvisorySchema = Schema.Struct({\n module_name: Schema.String,\n github_advisory_id: Schema.String,\n});\n\nconst AuditReport = Schema.fromJsonString(\n Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }),\n);\n\nconst SCOPE_PREFIX = \"@\";\nconst NAME_START = 0;\nconst SEPARATOR_LENGTH = 1;\nconst PEER_CONTEXT_START = \"(\";\n\nconst sorted = (values: readonly string[]): readonly string[] =>\n Arr.sort(Arr.dedupe(values), Order.String);\n\nconst describeIssue =\n (project: string, kind: string) =>\n ([peer, issues]: readonly [string, readonly PeerIssue[]]): readonly string[] =>\n pipe(\n issues,\n Arr.map((issue) => {\n const dependent = Option.match(Arr.last(issue.parents), {\n onNone: () => project,\n onSome: (parent) => `${parent.name}@${parent.version}`,\n });\n const found = Option.getOrElse(Option.fromUndefinedOr(issue.foundVersion), () => \"none\");\n return `${project}: ${kind} peer ${peer}@${issue.wantedRange} of ${dependent}, found ${found}`;\n }),\n );\n\nconst issuesOfProject = ([project, issues]: readonly [\n string,\n ProjectPeerIssues,\n]): readonly string[] => [\n ...pipe(Rec.toEntries(issues.bad), Arr.flatMap(describeIssue(project, \"unmet\"))),\n ...pipe(Rec.toEntries(issues.missing), Arr.flatMap(describeIssue(project, \"missing\"))),\n ...pipe(\n issues.conflicts,\n Arr.map((peer) => `${project}: conflicting peer ${peer}`),\n ),\n];\n\nconst peerIssuesIn = (output: string): readonly string[] =>\n sorted(\n pipe(\n Str.split(output, \"\\n\"),\n Arr.map((line) => Schema.decodeOption(PeerIssuesLog)(line)),\n Arr.getSomes,\n Arr.flatMap((log) => pipe(Rec.toEntries(log.issuesByProjects), Arr.flatMap(issuesOfProject))),\n ),\n );\n\nconst advisoriesIn = (output: string): readonly string[] =>\n Option.match(Schema.decodeOption(AuditReport)(output), {\n onNone: () => [],\n onSome: (report) =>\n sorted(\n pipe(\n Rec.values(report.advisories),\n Arr.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`),\n ),\n ),\n });\n\nconst separatorOf = (key: string): Option.Option<number> => {\n if (!Str.startsWith(SCOPE_PREFIX)(key)) {\n return Str.indexOf(SCOPE_PREFIX)(key);\n }\n return pipe(\n Str.slice(SEPARATOR_LENGTH)(key),\n Str.indexOf(SCOPE_PREFIX),\n Option.map((index) => index + SEPARATOR_LENGTH),\n );\n};\n\nconst withoutPeerContext = (version: string): string =>\n Option.match(Str.indexOf(PEER_CONTEXT_START)(version), {\n onNone: () => version,\n onSome: (start) => Str.slice(NAME_START, start)(version),\n });\n\nconst packageOf = (key: string): Option.Option<readonly [string, string]> =>\n Option.map(separatorOf(key), (separator) => [\n Str.slice(NAME_START, separator)(key),\n withoutPeerContext(Str.slice(separator + SEPARATOR_LENGTH)(key)),\n ]);\n\nconst keysOf = (node: unknown): readonly string[] => {\n if (!isMap(node)) {\n return [];\n }\n return pipe(\n node.items,\n Arr.flatMap((pair): readonly string[] => {\n if (isScalar(pair.key)) {\n return [String(pair.key.value)];\n }\n return [];\n }),\n );\n};\n\nconst lockfileKeysOf = (lockfile: string, section: string): readonly string[] =>\n pipe(\n parseAllDocuments(lockfile),\n Arr.flatMap((document) => keysOf(document.get(section))),\n );\n\nconst resolutionOf =\n (findings: Findings) =>\n (lockfile: string): Resolution => {\n const snapshots = lockfileKeysOf(lockfile, \"snapshots\");\n const packages = Arr.getSomes(\n pipe(\n [...lockfileKeysOf(lockfile, \"packages\"), ...snapshots],\n Arr.map((key) => packageOf(key)),\n ),\n );\n const versions = Rec.map(\n Arr.groupBy(packages, ([name]) => name),\n (entries) =>\n sorted(\n pipe(\n entries,\n Arr.map(([, version]) => version),\n ),\n ),\n );\n return { ...findings, versions, snapshots: sorted(snapshots) };\n };\n\nconst changesBetween = (baseline: Resolution, candidate: Resolution): readonly PackageChange[] =>\n pipe(\n sorted([...Rec.keys(baseline.versions), ...Rec.keys(candidate.versions)]),\n Arr.map((name) => ({\n name,\n before: baseline.versions[name] ?? [],\n after: candidate.versions[name] ?? [],\n })),\n Arr.filter((change) => Arr.join(change.before, \" \") !== Arr.join(change.after, \" \")),\n );\n\nconst growsThePackageSet = (change: PackageChange): boolean =>\n change.after.length > change.before.length;\n\nconst needsTheOverride = (\n found: Pick<OverrideReport, \"changes\" | \"peerIssues\" | \"advisories\">,\n): boolean =>\n pipe(\n found.changes,\n Arr.some((change) => growsThePackageSet(change)),\n ) ||\n Arr.isReadonlyArrayNonEmpty(found.peerIssues) ||\n Arr.isReadonlyArrayNonEmpty(found.advisories);\n\nconst judge =\n (baseline: Resolution) =>\n (key: string, candidate: Resolution): OverrideReport => {\n const changes = changesBetween(baseline, candidate);\n const peerIssues = Arr.difference(candidate.peerIssues, baseline.peerIssues);\n const advisories = Arr.difference(candidate.advisories, baseline.advisories);\n const peerContextsChanged =\n Arr.join(baseline.snapshots, \" \") !== Arr.join(candidate.snapshots, \" \");\n const found = { key, changes, peerContextsChanged, peerIssues, advisories };\n if (!Arr.isReadonlyArrayNonEmpty(changes) && !peerContextsChanged) {\n return { ...found, verdict: \"unused\" };\n }\n if (needsTheOverride(found)) {\n return { ...found, verdict: \"keep\" };\n }\n return { ...found, verdict: \"verify\" };\n };\n\nconst OVERRIDES = \"overrides\";\nconst BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\n\ninterface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst overrideKeysOf = (manifest: string): readonly OverrideKey[] => {\n const lineCounter = new LineCounter();\n const overrides = parseDocument(manifest, { lineCounter }).get(OVERRIDES);\n if (!isMap(overrides)) {\n return [];\n }\n return pipe(\n overrides.items,\n Arr.flatMap((pair): readonly OverrideKey[] => {\n const { key } = pair;\n if (!isScalar(key)) {\n return [];\n }\n return pipe(\n Option.fromNullishOr(key.range),\n Option.map(([start]) => {\n const { line, col } = lineCounter.linePos(start);\n return { key: String(key.value), line, column: col };\n }),\n Option.toArray,\n );\n }),\n );\n};\n\nconst withoutOverride =\n (key: string) =>\n (manifest: string): string => {\n const document = parseDocument(manifest);\n document.deleteIn([OVERRIDES, key]);\n return document.toString();\n };\n\nconst withBaselineProbe = (manifest: string): string => {\n const document = parseDocument(manifest);\n document.setIn([OVERRIDES, BASELINE_PROBE], REMOVED_DEPENDENCY);\n return document.toString();\n};\n\nexport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n};\nexport type { Findings, OverrideKey, OverrideReport, Resolution };\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { overrideProblem } from \"./override-findings.ts\";\nimport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n} from \"./override-resolution.ts\";\nimport type { OverrideKey } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst RESOLUTION_FILES = [\"*package.json\", WORKSPACE_FILE, LOCKFILE, \".npmrc\", \"patches/*\"];\nconst RESOLUTION_CONCURRENCY = 4;\nconst SUCCEEDED = 0;\n\nconst taggedError = Schema.TaggedError;\n\nclass OverrideResolutionFailed extends taggedError<\n OverrideResolutionFailed,\n { readonly brand: unique symbol }\n>()(\"OverrideResolutionFailed\", { override: Schema.String, output: Schema.String }) {}\n\ntype CandidateFailure = OverrideResolutionFailed | PlatformError.PlatformError;\ntype CandidateServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\ninterface Workspace {\n readonly root: string;\n readonly files: readonly string[];\n readonly manifest: string;\n}\n\nconst textOf = <Failure>(\n stream: Stream.Stream<Uint8Array, Failure>,\n): Effect.Effect<string, Failure> => stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst resolveIn = Effect.fn(\"resolveIn\")(function* resolveIn(directory: string, override: string) {\n const handle = yield* ChildProcess.make(\n \"vp\",\n [\"install\", \"--lockfile-only\", \"--ignore-scripts\", \"--\", \"--reporter=ndjson\"],\n { cwd: directory, env: { CI: \"true\" }, extendEnv: true, stdin: \"ignore\" },\n );\n const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n if (Number(status) !== SUCCEEDED) {\n return yield* OverrideResolutionFailed.make({ override, output });\n }\n return output;\n});\n\nconst auditIn = Effect.fn(\"auditIn\")(function* auditIn(directory: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"pm\", \"audit\", \"--json\"], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n return advisoriesIn(report);\n}, Effect.scoped);\n\nconst trackedResolutionFiles = Effect.fn(\"trackedResolutionFiles\")(function* trackedFiles(\n root: string,\n) {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", \"--\", ...RESOLUTION_FILES], {\n cwd: root,\n });\n const listed = yield* textOf(handle.stdout);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n}, Effect.scoped);\n\nconst copyFiles = Effect.fn(\"copyFiles\")(function* copyFiles(\n workspace: Workspace,\n directory: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const copyOne = (file: string): Effect.Effect<void, PlatformError.PlatformError> => {\n const target = path.join(directory, file);\n const copy = fs.copyFile(path.join(workspace.root, file), target);\n return fs.makeDirectory(path.dirname(target), { recursive: true }).pipe(Effect.andThen(copy));\n };\n yield* Effect.forEach(workspace.files, copyOne, { discard: true });\n});\n\nconst resolutionWith = Effect.fn(\"resolutionWith\")(function* resolutionWith(\n workspace: Workspace,\n override: string,\n manifest: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-overrides-\" });\n yield* copyFiles(workspace, directory);\n yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE), manifest);\n const output = yield* resolveIn(directory, override);\n const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE));\n yield* Effect.annotateCurrentSpan({ \"msch.override\": override });\n const advisories = yield* auditIn(directory);\n return resolutionOf({ peerIssues: peerIssuesIn(output), advisories })(lockfile);\n}, Effect.scoped);\n\nconst problemsFor = Effect.fn(\"problemsFor\")(function* problemsFor(\n root: string,\n manifest: string,\n keys: readonly OverrideKey[],\n) {\n const path = yield* Path.Path;\n const files = yield* trackedResolutionFiles(root);\n const workspace: Workspace = { root, files, manifest };\n const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));\n const judgeAgainstBaseline = judge(baseline);\n const file = path.join(root, WORKSPACE_FILE);\n const problemOf = (\n located: OverrideKey,\n ): Effect.Effect<Option.Option<Problem>, CandidateFailure, CandidateServices> =>\n resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(\n Effect.map((candidate) =>\n overrideProblem({ ...located, file })(judgeAgainstBaseline(located.key, candidate)),\n ),\n );\n const problems = yield* Effect.forEach(keys, problemOf, {\n concurrency: RESOLUTION_CONCURRENCY,\n });\n return Arr.getSomes(problems);\n});\n\n/** @internal */\nconst checkOverrides = Effect.fn(\"checkOverrides\")(function* checkOverrides(root: string) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE)).pipe(Effect.option);\n const keys = Option.match(manifest, { onNone: () => [], onSome: overrideKeysOf });\n if (Option.isNone(manifest) || !Arr.isReadonlyArrayNonEmpty(keys)) {\n return [];\n }\n return yield* problemsFor(root, manifest.value, keys);\n});\n\nexport { checkOverrides };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst PYTHON_FILE =\n /(?:\\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\\/)(?:pyproject\\.toml|uv\\.lock|uv\\.toml|poetry\\.lock|Pipfile|Pipfile\\.lock|setup\\.cfg|tox\\.ini|pytest\\.ini|\\.python-version|requirements[^/]*\\.txt))$/u;\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:Dockerfile[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])python[\\d.]*[ \\t]+(?:[-\"'$./]|\\S+\\.py\\b)/gu,\n /(?<![\\w./@-])pip3?[ \\t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\\b/gu,\n /(?<![\\w./@-])pipx[ \\t]+(?:run|install|inject|upgrade)\\b/gu,\n /(?<![\\w./@-])uvx[ \\t]+[^\\s=:,;)|&]/gu,\n /(?<![\\w./@-])uv[ \\t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\\b/gu,\n /(?<![\\w./@-])poetry[ \\t]+(?:run|install|add|lock|build|publish|shell|export)\\b/gu,\n /(?:\\bcommand[\"']?\\s*[:=]\\s*|(?:\\bspawn\\w*|\\bexec\\w*|\\bexeca|Command::new|ChildProcess\\.make|\\$)\\(\\s*)[\"'`](?:python[\\d.]*|pip3?|pipx|uvx?|poetry)[\"'`]/gu,\n /\\buses:\\s*[\"']?(?:actions\\/setup-python|astral-sh\\/setup-uv|astral-sh\\/ruff-action|pypa\\/[\\w.-]+|snok\\/install-poetry|abatilo\\/actions-poetry|conda-incubator\\/setup-miniconda|mamba-org\\/setup-micromamba|pdm-project\\/setup-pdm)\\b/gu,\n];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^\"'\\s=]+)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst READ_CONCURRENCY = 64;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"python-file\";\nconst COMMAND_RULE: RuleName = \"python-command\";\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst fileProblem = ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: FILE_RULE,\n message: \"Python is not used in this repository. Replace this file with TypeScript or Rust.\",\n});\n\nconst patternsFor = (name: string): readonly RegExp[] => {\n if (TOOL_VERSIONS.test(name)) {\n return [...COMMAND_PATTERNS, ...TOOL_PATTERNS];\n }\n return COMMAND_PATTERNS;\n};\n\nconst commandProblem =\n ({ file }: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: COMMAND_RULE,\n message: `Python is not used in this repository. Remove \\`${Str.trim(found[WHOLE_MATCH])}\\` and do the work in TypeScript or Rust.`,\n });\n\nconst commandProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n patternsFor(entry.name),\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map(commandProblem(entry, source)),\n );\n\nconst isPython = ({ name }: Listed): boolean => PYTHON_FILE.test(name);\n\nconst isScanned = (entry: Listed): boolean =>\n !isPython(entry) && SCANNED_FILE.test(entry.name) && !LOCKFILE.test(entry.name);\n\n/** @internal */\nconst checkPython = Effect.fn(\"checkPython\")(function* checkPython(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const listed = pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n const problemsIn = (entry: Listed): Effect.Effect<readonly Problem[]> =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => commandProblems(entry, source),\n }),\n ),\n );\n const scanned = yield* Effect.forEach(pipe(listed, Arr.filter(isScanned)), problemsIn, {\n concurrency: READ_CONCURRENCY,\n });\n const present = yield* Effect.filter(pipe(listed, Arr.filter(isPython)), ({ file }) =>\n files.exists(file),\n );\n return [...pipe(present, Arr.map(fileProblem)), ...Arr.flatten(scanned)];\n});\n\nexport { checkPython };\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServicesLayer } from \"@effect/platform-node/NodeServices\";\nimport { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { ProblemsFound } from \"./output.ts\";\nimport { nodeRepositoryFiles } from \"./repository-files.ts\";\nimport type { RepositoryFiles } from \"./repository-files.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\nconst tracing = Otlp.layerFromConfig({ resource: { serviceName: \"msch\" } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n);\n\nconst runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n >,\n): void => {\n const services = Layer.mergeAll(nodeRepositoryFiles, tracing).pipe(\n Layer.provideMerge(nodeServicesLayer),\n );\n const main = Layer.build(services).pipe(\n Effect.flatMap((context) =>\n Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context),\n ),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n\n/** @internal */\nexport { runCli };\n","#!/usr/bin/env node\nimport { Effect, Schema, Stdio, Array as Arr, pipe } from \"effect\";\n\nimport { checkRepository } from \"./check.ts\";\nimport { JSON_FLAG } from \"./cli-contract.ts\";\nimport { checkHiddenUnicode } from \"./hidden-unicode.ts\";\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\nimport { checkOverrides } from \"./overrides.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { checkPython } from \"./python.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { runCli } from \"./runtime.ts\";\n\nconst NO_PROBLEMS = 0;\n\nconst reportText = (\n root: string,\n problems: readonly Problem[],\n): Effect.Effect<void, ProblemsFound, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n if (problems.length > NO_PROBLEMS) {\n return yield* ProblemsFound.make({ count: problems.length });\n }\n return yield* Effect.void;\n });\n\nconst msch = Effect.gen(function* msch() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const root = files.resolve(\".\");\n const found = yield* Effect.all(\n [checkRepository(root), checkOverrides(root), checkHiddenUnicode(root), checkPython(root)],\n {\n concurrency: \"unbounded\",\n },\n );\n const problems = sortProblems(Arr.flatten(found));\n if (args.includes(JSON_FLAG)) {\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);\n return yield* writeStdout(text);\n }\n return yield* reportText(root, problems);\n});\n\nrunCli(msch);\n"],"mappings":";;;;;;;;;;AA8BA,MAAM,kCAA2C,IAAI,IAAI;CACvD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,eAAe,gBACnB,gBAAgB,IAAI,YAAY,IAAI;AAEtC,MAAM,gBAAgB,gBACpB,OAAO,cAAc,aAAa,WAAW,CAAC,CAAC,KAC7C,OAAO,SAAS,cAAc,OAAO,gBAAgB,UAAU,IAAI,CAAC,CACtE;AAEF,MAAM,gBACH,aACA,eAAuD;CACtD,MAAM,OAAO,WAA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,IAAI,SAAS,SAAS,aACpB,OAAO,OAAO,cAAc,KAAK,EAAE,OAAO,SAAS,OAAO,CAAC;CAE7D,OAAO,OAAO,OAAO;AACvB,CAAC;AAqBH,OAnBa,OAAO,IAAI,UAAU,OAAO;CACvC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,OAAO,MAAM,QAAQ,GAAG;CAC9B,MAAM,QAAQ,OAAO,OAAO,IAC1B;EAAC,gBAAgB,IAAI;EAAG,eAAe,IAAI;EAAG,mBAAmB,IAAI;EAAG,YAAY,IAAI;CAAC,GACzF,EACE,aAAa,YACf,CACF;CACA,MAAM,WAAW,aAAaA,MAAI,QAAQ,KAAK,CAAC;CAChD,IAAI,KAAK,SAAA,QAAkB,GAAG;EAC5B,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ;EACpF,OAAO,OAAO,YAAY,IAAI;CAChC;CACA,OAAO,OAAO,WAAW,MAAM,QAAQ;AACzC,CAEO,CAAI"}
1
+ {"version":3,"file":"cli.mjs","names":["Arr","Arr","Fn","SCOPE_PREFIX","packageOf","Str","Arr","Arr","Str","Arr","Arr","Arr","Arr","Arr","Arr","Arr","Rec","Num","Str","Arr","Arr","Str","Fn","MANIFEST_FILE","Arr","START","FIRST_COLUMN","Str","Arr","READ_CONCURRENCY","RULE","Str","Arr","READ_CONCURRENCY","Str","Arr","Arr","Arr","Rec","Str","LOCKFILE","taggedError","Str","Arr","Str","Arr","Arr","nodeServicesLayer","Arr"],"sources":["../src/slots.ts","../src/values.ts","../src/flows.ts","../src/owners.ts","../src/library.ts","../src/derivation.ts","../src/shapes.ts","../src/sites.ts","../src/value-checks.ts","../src/analysis.ts","../src/duplicates.ts","../src/telemetry.ts","../src/project.ts","../src/check.ts","../src/text-position.ts","../src/hidden-unicode.ts","../src/nested-docs.ts","../src/override-findings.ts","../src/override-resolution.ts","../src/overrides.ts","../src/python.ts","../src/all-checks.ts","../src/output.ts","../src/runtime.ts","../src/cli.ts"],"sourcesContent":["import { Array as Arr, Option } from \"effect\";\n\nimport {\n isCallExpression,\n isNewExpression,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\ntype AnnotatedDeclaration =\n | ParameterDeclaration\n | VariableDeclaration\n | PropertySignatureDeclaration\n | PropertyDeclaration;\n\nconst ANNOTATED_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.Parameter,\n SyntaxKind.VariableDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotated = (declaration: Declaration): declaration is AnnotatedDeclaration =>\n ANNOTATED_KINDS.has(declaration.kind);\n\nconst annotationOf = (declaration: Declaration): Option.Option<TypeNode> =>\n Option.liftPredicate(declaration, isAnnotated).pipe(\n Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)),\n );\n\nconst argumentSlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const call = expression.parent;\n if (!isCallExpression(call) && !isNewExpression(call)) {\n return Option.none();\n }\n const { arguments: listed } = call;\n const callArguments: readonly Expression[] = listed ?? [];\n const index = callArguments.indexOf(expression);\n return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.filter(isSignatureDeclaration),\n Option.flatMap((declaration) => Arr.get(declaration.parameters, index)),\n );\n };\n\nconst propertySlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const assignment = expression.parent;\n if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(\n Option.flatMap((objectType) =>\n Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText())),\n ),\n Option.flatMap((property) => Arr.head(declarationsOf(property))),\n );\n };\n\nconst variableSlot = (expression: Expression): Option.Option<Declaration> => {\n const declaration = expression.parent;\n if (!isVariableDeclaration(declaration) || declaration.initializer !== expression) {\n return Option.none();\n }\n return Option.some(declaration);\n};\n\nconst slotOf =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> =>\n argumentSlot(checker)(expression).pipe(\n Option.orElse(() => propertySlot(checker)(expression)),\n Option.orElse(() => variableSlot(expression)),\n );\n\nconst contextSymbolsOf =\n (checker: Checker) =>\n (expression: Expression): readonly TypeSymbol[] => {\n const alias = Option.fromUndefinedOr(checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) => Option.fromUndefinedOr(contextual.getAliasSymbol())),\n );\n if (Option.isSome(alias)) {\n return [alias.value];\n }\n return slotOf(checker)(expression).pipe(\n Option.flatMap(annotationOf),\n Option.map((annotation) => referencedSymbols(checker)(annotation)),\n Option.getOrElse(() => []),\n );\n };\n\nexport { annotationOf, contextSymbolsOf, slotOf };\n","import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\ntype Value = string | number;\n\ninterface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nconst valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nconst literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nconst literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nconst schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nconst finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nconst vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nconst isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nconst sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nconst formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n\nexport {\n finiteValuesOf,\n formatValues,\n isSubsetOf,\n literalUnionOf,\n literalValuesOf,\n sameValues,\n schemaTypeOf,\n valueKey,\n vocabularyOf,\n};\nexport type { Value, Vocabulary };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getNameOfDeclaration,\n isClassDeclaration,\n isElementAccessExpression,\n isIdentifier,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isSignatureDeclaration,\n isTypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n ClassDeclaration,\n Declaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SignatureDeclaration,\n SourceFile,\n TypeSymbol,\n Type,\n} from \"./compiler.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n NODE_MODULES_SEGMENT,\n symbolAt,\n} from \"./syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\ninterface FlowContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly sites: readonly ValueSite[];\n}\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\nconst MODULE_PREFIX = /^\".*?\"\\./u;\n\nconst packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nconst externalDeclarationOf =\n (context: FlowContext) =>\n (symbol: TypeSymbol): Option.Option<Declaration> =>\n Arr.findFirst(declarationsOf(symbol), (declaration) =>\n isExternalDeclaration(context.program)(declaration),\n );\n\nconst aliasTarget =\n (context: FlowContext) =>\n (type: Type): Option.Option<string> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) =>\n externalDeclarationOf(context)(alias).pipe(\n Option.map(\n (declaration) =>\n `${Str.replace(MODULE_PREFIX, \"\")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`,\n ),\n ),\n ),\n );\n\nconst isNamedContainer = (\n node: Node,\n): node is SignatureDeclaration | InterfaceDeclaration | ClassDeclaration =>\n isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);\n\nconst slotTarget =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<string> =>\n slotOf(context.checker)(expression).pipe(\n Option.filter((slot) => isExternalDeclaration(context.program)(slot)),\n Option.filter((slot) =>\n Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot))),\n ),\n Option.map((slot) => {\n const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(\n Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))),\n Option.map((name) => ` of ${name.getText()}`),\n Option.getOrElse(() => \"\"),\n );\n const name = Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(\n Option.map((found) => found.getText()),\n Option.getOrElse(() => \"value\"),\n );\n return `${name}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;\n }),\n );\n\nconst libraryTargetOf =\n (context: FlowContext) =>\n (expression: Expression, contextual: Type): Option.Option<string> =>\n aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));\n\nconst siteWithin =\n (context: FlowContext) =>\n (node: Node): Option.Option<ValueSite> =>\n Arr.findFirst(context.sites, (site) => contains(node)(site.node));\n\nconst aliasSite =\n (context: FlowContext) =>\n (type: Type): Option.Option<ValueSite> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) => Arr.findFirst(declarationsOf(alias), isTypeAliasDeclaration)),\n Option.flatMap(siteWithin(context)),\n );\n\nconst annotationSite =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n symbolAt(context.checker)(expression).pipe(\n Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)),\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.flatMap(annotationOf),\n Option.flatMap((annotation) =>\n siteWithin(context)(annotation).pipe(\n Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))),\n ),\n ),\n );\n\nconst siteBehind =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(\n Option.orElse(() => annotationSite(context)(expression)),\n );\n\nconst isFlowSource = (node: Node): node is Expression =>\n isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst flowOf =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<Flow> =>\n Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) =>\n Option.all([\n vocabularyOf(context.checker)(contextual),\n libraryTargetOf(context)(expression, contextual),\n ]),\n ),\n Option.flatMap(([vocabulary, target]) =>\n siteBehind(context)(expression).pipe(\n Option.filter((site) => isSubsetOf(site.values, vocabulary.values)),\n Option.map((site) => ({ site, target })),\n ),\n ),\n );\n\nconst flowsIn =\n (context: FlowContext) =>\n (sourceFile: SourceFile): readonly Flow[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isFlowSource(node)),\n Arr.map((node) => flowOf(context)(node)),\n ),\n );\n\nexport { flowsIn };\nexport type { Flow, FlowContext };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"./compiler.ts\";\nimport { problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"./syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface Owner {\n readonly conceptId: string;\n readonly key: string;\n readonly name: string;\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly packageName: Option.Option<string>;\n readonly values: readonly Value[];\n}\n\ninterface OwnerScan {\n readonly owners: readonly Owner[];\n readonly problems: readonly Problem[];\n}\n\ninterface Annotated {\n readonly node: Node;\n readonly conceptId: string;\n}\n\nconst OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nconst ownerKeyOf = (declaration: Declaration): Option.Option<string> => {\n if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) {\n return Option.none();\n }\n return Option.some(`${declaration.getSourceFile().fileName}#${declaration.name.text}`);\n};\n\nconst annotationsOf = (node: Node): readonly Annotated[] =>\n pipe(\n getJSDocTags(node),\n Arr.filter((tag) => tag.tagName.text === OWNER_TAG),\n Arr.map((tag) => ({ node, conceptId: Str.trim(getTextOfJSDocComment(tag.comment) ?? \"\") })),\n );\n\nconst ANNOTATABLE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.VariableDeclaration,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyAssignment,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotatable = (node: Node): boolean => ANNOTATABLE_KINDS.has(node.kind);\n\nconst isConstList = (list: VariableDeclarationList): boolean =>\n Option.fromUndefinedOr(list.getFirstToken()).pipe(\n Option.exists((token) => token.kind === SyntaxKind.ConstKeyword),\n );\n\nconst isModuleStatementList = (list: VariableDeclarationList): boolean =>\n isVariableStatement(list.parent) && isSourceFile(list.parent.parent);\n\nconst isModuleConstList = (node: Node): node is VariableDeclarationList =>\n isVariableDeclarationList(node) && isModuleStatementList(node) && isConstList(node);\n\nconst isModuleConst = (node: Node): node is VariableDeclaration =>\n isVariableDeclaration(node) && isIdentifier(node.name) && isModuleConstList(node.parent);\n\nconst objectValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalValuesOf(\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => checker.getTypeOfSymbol(property)),\n ),\n );\n\nconst ownerValuesOf =\n (checker: Checker) =>\n (declaration: VariableDeclaration): Option.Option<readonly Value[]> => {\n const type = checker.getTypeAtLocation(declaration.name);\n return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));\n };\n\nconst annotationProblem = (message: string): ((node: Node) => Problem) =>\n problemAt({ rule: \"owner-annotation\", message });\n\nconst scanned = (owners: readonly Owner[], problems: readonly Problem[]): OwnerScan => ({\n owners,\n problems,\n});\n\nconst ownerOf =\n (project: Project) =>\n (annotated: Annotated): OwnerScan => {\n const { node, conceptId } = annotated;\n if (!isModuleConst(node)) {\n return scanned(\n [],\n [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)],\n );\n }\n if (conceptId === \"\") {\n return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);\n }\n const values = ownerValuesOf(project.checker)(node);\n return Option.match(Option.all([values, ownerKeyOf(node)]), {\n onNone: () =>\n scanned(\n [],\n [annotationProblem(`The owner of ${conceptId} holds no finite value set.`)(node)],\n ),\n onSome: ([ownedValues, key]) =>\n scanned(\n [\n {\n conceptId,\n key,\n name: node.name.getText(),\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n packageName: project.packageName,\n values: ownedValues,\n },\n ],\n [],\n ),\n });\n };\n\nconst annotatedIn = (sourceFile: SourceFile): readonly Annotated[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isAnnotatable(node)),\n Arr.flatMap((node) => annotationsOf(node)),\n );\n\nconst ownerProblem =\n (message: string) =>\n (owner: Owner): Problem => ({\n file: owner.file,\n line: owner.line,\n column: owner.column,\n rule: \"owner-annotation\",\n message,\n });\n\nconst conflictProblems = (owners: readonly Owner[]): readonly Problem[] =>\n pipe(\n owners,\n Arr.flatMap((owner, index) => {\n const earlier = Arr.take(owners, index);\n const sameConcept = pipe(\n earlier,\n Arr.filter((other) => other.conceptId === owner.conceptId),\n );\n const sameSet = pipe(\n earlier,\n Arr.filter(\n (other) => other.conceptId !== owner.conceptId && sameValues(other.values, owner.values),\n ),\n );\n return [\n ...pipe(\n Arr.take(sameConcept, FIRST_OWNER_COUNT),\n Arr.map(() =>\n ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner),\n ),\n ),\n ...pipe(\n Arr.take(sameSet, FIRST_OWNER_COUNT),\n Arr.map((other) =>\n ownerProblem(\n `The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`,\n )(owner),\n ),\n ),\n ];\n }),\n );\n\nconst ownersIn = (project: Project): OwnerScan => {\n const results = pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n annotatedIn(sourceFile),\n Arr.map((annotated) => ownerOf(project)(annotated)),\n ),\n ),\n );\n return scanned(\n pipe(\n results,\n Arr.flatMap((result) => result.owners),\n ),\n pipe(\n results,\n Arr.flatMap((result) => result.problems),\n ),\n );\n};\n\nconst combineOwnerScans = (scans: readonly OwnerScan[]): OwnerScan => {\n const owners = Arr.dedupeWith(\n pipe(\n scans,\n Arr.flatMap((scan) => scan.owners),\n ),\n (left, right) => left.key === right.key,\n );\n const problems = [\n ...pipe(\n scans,\n Arr.flatMap((scan) => scan.problems),\n ),\n ...conflictProblems(owners),\n ];\n return { owners, problems };\n};\n\nexport { OWNER_TAG, combineOwnerScans, ownerKeyOf, ownersIn };\nexport type { Owner, OwnerScan };\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { InternalSymbolName, isModuleDeclaration, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Declaration, Node, SyntaxKind, TypeSymbol, Type } from \"./compiler.ts\";\nimport type { DependencyEntry } from \"./dependencies.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"./syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"./values.ts\";\nimport type { Vocabulary } from \"./values.ts\";\n\ninterface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\ninterface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\ninterface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\ninterface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\ninterface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nconst isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nconst describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nconst locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nconst declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\ninterface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\ninterface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nconst libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nconst libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n Effect.forEach(indexEntry(cache)(checker)),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n\nexport {\n declarationKey,\n describeLibraryType,\n isObjectType,\n libraryCache,\n libraryIndex,\n locationOf,\n};\nexport type {\n CachedIndex,\n DeclarationLocation,\n LibraryCache,\n LibraryIndex,\n LibraryShape,\n LibraryType,\n LibraryVocabulary,\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { isSatisfiesExpression, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node } from \"./compiler.ts\";\nimport { declarationKey, locationOf } from \"./library.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\nconst contractOf = (node: Node): readonly Node[] => {\n const { parent } = node;\n if (isSatisfiesExpression(parent) && parent.expression === node) {\n return [parent.type];\n }\n if (isVariableDeclaration(parent) && parent.initializer === node) {\n return Option.toArray(Option.fromUndefinedOr(parent.type));\n }\n return [];\n};\n\nconst derivedDeclarationsOf =\n (checker: Checker) =>\n (node: Node): ReadonlySet<string> => {\n const scopes = Arr.prepend(contractOf(node), node);\n return new Set(\n pipe(\n scopes,\n Arr.flatMap((scope) => referencedSymbols(checker)(scope)),\n Arr.flatMap((symbol) => declarationsOf(symbol)),\n Arr.map((declaration) => declarationKey(locationOf(declaration))),\n ),\n );\n };\n\nexport { derivedDeclarationsOf };\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\nimport { declarationKey, describeLibraryType, isObjectType } from \"./library.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"./library.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { descendantsOf, isGenericDeclaration, isTypeDeclaration } from \"./syntax.ts\";\nimport { schemaTypeOf } from \"./values.ts\";\n\ninterface ShapeContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface ShapeSite {\n readonly node: Node;\n readonly type: Type;\n}\n\ninterface ShapeMatch {\n readonly shape: LibraryShape;\n readonly extra: number;\n}\n\nconst MINIMUM_SHAPE_PROPERTIES = 3;\nconst EXACT = 0;\n\nconst augmentsAModule = (node: Node): boolean => {\n const block = node.parent;\n return (\n isModuleBlock(block) && isModuleDeclaration(block.parent) && isStringLiteral(block.parent.name)\n );\n};\n\nconst isPlainInterface = (node: Node): node is InterfaceDeclaration =>\n isInterfaceDeclaration(node) && !isGenericDeclaration(node) && !augmentsAModule(node);\n\nconst isPlainTypeLiteral = (node: Node): node is TypeAliasDeclaration =>\n isTypeAliasDeclaration(node) && !isGenericDeclaration(node) && isTypeLiteralNode(node.type);\n\nconst isDeclaredShape = (node: Node): node is InterfaceDeclaration | TypeAliasDeclaration =>\n isPlainInterface(node) || isPlainTypeLiteral(node);\n\nconst declaredShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> =>\n Option.liftPredicate(node, isDeclaredShape).pipe(\n Option.map((declaration) => checker.getTypeAtLocation(declaration.name)),\n );\n\nconst schemaShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> => {\n if (!isCallExpression(node)) {\n return Option.none();\n }\n const { arguments: callArguments } = node;\n if (\n !pipe(\n callArguments,\n Arr.some((argument) => isObjectLiteralExpression(argument)),\n )\n ) {\n return Option.none();\n }\n return schemaTypeOf(checker)(checker.getTypeAtLocation(node)).pipe(\n Option.filter((type) => isObjectType(checker)(type)),\n );\n };\n\nconst shapeSitesIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly ShapeSite[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.map((node) =>\n declaredShapeOf(checker)(node).pipe(\n Option.orElse(() => schemaShapeOf(checker)(node)),\n Option.map((type) => ({ node, type })),\n ),\n ),\n ),\n );\n\ninterface LocalProperty {\n readonly name: string;\n readonly type: Type;\n}\n\ninterface OpenTypeIds {\n readonly any: number;\n readonly unknown: number;\n}\n\nconst openTypeIdsOf = (checker: Checker): OpenTypeIds => ({\n any: checker.getAnyType().id,\n unknown: checker.getUnknownType().id,\n});\n\ntype IndexedDeclaration =\n | TypeAliasDeclaration\n | InterfaceDeclaration\n | EnumDeclaration\n | VariableDeclaration;\n\nconst isIndexedDeclaration = (node: Node): node is IndexedDeclaration =>\n isTypeDeclaration(node) || isVariableDeclaration(node);\n\nconst declarationAt =\n (program: Program) =>\n (location: DeclarationLocation): Option.Option<IndexedDeclaration> =>\n Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(\n Option.flatMap((sourceFile) =>\n Arr.findFirst(\n descendantsOf(sourceFile),\n (node): node is IndexedDeclaration =>\n node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node),\n ),\n ),\n );\n\nconst symbolOfDeclaration =\n (checker: Checker) =>\n (declaration: IndexedDeclaration): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(declaration.name));\n\nconst shapeTypeOf =\n (context: ShapeContext) =>\n (shape: LibraryShape): Option.Option<Type> => {\n const { checker } = context;\n return declarationAt(context.program)(shape.declaration).pipe(\n Option.flatMap((declaration) =>\n symbolOfDeclaration(checker)(declaration).pipe(\n Option.flatMap((symbol) => {\n if (shape.form === \"declared\") {\n return Option.some(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return schemaTypeOf(checker)(checker.getTypeOfSymbolAtLocation(symbol, declaration));\n }),\n ),\n ),\n );\n };\n\nconst hasEveryName =\n (locals: readonly LocalProperty[]) =>\n (shape: LibraryShape): boolean => {\n const names: ReadonlySet<string> = new Set(shape.propertyNames);\n return pipe(\n locals,\n Arr.every((local) => names.has(local.name)),\n );\n };\n\nconst sameProperty =\n (checker: Checker, open: OpenTypeIds) =>\n (localType: Type, library: TypeSymbol): boolean => {\n const libraryType = checker.getTypeOfSymbol(library);\n return (\n libraryType.id !== open.any &&\n libraryType.id !== open.unknown &&\n checker.isTypeAssignableTo(localType, libraryType) &&\n checker.isTypeAssignableTo(libraryType, localType)\n );\n };\n\nconst matchOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (locals: readonly LocalProperty[], shape: LibraryShape): Option.Option<ShapeMatch> => {\n const { checker } = context;\n const matches = shapeTypeOf(context)(shape).pipe(\n Option.exists((shapeType) =>\n pipe(\n locals,\n Arr.every((local) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(\n Option.exists((library) => sameProperty(checker, open)(local.type, library)),\n ),\n ),\n ),\n ),\n );\n if (!matches) {\n return Option.none();\n }\n return Option.some({ shape, extra: shape.propertyNames.length - locals.length });\n };\n\nconst localPropertiesOf =\n (checker: Checker) =>\n (symbols: readonly TypeSymbol[]): readonly LocalProperty[] =>\n pipe(\n Arr.zip(symbols, checker.getTypeOfSymbol(symbols)),\n Arr.map(([symbol, type]) => ({ name: symbol.name, type })),\n );\n\nconst matchOrder = Order.mapInput(Order.Number, (match: ShapeMatch) => match.extra);\n\nconst shapeProblem = (site: ShapeSite, matches: readonly ShapeMatch[]): Problem => {\n const shown = pipe(\n Arr.take(matches, CANDIDATE_LIMIT),\n Arr.map((match) => describeLibraryType(match.shape)),\n Arr.join(\", \"),\n );\n const advice = Option.match(\n Arr.findFirst(matches, (match) => match.extra === EXACT),\n {\n onNone: () =>\n \"Derive it from the library type, for example with Pick, instead of copying its properties.\",\n onSome: () => \"Use the library type instead of copying it.\",\n },\n );\n return problemAt({ rule: \"library-shape\", message: `This shape copies ${shown}. ${advice}` })(\n site.node,\n );\n};\n\nconst candidatesOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite, locals: readonly LocalProperty[]): readonly ShapeMatch[] => {\n const derived = derivedDeclarationsOf(context.checker)(site.node);\n const named = pipe(context.shapes, Arr.filter(hasEveryName(locals)));\n if (\n pipe(\n named,\n Arr.some((shape) => derived.has(declarationKey(shape.declaration))),\n )\n ) {\n return [];\n }\n const candidates = pipe(\n named,\n Arr.map((shape) => matchOf(context, open)(locals, shape)),\n Arr.getSomes,\n );\n return Arr.sort(candidates, matchOrder);\n };\n\nconst shapeProblemOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite): Option.Option<Problem> => {\n const symbols = context.checker.getPropertiesOfType(site.type);\n if (symbols.length < MINIMUM_SHAPE_PROPERTIES) {\n return Option.none();\n }\n const locals = localPropertiesOf(context.checker)(symbols);\n return Option.liftPredicate(\n candidatesOf(context, open)(site, locals),\n Arr.isReadonlyArrayNonEmpty,\n ).pipe(Option.map((found) => shapeProblem(site, found)));\n };\n\nconst shapeProblemsIn =\n (context: ShapeContext) =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const sites = shapeSitesIn(context.checker)(sourceFile);\n if (!Arr.isReadonlyArrayNonEmpty(sites)) {\n return [];\n }\n const open = openTypeIdsOf(context.checker);\n return Arr.getSomes(\n pipe(\n sites,\n Arr.map((site) => shapeProblemOf(context, open)(site)),\n ),\n );\n };\n\nexport { shapeProblemsIn };\nexport type { ShapeContext };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isElementAccessExpression,\n isEnumDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n isSpreadElement,\n isTypeReferenceNode,\n isUnionTypeNode,\n} from \"./compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"./compiler.ts\";\nimport {\n childrenOf,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n} from \"./syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface ValueSite {\n readonly node: Node;\n readonly values: readonly Value[];\n readonly sources: readonly TypeSymbol[];\n}\n\nconst namedValuesOf =\n (checker: Checker) =>\n (symbol: TypeSymbol): Option.Option<readonly Value[]> => {\n if (\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isTypeDeclaration(declaration)),\n )\n ) {\n return finiteValuesOf(checker)(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));\n };\n\nconst hasFiniteContext =\n (checker: Checker) =>\n (node: Expression): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst isNamedValue = (element: Expression): boolean => {\n if (isSpreadElement(element)) {\n return isNamedValue(element.expression);\n }\n return (\n isIdentifier(element) ||\n isPropertyAccessExpression(element) ||\n isElementAccessExpression(element)\n );\n};\n\nconst namesEveryElement = (array: ArrayLiteralExpression): boolean =>\n pipe(\n array.elements,\n Arr.every((element) => isNamedValue(element)),\n );\n\nconst expressionValuesOf =\n (checker: Checker) =>\n (node: Expression): Option.Option<readonly Value[]> => {\n if (hasFiniteContext(checker)(node)) {\n return Option.none();\n }\n const type = checker.getTypeAtLocation(node);\n if (isArrayLiteralExpression(node)) {\n return Option.liftPredicate(node, (array) => !namesEveryElement(array)).pipe(\n Option.flatMap(() => finiteValuesOf(checker)(type)),\n );\n }\n return schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf));\n };\n\nconst selectsKeys =\n (checker: Checker) =>\n (node: UnionTypeNode, values: readonly Value[]): boolean => {\n const { parent } = node;\n if (!isTypeReferenceNode(parent)) {\n return false;\n }\n const typeArguments: readonly TypeNode[] = parent.typeArguments ?? [];\n return pipe(\n typeArguments,\n Arr.filter((argument) => argument !== node),\n Arr.some((argument) =>\n isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument))),\n ),\n );\n };\n\nconst unionValuesOf =\n (checker: Checker) =>\n (node: UnionTypeNode): Option.Option<readonly Value[]> =>\n literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(\n Option.filter((values) => !selectsKeys(checker)(node, values)),\n );\n\nconst isExpressionSite = (node: Node): node is ArrayLiteralExpression | CallExpression =>\n isArrayLiteralExpression(node) || isCallExpression(node);\n\nconst expressionSiteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> =>\n Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));\n\nconst siteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> => {\n if (isUnionTypeNode(node)) {\n return unionValuesOf(checker)(node);\n }\n if (isEnumDeclaration(node)) {\n return literalUnionOf(checker.getTypeAtLocation(node.name));\n }\n return expressionSiteValuesOf(checker)(node);\n };\n\nconst derivationScopeOf = (node: Node): Node => {\n if (isTypeReferenceNode(node.parent)) {\n return node.parent;\n }\n return node;\n};\n\nconst sourcesOf =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] =>\n pipe(\n referencedSymbols(checker)(derivationScopeOf(node)),\n Arr.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))),\n );\n\nconst sitesUnder =\n (checker: Checker) =>\n (node: Node): readonly ValueSite[] => {\n const nested = pipe(\n childrenOf(node),\n Arr.flatMap((child) => sitesUnder(checker)(child)),\n );\n if (Arr.isReadonlyArrayNonEmpty(nested)) {\n return nested;\n }\n return siteValuesOf(checker)(node).pipe(\n Option.map((values) => ({ node, values, sources: sourcesOf(checker)(node) })),\n Option.toArray,\n );\n };\n\nexport { sitesUnder };\nexport type { ValueSite };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"./compiler.ts\";\nimport type { Flow } from \"./flows.ts\";\nimport { describeLibraryType } from \"./library.ts\";\nimport type { LibraryVocabulary } from \"./library.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"./syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\ninterface SiteVerdict {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst OWNER_SEARCH_DEPTH = 4;\nconst NOTHING_HIDDEN = 0;\n\nconst directOwners =\n (context: ValueContext) =>\n (symbol: TypeSymbol): readonly Owner[] => {\n const keys = Arr.getSomes(\n pipe(\n declarationsOf(symbol),\n Arr.map((declaration) => ownerKeyOf(declaration)),\n ),\n );\n return pipe(\n context.owners,\n Arr.filter((owner) => keys.includes(owner.key)),\n );\n };\n\nconst isFollowable = (declaration: Declaration): boolean =>\n !declaration.getSourceFile().isDeclarationFile &&\n (isTypeAliasDeclaration(declaration) || isVariableDeclaration(declaration));\n\nconst ownersBehind =\n (context: ValueContext) =>\n (symbol: TypeSymbol, ancestors: readonly TypeSymbol[]): readonly Owner[] => {\n const direct = directOwners(context)(symbol);\n if (Arr.isReadonlyArrayNonEmpty(direct) || ancestors.length >= OWNER_SEARCH_DEPTH) {\n return direct;\n }\n const visited = [...ancestors, symbol];\n return uniqueByReference(\n pipe(\n declarationsOf(symbol),\n Arr.filter((declaration) => isFollowable(declaration)),\n Arr.flatMap((declaration) => referencedSymbols(context.checker)(declaration)),\n Arr.filter((referenced) => !visited.includes(referenced)),\n Arr.flatMap((referenced) => ownersBehind(context)(referenced, visited)),\n ),\n );\n };\n\nconst describeOwners = (owners: readonly Owner[]): string =>\n pipe(\n owners,\n Arr.map((owner) => `${owner.conceptId} (${owner.name})`),\n Arr.join(\", \"),\n );\n\nconst verdict = (problems: readonly Problem[], unowned: readonly ValueSite[]): SiteVerdict => ({\n problems,\n unowned,\n});\n\nconst derivedVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = uniqueByReference(\n pipe(\n site.sources,\n Arr.flatMap((source) => ownersBehind(context)(source, [])),\n ),\n );\n const held = pipe(\n owners,\n Arr.flatMap((owner) => owner.values),\n );\n const added = pipe(\n site.values,\n Arr.filter((value) => !isSubsetOf([value], held)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(owners) || !Arr.isReadonlyArrayNonEmpty(added)) {\n return verdict([], []);\n }\n const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;\n return verdict([problemAt({ rule: \"owner-extension\", message })(site.node)], []);\n };\n\nconst libraryCandidates =\n (context: ValueContext) =>\n (site: ValueSite): readonly string[] => {\n const flowing = Arr.dedupe(\n pipe(\n context.flows,\n Arr.filter((flow) => flow.site.node === site.node),\n Arr.map((flow) => flow.target),\n ),\n );\n if (Arr.isReadonlyArrayNonEmpty(flowing)) {\n return flowing;\n }\n if (\n !pipe(\n site.values,\n Arr.some((value) => typeof value === \"string\"),\n )\n ) {\n return [];\n }\n const imported = importedModulesOf(site.node.getSourceFile());\n return Arr.dedupe(\n pipe(\n context.vocabularies,\n Arr.filter((library) => imported.includes(library.specifier)),\n Arr.filter((library) => isSubsetOf(site.values, library.vocabulary.values)),\n Arr.map((library) => describeLibraryType(library)),\n ),\n );\n };\n\nconst listCandidates = (candidates: readonly string[]): string => {\n const shown = pipe(Arr.take(candidates, CANDIDATE_LIMIT), Arr.join(\", \"));\n const hidden = candidates.length - CANDIDATE_LIMIT;\n if (hidden > NOTHING_HIDDEN) {\n return `${shown} and ${String(hidden)} more`;\n }\n return shown;\n};\n\nconst originalVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = pipe(\n context.owners,\n Arr.filter((owner) => isSubsetOf(site.values, owner.values)),\n );\n if (Arr.isReadonlyArrayNonEmpty(owners)) {\n const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;\n return verdict([problemAt({ rule: \"owner-value-set\", message })(site.node)], []);\n }\n const candidates = libraryCandidates(context)(site);\n if (Arr.isReadonlyArrayNonEmpty(candidates)) {\n const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;\n return verdict([problemAt({ rule: \"library-value-set\", message })(site.node)], []);\n }\n return verdict([], [site]);\n };\n\nconst siteVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n if (Arr.isReadonlyArrayNonEmpty(site.sources)) {\n return derivedVerdict(context)(site);\n }\n return originalVerdict(context)(site);\n };\n\nconst VALUE_PARENT_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ReturnStatement,\n SyntaxKind.ArrayLiteralExpression,\n SyntaxKind.ConditionalExpression,\n SyntaxKind.ParenthesizedExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.JsxExpression,\n]);\n\nconst isCallArgument = (node: Node, parent: Node): boolean =>\n (isCallExpression(parent) || isNewExpression(parent)) && parent.expression !== node;\n\nconst isInitializer = (node: Node, parent: Node): boolean =>\n (isPropertyAssignment(parent) || isVariableDeclaration(parent)) && parent.initializer === node;\n\nconst isRightOperand = (node: Node, parent: Node): boolean =>\n isBinaryExpression(parent) && parent.right === node;\n\nconst VALUE_SLOTS = [isCallArgument, isInitializer, isRightOperand];\n\nconst isValuePosition = (node: Node): boolean => {\n const { parent } = node;\n return (\n VALUE_PARENT_KINDS.has(parent.kind) ||\n pipe(\n VALUE_SLOTS,\n Arr.some((isSlot) => isSlot(node, parent)),\n )\n );\n};\n\nconst ownedLiteralProblem =\n (context: ValueContext) =>\n (literal: StringLiteral | NumericLiteral): Option.Option<Problem> =>\n Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(\n Option.filter((contextual) =>\n vocabularyOf(context.checker)(contextual).pipe(\n Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues),\n ),\n ),\n Option.map(() =>\n pipe(\n contextSymbolsOf(context.checker)(literal),\n Arr.flatMap((symbol) => ownersBehind(context)(symbol, [])),\n uniqueByReference,\n Arr.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Arr.map(String)))),\n ),\n ),\n Option.filter((owners) => Arr.isReadonlyArrayNonEmpty(owners)),\n Option.map((owners) =>\n problemAt({\n rule: \"owned-literal\",\n message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`,\n })(literal),\n ),\n );\n\nconst ownedLiteralProblems =\n (context: ValueContext) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly Problem[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isStringLiteral(node) || isNumericLiteral(node)),\n Arr.filter((node) => isValuePosition(node)),\n Arr.filter(\n (node) =>\n !pipe(\n excluded,\n Arr.some((outer) => contains(outer)(node)),\n ),\n ),\n Arr.map((node) => ownedLiteralProblem(context)(node)),\n ),\n );\n\nexport { ownedLiteralProblems, siteVerdict };\nexport type { SiteVerdict, ValueContext };\n","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport { isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node, VariableDeclaration } from \"./compiler.ts\";\nimport { flowsIn } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesUnder } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contains, descendantsOf } from \"./syntax.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\ninterface ProjectAnalysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst isVisibleTo =\n (project: Project) =>\n (owner: Owner): boolean =>\n pipe(\n project.sourceFiles,\n Arr.some((sourceFile) => sourceFile.fileName === owner.file),\n ) ||\n Option.exists(\n owner.packageName,\n (name) =>\n Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name),\n );\n\nconst ownerDeclarationsIn = (\n project: Project,\n owners: readonly Owner[],\n): readonly VariableDeclaration[] => {\n const keys = new Set(\n pipe(\n owners,\n Arr.map((owner) => owner.key),\n ),\n );\n return pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isVariableDeclaration(node)),\n Arr.filter((declaration) => Option.exists(ownerKeyOf(declaration), (key) => keys.has(key))),\n ),\n ),\n );\n};\n\nconst isInside =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nconst sitesOutside =\n (checker: Checker) =>\n (project: Project, outers: readonly Node[]): readonly ValueSite[] =>\n pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)),\n Arr.filter((site) => !isInside(outers)(site.node)),\n );\n\nconst nodesOf = (sites: readonly ValueSite[]): readonly Node[] =>\n pipe(\n sites,\n Arr.map((site) => site.node),\n );\n\nconst analyzeProject =\n (owners: readonly Owner[]) =>\n (project: Project): ProjectAnalysis => {\n const { checker } = project;\n const ownerDeclarations = ownerDeclarationsIn(project, owners);\n const sites = sitesOutside(checker)(project, ownerDeclarations);\n const flowContext = { checker, program: project.program, sites };\n const context = {\n checker,\n owners: pipe(\n owners,\n Arr.filter((owner) => isVisibleTo(project)(owner)),\n ),\n vocabularies: project.library.vocabularies,\n flows: pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => flowsIn(flowContext)(sourceFile)),\n ),\n };\n const verdicts = pipe(\n sites,\n Arr.map((site) => siteVerdict(context)(site)),\n );\n const excluded = [...ownerDeclarations, ...nodesOf(sites)];\n const shapeContext = { checker, program: project.program, shapes: project.library.shapes };\n return {\n problems: [\n ...pipe(\n verdicts,\n Arr.flatMap((found) => found.problems),\n ),\n ...pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => [\n ...ownedLiteralProblems(context)(sourceFile, excluded),\n ...shapeProblemsIn(shapeContext)(sourceFile),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n };\n };\n\nexport { analyzeProject };\nexport type { ProjectAnalysis };\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\nimport { formatValues, valueKey } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\ninterface UnownedSite {\n readonly scope: PackageScope;\n readonly file: string;\n readonly start: number;\n readonly line: number;\n readonly column: number;\n readonly values: readonly Value[];\n}\n\nconst DUPLICATE_THRESHOLD = 1;\n\nconst unownedSiteOf =\n (scope: PackageScope) =>\n (site: ValueSite): UnownedSite => ({\n scope,\n file: site.node.getSourceFile().fileName,\n start: site.node.getStart(),\n line: lineOf(site.node),\n column: columnOf(site.node),\n values: site.values,\n });\n\nconst canDerive = (left: UnownedSite, right: UnownedSite): boolean =>\n left.scope.name === right.scope.name ||\n left.scope.dependencies.includes(right.scope.name) ||\n right.scope.dependencies.includes(left.scope.name);\n\nconst siteKey = (site: UnownedSite): string => `${site.file}#${String(site.start)}`;\n\nconst valueSetKey = (site: UnownedSite): string => {\n const keys = pipe(\n site.values,\n Arr.map((value) => valueKey(value)),\n );\n return pipe(Arr.sort(keys, Order.String), Arr.join(\"\\0\"));\n};\n\nconst duplicateProblems =\n (relative: (file: string) => string) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const unique = Arr.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));\n const groups = Rec.values(Arr.groupBy(unique, (site) => valueSetKey(site)));\n return pipe(\n groups,\n Arr.filter((group) => group.length > DUPLICATE_THRESHOLD),\n Arr.flatMap((group) =>\n pipe(\n group,\n Arr.flatMap((site): readonly Problem[] => {\n const related = pipe(\n group,\n Arr.filter((other) => other !== site && canDerive(site, other)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(related)) {\n return [];\n }\n const others = pipe(\n related,\n Arr.map((other) => `${relative(other.file)}:${String(other.line)}`),\n Arr.join(\", \"),\n );\n return [\n {\n file: site.file,\n line: site.line,\n column: site.column,\n rule: \"duplicate-value-set\",\n message: `The values ${formatValues(site.values)} are also declared at ${others}. Register one owner with /** @${OWNER_TAG} <concept> */ and derive the others from it.`,\n },\n ];\n }),\n ),\n ),\n );\n };\n\nexport { duplicateProblems, unownedSiteOf };\nexport type { PackageScope, UnownedSite };\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"./compiler.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* pipe(\n pids,\n Effect.forEach((pid) => residentBytesOf(pid)),\n );\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nconst annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n\nexport { annotateResources };\n","import { Array as Arr, Effect, Function as Fn, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { API, getLeadingCommentRanges } from \"./compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"./compiler.ts\";\nimport {\n MANIFEST_FILE,\n NODE_MODULES,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"./dependencies.ts\";\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\ninterface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst listConfigFiles = (\n directory: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const visible = pipe(\n names,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name) && !SKIPPED_DIRECTORIES.has(name)),\n Arr.map((name) => files.join(directory, name)),\n );\n const nested = yield* Fn.pipe(\n visible,\n Effect.forEach((entryPath) =>\n files.isDirectory(entryPath).pipe(\n Effect.flatMap(\n Option.match({\n onNone: (): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.succeed([]),\n onSome: (\n directoryEntry,\n ): Effect.Effect<readonly string[], never, RepositoryFiles> => {\n if (directoryEntry) {\n return listConfigFiles(entryPath);\n }\n return Effect.succeed(\n Arr.filter([entryPath], () => files.basename(entryPath) === CONFIG_FILE),\n );\n },\n }),\n ),\n ),\n ),\n );\n return Arr.sort(nested.flat(), Order.String);\n });\n\nconst parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\ninterface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\ninterface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nconst typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nconst withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nconst mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* pipe(\n fileNames,\n Effect.forEach((fileName) => files.readFile(fileName)),\n );\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n\nexport { listConfigFiles, mentions, typeScriptCompiler, withProject };\nexport type { Compiler, Project, Workspace };\n","import { Effect, Option, Array as Arr, pipe } from \"effect\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope, UnownedSite } from \"./duplicates.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.ts\";\nimport { sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { listConfigFiles, mentions, typeScriptCompiler, withProject } from \"./project.ts\";\nimport type { Project, Workspace } from \"./project.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst scanOwners = Effect.fn(\"scanOwners\")(function* scanOwners(\n workspace: Workspace,\n configPaths: readonly string[],\n) {\n const ownerConfigs = yield* pipe(\n configPaths,\n Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)),\n );\n const scans = yield* pipe(\n ownerConfigs,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))),\n ),\n );\n return combineOwnerScans(Arr.getSomes(scans));\n});\n\nconst scopeOf = (project: Project, configPath: string): PackageScope => ({\n name: Option.getOrElse(project.packageName, () => configPath),\n dependencies: project.workspaceDependencies,\n});\n\ninterface Analysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly UnownedSite[];\n}\n\nconst analyzeProjects =\n (workspace: Workspace, owners: readonly Owner[]) =>\n (configPaths: readonly string[]): Effect.Effect<readonly Analysis[], never, RepositoryFiles> =>\n pipe(\n configPaths,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject(owners)(project);\n const scope = scopeOf(project, configPath);\n return {\n problems: analysis.problems,\n unowned: pipe(analysis.unowned, Arr.map(unownedSiteOf(scope))),\n };\n }).pipe(Effect.withSpan(\"analyzeProject\")),\n ),\n ),\n Effect.map(Arr.getSomes),\n );\n\nconst checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(root: string) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const generated = yield* files.generatedFiles(root);\n const workspace: Workspace = { compiler, root, generated };\n const configPaths = yield* listConfigFiles(root);\n const ownerScan: OwnerScan = yield* scanOwners(workspace, configPaths);\n const analyses = yield* analyzeProjects(workspace, ownerScan.owners)(configPaths);\n const relative = (file: string): string => files.relative(root, file);\n const unowned = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.unowned),\n );\n return sortProblems([\n ...ownerScan.problems,\n ...pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.problems),\n ),\n ...duplicateProblems(relative)(unowned),\n ]);\n}, Effect.scoped);\n\nexport { checkRepository };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nconst positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n\nexport { positionOf };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst HIDDEN =\n /[\\u00AD\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u2069\\uFEFF]|[\\u{E0000}-\\u{E007F}]/gu;\n\nconst NUL = \"\\0\";\nconst START = 0;\nconst HEX = 16;\nconst CODE_POINT_WIDTH = 4;\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"hidden-unicode\";\n\nconst hexOf = (character: string): string =>\n pipe(\n Str.codePointAt(START)(character),\n Option.getOrElse(() => START),\n (code) => code.toString(HEX),\n Str.toUpperCase,\n Str.padStart(CODE_POINT_WIDTH, \"0\"),\n );\n\nconst problemOf =\n (file: string, source: string) =>\n (found: RegExpMatchArray): Problem => {\n const hex = hexOf(found[START]);\n return {\n file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\\\u${hex}.`,\n };\n };\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n if (Str.includes(NUL)(source)) {\n return [];\n }\n return pipe(Arr.fromIterable(Str.matchAll(HIDDEN)(source)), Arr.map(problemOf(file, source)));\n};\n\n/** @internal */\nconst checkHiddenUnicode = Effect.fn(\"checkHiddenUnicode\")(function* checkHiddenUnicode(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(file, source),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\nexport { checkHiddenUnicode };\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst SEPARATOR = \"/\";\nconst MANIFEST_FILE = \"package.json\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst README = /^README(?:\\.[^/]+)?$/iu;\n\nconst PublishedManifest = Schema.fromJsonString(\n Schema.Struct({ private: Schema.optional(Schema.Boolean) }),\n);\n\nconst isNested = (name: string): boolean => Str.includes(SEPARATOR)(name);\n\nconst isPublishedPackage = Effect.fn(\"isPublishedPackage\")(function* isPublishedPackage(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(Schema.decodeUnknownOption(PublishedManifest)),\n Option.exists((manifest) => manifest.private !== true),\n );\n});\n\nconst problemFor = (file: string, message: string): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message,\n});\n\nconst AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.\";\nconst README_MESSAGE =\n \"belongs only at the repository root or next to the package.json of a published package. Move its content into the root README.md and delete this file.\";\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const base = files.basename(name);\n const file = files.join(root, name);\n if (AGENT_DOCS.test(base)) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (!README.test(base)) {\n return Option.none<Problem>();\n }\n if (yield* isPublishedPackage(root, files.dirname(name))) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n});\n\n/** @internal */\nconst checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\nexport { checkNestedDocs };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst describeVersions = (versions: readonly string[]): string =>\n Option.getOrElse(\n Option.liftPredicate(Arr.join(versions, \",\"), (joined) => joined !== \"\"),\n () => \"-\",\n );\n\nconst describeChanges = (report: OverrideReport): string => {\n const versions = pipe(\n report.changes,\n Arr.map(\n (change) =>\n `${change.name} ${describeVersions(change.before)} -> ${describeVersions(change.after)}`,\n ),\n );\n const contexts = Arr.filter([\"the peer contexts\"], () => report.peerContextsChanged);\n return Arr.join([...versions, ...contexts], \"; \");\n};\n\ninterface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nconst overrideProblem =\n (located: LocatedOverride) =>\n (report: OverrideReport): Option.Option<Problem> => {\n const at = { file: located.file, line: located.line, column: located.column };\n if (report.verdict === \"unused\") {\n return Option.some({\n ...at,\n rule: \"unused-override\",\n message: `Every package resolves the same way without the override ${report.key}. Remove it.`,\n });\n }\n if (report.verdict === \"verify\") {\n return Option.some({\n ...at,\n rule: \"removable-override\",\n message: `Removing the override ${report.key} changes ${describeChanges(report)} without new peer issues or advisories. Remove it and run verify.`,\n });\n }\n return Option.none();\n };\n\nexport { overrideProblem };\nexport type { LocatedOverride };\n","import { Array as Arr, Option, Order, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { LineCounter, isMap, isScalar, parseAllDocuments, parseDocument } from \"yaml\";\n\nconst VerdictSchema = Schema.Literals([\"unused\", \"keep\", \"verify\"]);\n\nconst PackageChangeSchema = Schema.Struct({\n name: Schema.String,\n before: Schema.Array(Schema.String),\n after: Schema.Array(Schema.String),\n});\n\nconst OverrideReportSchema = Schema.Struct({\n key: Schema.String,\n verdict: VerdictSchema,\n changes: Schema.Array(PackageChangeSchema),\n peerContextsChanged: Schema.Boolean,\n peerIssues: Schema.Array(Schema.String),\n advisories: Schema.Array(Schema.String),\n});\n\ntype OverrideReport = typeof OverrideReportSchema.Type;\ntype PackageChange = typeof PackageChangeSchema.Type;\n\nconst PeerParentSchema = Schema.Struct({ name: Schema.String, version: Schema.String });\n\nconst PeerIssueSchema = Schema.Struct({\n parents: Schema.Array(PeerParentSchema),\n wantedRange: Schema.String,\n foundVersion: Schema.optionalKey(Schema.String),\n});\n\ntype PeerIssue = typeof PeerIssueSchema.Type;\n\nconst ProjectPeerIssuesSchema = Schema.Struct({\n bad: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n missing: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n conflicts: Schema.Array(Schema.String),\n});\n\ntype ProjectPeerIssues = typeof ProjectPeerIssuesSchema.Type;\n\nconst PeerIssuesLog = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.Literal(\"pnpm:peer-dependency-issues\"),\n issuesByProjects: Schema.Record(Schema.String, ProjectPeerIssuesSchema),\n }),\n);\n\ninterface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\ninterface Resolution extends Findings {\n readonly versions: Readonly<Record<string, readonly string[]>>;\n readonly snapshots: readonly string[];\n}\n\nconst AdvisorySchema = Schema.Struct({\n module_name: Schema.String,\n github_advisory_id: Schema.String,\n});\n\nconst AuditReport = Schema.fromJsonString(\n Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }),\n);\n\nconst SCOPE_PREFIX = \"@\";\nconst NAME_START = 0;\nconst SEPARATOR_LENGTH = 1;\nconst PEER_CONTEXT_START = \"(\";\n\nconst sorted = (values: readonly string[]): readonly string[] =>\n Arr.sort(Arr.dedupe(values), Order.String);\n\nconst describeIssue =\n (project: string, kind: string) =>\n ([peer, issues]: readonly [string, readonly PeerIssue[]]): readonly string[] =>\n pipe(\n issues,\n Arr.map((issue) => {\n const dependent = Option.match(Arr.last(issue.parents), {\n onNone: () => project,\n onSome: (parent) => `${parent.name}@${parent.version}`,\n });\n const found = Option.getOrElse(Option.fromUndefinedOr(issue.foundVersion), () => \"none\");\n return `${project}: ${kind} peer ${peer}@${issue.wantedRange} of ${dependent}, found ${found}`;\n }),\n );\n\nconst issuesOfProject = ([project, issues]: readonly [\n string,\n ProjectPeerIssues,\n]): readonly string[] => [\n ...pipe(Rec.toEntries(issues.bad), Arr.flatMap(describeIssue(project, \"unmet\"))),\n ...pipe(Rec.toEntries(issues.missing), Arr.flatMap(describeIssue(project, \"missing\"))),\n ...pipe(\n issues.conflicts,\n Arr.map((peer) => `${project}: conflicting peer ${peer}`),\n ),\n];\n\nconst peerIssuesIn = (output: string): readonly string[] =>\n sorted(\n pipe(\n Str.split(output, \"\\n\"),\n Arr.map((line) => Schema.decodeOption(PeerIssuesLog)(line)),\n Arr.getSomes,\n Arr.flatMap((log) => pipe(Rec.toEntries(log.issuesByProjects), Arr.flatMap(issuesOfProject))),\n ),\n );\n\nconst advisoriesIn = (output: string): readonly string[] =>\n Option.match(Schema.decodeOption(AuditReport)(output), {\n onNone: () => [],\n onSome: (report) =>\n sorted(\n pipe(\n Rec.values(report.advisories),\n Arr.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`),\n ),\n ),\n });\n\nconst separatorOf = (key: string): Option.Option<number> => {\n if (!Str.startsWith(SCOPE_PREFIX)(key)) {\n return Str.indexOf(SCOPE_PREFIX)(key);\n }\n return pipe(\n Str.slice(SEPARATOR_LENGTH)(key),\n Str.indexOf(SCOPE_PREFIX),\n Option.map((index) => index + SEPARATOR_LENGTH),\n );\n};\n\nconst withoutPeerContext = (version: string): string =>\n Option.match(Str.indexOf(PEER_CONTEXT_START)(version), {\n onNone: () => version,\n onSome: (start) => Str.slice(NAME_START, start)(version),\n });\n\nconst packageOf = (key: string): Option.Option<readonly [string, string]> =>\n Option.map(separatorOf(key), (separator) => [\n Str.slice(NAME_START, separator)(key),\n withoutPeerContext(Str.slice(separator + SEPARATOR_LENGTH)(key)),\n ]);\n\nconst keysOf = (node: unknown): readonly string[] => {\n if (!isMap(node)) {\n return [];\n }\n return pipe(\n node.items,\n Arr.flatMap((pair): readonly string[] => {\n if (isScalar(pair.key)) {\n return [String(pair.key.value)];\n }\n return [];\n }),\n );\n};\n\nconst lockfileKeysOf = (lockfile: string, section: string): readonly string[] =>\n pipe(\n parseAllDocuments(lockfile),\n Arr.flatMap((document) => keysOf(document.get(section))),\n );\n\nconst resolutionOf =\n (findings: Findings) =>\n (lockfile: string): Resolution => {\n const snapshots = lockfileKeysOf(lockfile, \"snapshots\");\n const packages = Arr.getSomes(\n pipe(\n [...lockfileKeysOf(lockfile, \"packages\"), ...snapshots],\n Arr.map((key) => packageOf(key)),\n ),\n );\n const versions = Rec.map(\n Arr.groupBy(packages, ([name]) => name),\n (entries) =>\n sorted(\n pipe(\n entries,\n Arr.map(([, version]) => version),\n ),\n ),\n );\n return { ...findings, versions, snapshots: sorted(snapshots) };\n };\n\nconst changesBetween = (baseline: Resolution, candidate: Resolution): readonly PackageChange[] =>\n pipe(\n sorted([...Rec.keys(baseline.versions), ...Rec.keys(candidate.versions)]),\n Arr.map((name) => ({\n name,\n before: baseline.versions[name] ?? [],\n after: candidate.versions[name] ?? [],\n })),\n Arr.filter((change) => Arr.join(change.before, \" \") !== Arr.join(change.after, \" \")),\n );\n\nconst growsThePackageSet = (change: PackageChange): boolean =>\n change.after.length > change.before.length;\n\nconst needsTheOverride = (\n found: Pick<OverrideReport, \"changes\" | \"peerIssues\" | \"advisories\">,\n): boolean =>\n pipe(\n found.changes,\n Arr.some((change) => growsThePackageSet(change)),\n ) ||\n Arr.isReadonlyArrayNonEmpty(found.peerIssues) ||\n Arr.isReadonlyArrayNonEmpty(found.advisories);\n\nconst judge =\n (baseline: Resolution) =>\n (key: string, candidate: Resolution): OverrideReport => {\n const changes = changesBetween(baseline, candidate);\n const peerIssues = Arr.difference(candidate.peerIssues, baseline.peerIssues);\n const advisories = Arr.difference(candidate.advisories, baseline.advisories);\n const peerContextsChanged =\n Arr.join(baseline.snapshots, \" \") !== Arr.join(candidate.snapshots, \" \");\n const found = { key, changes, peerContextsChanged, peerIssues, advisories };\n if (!Arr.isReadonlyArrayNonEmpty(changes) && !peerContextsChanged) {\n return { ...found, verdict: \"unused\" };\n }\n if (needsTheOverride(found)) {\n return { ...found, verdict: \"keep\" };\n }\n return { ...found, verdict: \"verify\" };\n };\n\nconst OVERRIDES = \"overrides\";\nconst BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\n\ninterface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst overrideKeysOf = (manifest: string): readonly OverrideKey[] => {\n const lineCounter = new LineCounter();\n const overrides = parseDocument(manifest, { lineCounter }).get(OVERRIDES);\n if (!isMap(overrides)) {\n return [];\n }\n return pipe(\n overrides.items,\n Arr.flatMap((pair): readonly OverrideKey[] => {\n const { key } = pair;\n if (!isScalar(key)) {\n return [];\n }\n return pipe(\n Option.fromNullishOr(key.range),\n Option.map(([start]) => {\n const { line, col } = lineCounter.linePos(start);\n return { key: String(key.value), line, column: col };\n }),\n Option.toArray,\n );\n }),\n );\n};\n\nconst withoutOverride =\n (key: string) =>\n (manifest: string): string => {\n const document = parseDocument(manifest);\n document.deleteIn([OVERRIDES, key]);\n return document.toString();\n };\n\nconst withBaselineProbe = (manifest: string): string => {\n const document = parseDocument(manifest);\n document.setIn([OVERRIDES, BASELINE_PROBE], REMOVED_DEPENDENCY);\n return document.toString();\n};\n\nexport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n};\nexport type { Findings, OverrideKey, OverrideReport, Resolution };\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { overrideProblem } from \"./override-findings.ts\";\nimport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n} from \"./override-resolution.ts\";\nimport type { OverrideKey } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst RESOLUTION_FILES = [\"*package.json\", WORKSPACE_FILE, LOCKFILE, \".npmrc\", \"patches/*\"];\nconst RESOLUTION_CONCURRENCY = 4;\nconst SUCCEEDED = 0;\n\nconst taggedError = Schema.TaggedError;\n\nclass OverrideResolutionFailed extends taggedError<\n OverrideResolutionFailed,\n { readonly brand: unique symbol }\n>()(\"OverrideResolutionFailed\", { override: Schema.String, output: Schema.String }) {}\n\ntype CandidateFailure = OverrideResolutionFailed | PlatformError.PlatformError;\ntype CandidateServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\ninterface Workspace {\n readonly root: string;\n readonly files: readonly string[];\n readonly manifest: string;\n}\n\nconst textOf = <Failure>(\n stream: Stream.Stream<Uint8Array, Failure>,\n): Effect.Effect<string, Failure> => stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst resolveIn = Effect.fn(\"resolveIn\")(function* resolveIn(directory: string, override: string) {\n const handle = yield* ChildProcess.make(\n \"vp\",\n [\"install\", \"--lockfile-only\", \"--ignore-scripts\", \"--\", \"--reporter=ndjson\"],\n { cwd: directory, env: { CI: \"true\" }, extendEnv: true, stdin: \"ignore\" },\n );\n const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n if (Number(status) !== SUCCEEDED) {\n return yield* OverrideResolutionFailed.make({ override, output });\n }\n return output;\n});\n\nconst auditIn = Effect.fn(\"auditIn\")(function* auditIn(directory: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"pm\", \"audit\", \"--json\"], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n return advisoriesIn(report);\n}, Effect.scoped);\n\nconst trackedResolutionFiles = Effect.fn(\"trackedResolutionFiles\")(function* trackedFiles(\n root: string,\n) {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", \"--\", ...RESOLUTION_FILES], {\n cwd: root,\n });\n const listed = yield* textOf(handle.stdout);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n}, Effect.scoped);\n\nconst copyFiles = Effect.fn(\"copyFiles\")(function* copyFiles(\n workspace: Workspace,\n directory: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const copyOne = (file: string): Effect.Effect<void, PlatformError.PlatformError> => {\n const target = path.join(directory, file);\n const copy = fs.copyFile(path.join(workspace.root, file), target);\n return fs.makeDirectory(path.dirname(target), { recursive: true }).pipe(Effect.andThen(copy));\n };\n yield* Effect.forEach(workspace.files, copyOne, { discard: true });\n});\n\nconst resolutionWith = Effect.fn(\"resolutionWith\")(function* resolutionWith(\n workspace: Workspace,\n override: string,\n manifest: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-overrides-\" });\n yield* copyFiles(workspace, directory);\n yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE), manifest);\n const output = yield* resolveIn(directory, override);\n const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE));\n yield* Effect.annotateCurrentSpan({ \"msch.override\": override });\n const advisories = yield* auditIn(directory);\n return resolutionOf({ peerIssues: peerIssuesIn(output), advisories })(lockfile);\n}, Effect.scoped);\n\nconst problemsFor = Effect.fn(\"problemsFor\")(function* problemsFor(\n root: string,\n manifest: string,\n keys: readonly OverrideKey[],\n) {\n const path = yield* Path.Path;\n const files = yield* trackedResolutionFiles(root);\n const workspace: Workspace = { root, files, manifest };\n const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));\n const judgeAgainstBaseline = judge(baseline);\n const file = path.join(root, WORKSPACE_FILE);\n const problemOf = (\n located: OverrideKey,\n ): Effect.Effect<Option.Option<Problem>, CandidateFailure, CandidateServices> =>\n resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(\n Effect.map((candidate) =>\n overrideProblem({ ...located, file })(judgeAgainstBaseline(located.key, candidate)),\n ),\n );\n const problems = yield* Effect.forEach(keys, problemOf, {\n concurrency: RESOLUTION_CONCURRENCY,\n });\n return Arr.getSomes(problems);\n});\n\n/** @internal */\nconst checkOverrides = Effect.fn(\"checkOverrides\")(function* checkOverrides(root: string) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE)).pipe(Effect.option);\n const keys = Option.match(manifest, { onNone: () => [], onSome: overrideKeysOf });\n if (Option.isNone(manifest) || !Arr.isReadonlyArrayNonEmpty(keys)) {\n return [];\n }\n return yield* problemsFor(root, manifest.value, keys);\n});\n\nexport { checkOverrides };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst PYTHON_FILE =\n /(?:\\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\\/)(?:pyproject\\.toml|uv\\.lock|uv\\.toml|poetry\\.lock|Pipfile|Pipfile\\.lock|setup\\.cfg|tox\\.ini|pytest\\.ini|\\.python-version|requirements[^/]*\\.txt))$/u;\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:Dockerfile[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])python[\\d.]*[ \\t]+(?:[-\"'$./]|\\S+\\.py\\b)/gu,\n /(?<![\\w./@-])pip3?[ \\t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\\b/gu,\n /(?<![\\w./@-])pipx[ \\t]+(?:run|install|inject|upgrade)\\b/gu,\n /(?<![\\w./@-])uvx[ \\t]+[^\\s=:,;)|&]/gu,\n /(?<![\\w./@-])uv[ \\t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\\b/gu,\n /(?<![\\w./@-])poetry[ \\t]+(?:run|install|add|lock|build|publish|shell|export)\\b/gu,\n /(?:\\bcommand[\"']?\\s*[:=]\\s*|(?:\\bspawn\\w*|\\bexec\\w*|\\bexeca|Command::new|ChildProcess\\.make|\\$)\\(\\s*)[\"'`](?:python[\\d.]*|pip3?|pipx|uvx?|poetry)[\"'`]/gu,\n /\\buses:\\s*[\"']?(?:actions\\/setup-python|astral-sh\\/setup-uv|astral-sh\\/ruff-action|pypa\\/[\\w.-]+|snok\\/install-poetry|abatilo\\/actions-poetry|conda-incubator\\/setup-miniconda|mamba-org\\/setup-micromamba|pdm-project\\/setup-pdm)\\b/gu,\n];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^\"'\\s=]+)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst READ_CONCURRENCY = 64;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"python-file\";\nconst COMMAND_RULE: RuleName = \"python-command\";\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst fileProblem = ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: FILE_RULE,\n message: \"Python is not used in this repository. Replace this file with TypeScript or Rust.\",\n});\n\nconst patternsFor = (name: string): readonly RegExp[] => {\n if (TOOL_VERSIONS.test(name)) {\n return [...COMMAND_PATTERNS, ...TOOL_PATTERNS];\n }\n return COMMAND_PATTERNS;\n};\n\nconst commandProblem =\n ({ file }: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: COMMAND_RULE,\n message: `Python is not used in this repository. Remove \\`${Str.trim(found[WHOLE_MATCH])}\\` and do the work in TypeScript or Rust.`,\n });\n\nconst commandProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n patternsFor(entry.name),\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map(commandProblem(entry, source)),\n );\n\nconst isPython = ({ name }: Listed): boolean => PYTHON_FILE.test(name);\n\nconst isScanned = (entry: Listed): boolean =>\n !isPython(entry) && SCANNED_FILE.test(entry.name) && !LOCKFILE.test(entry.name);\n\n/** @internal */\nconst checkPython = Effect.fn(\"checkPython\")(function* checkPython(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const listed = pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n const problemsIn = (entry: Listed): Effect.Effect<readonly Problem[]> =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => commandProblems(entry, source),\n }),\n ),\n );\n const scanned = yield* Effect.forEach(pipe(listed, Arr.filter(isScanned)), problemsIn, {\n concurrency: READ_CONCURRENCY,\n });\n const present = yield* Effect.filter(pipe(listed, Arr.filter(isPython)), ({ file }) =>\n files.exists(file),\n );\n return [...pipe(present, Arr.map(fileProblem)), ...Arr.flatten(scanned)];\n});\n\nexport { checkPython };\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkRepository } from \"./check.ts\";\nimport { checkHiddenUnicode } from \"./hidden-unicode.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkOverrides } from \"./overrides.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { checkPython } from \"./python.ts\";\n\n/** @internal */\nconst checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkHiddenUnicode>\n >,\n Effect.Services<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkHiddenUnicode>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkRepository(root),\n checkOverrides(root),\n checkHiddenUnicode(root),\n checkPython(root),\n checkNestedDocs(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n\nexport { checkAll };\n","import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nclass ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nconst writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n\nexport { ProblemsFound, writeStdout };\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServicesLayer } from \"@effect/platform-node/NodeServices\";\nimport { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { ProblemsFound } from \"./output.ts\";\nimport { nodeRepositoryFiles } from \"./repository-files.ts\";\nimport type { RepositoryFiles } from \"./repository-files.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\nconst tracing = Otlp.layerFromConfig({ resource: { serviceName: \"msch\" } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n);\n\nconst runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n >,\n): void => {\n const services = Layer.mergeAll(nodeRepositoryFiles, tracing).pipe(\n Layer.provideMerge(nodeServicesLayer),\n );\n const main = Layer.build(services).pipe(\n Effect.flatMap((context) =>\n Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context),\n ),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n\n/** @internal */\nexport { runCli };\n","#!/usr/bin/env node\nimport { Effect, Schema, Stdio, Array as Arr, pipe } from \"effect\";\n\nimport { checkAll } from \"./all-checks.ts\";\nimport { JSON_FLAG } from \"./cli-contract.ts\";\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { runCli } from \"./runtime.ts\";\n\nconst NO_PROBLEMS = 0;\n\nconst reportText = (\n root: string,\n problems: readonly Problem[],\n): Effect.Effect<void, ProblemsFound, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n if (problems.length > NO_PROBLEMS) {\n return yield* ProblemsFound.make({ count: problems.length });\n }\n return yield* Effect.void;\n });\n\nconst msch = Effect.gen(function* msch() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const root = files.resolve(\".\");\n const found = yield* checkAll(root);\n const problems = sortProblems(found);\n if (args.includes(JSON_FLAG)) {\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);\n return yield* writeStdout(text);\n }\n return yield* reportText(root, problems);\n});\n\nrunCli(msch);\n"],"mappings":";;;;;;;;;;AA8BA,MAAM,kCAA2C,IAAI,IAAI;CACvD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,eAAe,gBACnB,gBAAgB,IAAI,YAAY,IAAI;AAEtC,MAAM,gBAAgB,gBACpB,OAAO,cAAc,aAAa,WAAW,CAAC,CAAC,KAC7C,OAAO,SAAS,cAAc,OAAO,gBAAgB,UAAU,IAAI,CAAC,CACtE;AAEF,MAAM,gBACH,aACA,eAAuD;CACtD,MAAM,OAAO,WAAW;CACxB,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,gBAAgB,IAAI,GAClD,OAAO,OAAO,KAAK;CAErB,MAA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I,UAAU,OAAO;CACvC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,OAAO,MAAM,QAAQ,GAAG;CAC9B,MAAM,QAAQ,OAAO,SAAS,IAAI;CAClC,MAAM,WAAW,aAAa,KAAK;CACnC,IAAI,KAAK,SAAA,QAAkB,GAAG;EAC5B,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ;EACpF,OAAO,OAAO,YAAY,IAAI;CAChC;CACA,OAAO,OAAO,WAAW,MAAM,QAAQ;AACzC,CAEO,CAAI"}
package/dist/oxlint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ProblemList, r as describeFinding, t as JSON_FLAG } from "./cli-contract-BRpk_UKr.mjs";
1
+ import { n as ProblemList, r as describeFinding, t as JSON_FLAG } from "./cli-contract-CkYucdU4.mjs";
2
2
  import { Array, Option, Schema, pipe } from "effect";
3
3
  import { execFileSync } from "node:child_process";
4
4
  import { fileURLToPath } from "node:url";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/msch",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "masseater's check policy: points every finite value set and object shape at its one owner, and ships the oxlint preset of plugins and rules.",
5
5
  "keywords": [
6
6
  "lint",