@r_masseater/msch 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","mentions","SEPARATOR","SCOPE_PREFIX","Arr","Str","closureOf","installedNames","START","FIRST_COLUMN","Str","Arr","WILDCARD","SEPARATOR","SCOPED_SEGMENTS","Str","Arr","Rec","EMPTY","decodeManifest","keysOf","Rec","Arr","childrenOf","Num","Str","START","Arr","Str","Num","Rec","problemsOf","keysOf","Arr","SCOPE_PREFIX","Arr","Rec","Str","packageOf","WORKSPACE_FILE","LOCKFILE","taggedError","textOf","Str","Arr","READ_CONCURRENCY","FIRST","RULE","Str","problemFor","Arr","RULE","FIRST","READ_CONCURRENCY","SCRIPT","problemFor","groupsOf","Arr","Str","ownerOf","problemIn","RULE","CONFIG_FILE","SEPARATOR","FIRST","READ_CONCURRENCY","RootConfig","taggedError","Str","problemFor","problemIn","Arr","RULE","READ_CONCURRENCY","START","problemsIn","Arr","Str","Arr","RULE","CONFIG_FILE","SEPARATOR","FIRST","READ_CONCURRENCY","Arr","Str","problemFor","problemIn","RULE","CONFIG_FILE","FIRST","READ_CONCURRENCY","Arr","RULE","CONFIG_FILE","FIRST","NEXT","childrenOf","Arr","Str","problemsIn","RULE","READ_CONCURRENCY","commandText","Arr","Str","Rec","isText","Arr","SEPARATOR","QUOTED","Arr","Str","directoryOf","RULE","READ_CONCURRENCY","SEPARATOR","FIRST","Str","Arr","isIgnored","problemOf","problemsIn","Arr","READ_CONCURRENCY","RULE","MESSAGE","Arr","Str","RULE","READ_CONCURRENCY","START","MESSAGE","Str","Arr","problemsIn","Arr","Arr","Str","Arr","Arr","Str","Arr","Arr","Arr","childrenOf","Arr","Arr","Arr","Str","Arr","Rec","mentions","Arr","taggedError","Str","NEXT","Arr","Rec","YamlParser","Str","parseSql","Num","START","NONE","Rec","Arr","Str","parseDocument","RULE","READ_CONCURRENCY","START","FIRST_LINE","FIRST_COLUMN","taggedError","Str","Arr","problemOf","START","READ_CONCURRENCY","Str","Arr","Arr","TOOL_PATTERNS","FIRST_LINE","FIRST_COLUMN","WHOLE_MATCH","FILE_RULE","Str","Arr","parse","Str","Arr","Arr","Arr","Arr"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/text-position.ts","../src/features/install-size/model/import-graph.ts","../src/features/install-size/model/installed-closure.ts","../src/features/install-size/model/install-size.ts","../src/features/overrides/model/override-findings.ts","../src/features/overrides/model/override-resolution.ts","../src/features/overrides/model/overrides.ts","../src/features/placement/model/agent-docs-length.ts","../src/features/placement/model/colocated-tests.ts","../src/features/placement/model/nested-docs.ts","../src/features/placement/model/root-readme.ts","../src/features/placement/model/placement-checks.ts","../src/features/repository-layout/model/crates.ts","../src/features/repository-layout/model/hidden-verify.ts","../src/features/repository-layout/model/root-workspace-paths.ts","../src/features/repository-layout/model/shared-uncached-tasks.ts","../src/features/repository-layout/model/workflow-nodes.ts","../src/features/repository-layout/model/workflow-references.ts","../src/features/repository-layout/model/workflow-paths.ts","../src/features/repository-layout/model/workspace-checks.ts","../src/features/scripts/model/shell-scripts.ts","../src/features/scripts/model/workflows.ts","../src/features/scripts/model/script-checks.ts","../src/features/value-owners/model/slots.ts","../src/features/value-owners/model/flows.ts","../src/features/value-owners/model/owners.ts","../src/features/value-owners/model/derivation.ts","../src/features/value-owners/model/shapes.ts","../src/features/value-owners/model/sites.ts","../src/features/value-owners/model/value-checks.ts","../src/features/value-owners/model/analysis.ts","../src/features/value-owners/model/cache.ts","../src/features/value-owners/model/duplicates.ts","../src/features/value-owners/model/check.ts","../src/features/comments/model/found-comment.ts","../src/features/comments/model/config-comments.ts","../src/features/comments/model/comment-readers.ts","../src/features/comments/model/comments.ts","../src/features/invisible-characters/model/hidden-unicode.ts","../src/shared/lib/scanned-files.ts","../src/features/python/model/python.ts","../src/features/unneeded-files/model/unneeded-files.ts","../src/app/tracked-text.ts","../src/app/all-checks.ts","../src/app/output.ts","../src/app/runtime.ts","../src/app/cli.ts"],"sourcesContent":["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\nexport type Value = string | number;\n\nexport interface 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface 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\nexport const 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\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const 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\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const 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\nexport const 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","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/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\nexport const 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","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface 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 CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const 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\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\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\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const 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\nexport const 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\nexport const 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","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (parent !== directory && !(yield* files.exists(files.join(directory, MANIFEST_FILE)))) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* pipe(\n names,\n Effect.forEach((name) => files.realPath(files.join(directory, NODE_MODULES, name))),\n );\n});\n\nconst workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(start: string) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n Effect.forEach(scopedNames(modules)),\n );\n return Arr.flatten(nested);\n});\n\nconst installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* pipe(\n names,\n Effect.forEach((name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n ),\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* pipe(\n Arr.dedupe([root, ...directories]),\n Effect.forEach((directory) => installedPackages(root, directory)),\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\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\nexport const 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","import {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Record as Rec,\n Result,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n SyntaxKind,\n isExportDeclaration,\n isImportDeclaration,\n isStringLiteral,\n} from \"#/shared/lib/compiler.ts\";\nimport type { API, Node } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RELATIVE = /^\\.\\.?(?:\\/|$)/u;\nconst SUBPATH_IMPORT = \"#\";\nconst WILDCARD = \"*\";\nconst SCOPE = \"@\";\nconst SEPARATOR = \"/\";\nconst SOURCE_SUFFIXES = [\"\", \".ts\", \".tsx\", \"/index.ts\"] as const;\nconst SCOPED_SEGMENTS = 2;\nconst PLAIN_SEGMENTS = 1;\n\nconst ImportsField = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\n\nconst decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));\n\ninterface Graph {\n readonly api: API;\n readonly directory: string;\n readonly imports: Readonly<Record<string, string>>;\n}\n\ninterface Walk {\n readonly pending: readonly string[];\n readonly visited: HashSet.HashSet<string>;\n readonly packages: HashSet.HashSet<string>;\n}\n\ntype Reference = Result.Result<string, string>;\n\nconst packageNameOf = (specifier: string): string => {\n const segments = Str.split(specifier, SEPARATOR);\n if (Str.startsWith(SCOPE)(specifier)) {\n return pipe(segments, Arr.take(SCOPED_SEGMENTS), Arr.join(SEPARATOR));\n }\n return pipe(segments, Arr.take(PLAIN_SEGMENTS), Arr.join(SEPARATOR));\n};\n\nconst literalText = (specifier: Node): Option.Option<string> =>\n pipe(\n Option.liftPredicate(specifier, isStringLiteral),\n Option.map((literal) => literal.text),\n );\n\nconst runtimeSpecifierOf = (statement: Node): Option.Option<string> => {\n if (isImportDeclaration(statement)) {\n const typeOnly = pipe(\n Option.fromUndefinedOr(statement.importClause),\n Option.exists((clause) => clause.phaseModifier === SyntaxKind.TypeKeyword),\n );\n return Option.filter(literalText(statement.moduleSpecifier), () => !typeOnly);\n }\n if (isExportDeclaration(statement) && !statement.isTypeOnly) {\n return Option.flatMap(Option.fromUndefinedOr(statement.moduleSpecifier), literalText);\n }\n return Option.none();\n};\n\nconst specifiersIn = (api: API, file: string, text: string): readonly string[] => {\n const retained = api.createSourceFile(file, text);\n const found = pipe(retained.sourceFile.statements, Arr.fromIterable, Arr.map(runtimeSpecifierOf));\n retained.dispose();\n return Arr.getSomes(found);\n};\n\nconst subpathTarget = (\n imports: Readonly<Record<string, string>>,\n specifier: string,\n): Option.Option<string> =>\n pipe(\n Rec.toEntries(imports),\n Arr.findFirst(([pattern, target]) => {\n if (!Str.endsWith(WILDCARD)(pattern)) {\n return Option.liftPredicate(target, () => pattern === specifier);\n }\n const prefix = Str.replace(WILDCARD, \"\")(pattern);\n return Option.liftPredicate(\n Str.replace(WILDCARD, Str.replace(prefix, \"\")(specifier))(target),\n () => Str.startsWith(prefix)(specifier),\n );\n }),\n );\n\nconst existingSource = Effect.fn(\"existingSource\")(function* existingSource(base: string) {\n const files = yield* RepositoryFiles;\n const found = yield* pipe(\n SOURCE_SUFFIXES,\n Effect.forEach((suffix) => {\n const candidate = `${base}${suffix}`;\n return files\n .isDirectory(candidate)\n .pipe(\n Effect.map((directory) =>\n Option.liftPredicate(candidate, () =>\n Option.exists(directory, (isDirectory) => !isDirectory),\n ),\n ),\n );\n }),\n );\n return Arr.head(Arr.getSomes(found));\n});\n\nconst localFile = Effect.fn(\"localFile\")(function* localFile(\n { directory, imports }: Graph,\n from: string,\n specifier: string,\n) {\n const files = yield* RepositoryFiles;\n if (RELATIVE.test(specifier)) {\n return yield* existingSource(files.resolve(files.dirname(from), specifier));\n }\n const target = subpathTarget(imports, specifier);\n if (Option.isNone(target)) {\n return Option.none<string>();\n }\n return yield* existingSource(files.resolve(directory, target.value));\n});\n\nconst referenceOf = (\n graph: Graph,\n from: string,\n specifier: string,\n): Effect.Effect<Option.Option<Reference>, never, RepositoryFiles> => {\n if (RELATIVE.test(specifier) || Str.startsWith(SUBPATH_IMPORT)(specifier)) {\n return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));\n }\n const name = packageNameOf(specifier);\n return Effect.succeedSome(Result.fail(name));\n};\n\nconst referencesIn = Effect.fn(\"referencesIn\")(function* referencesIn(graph: Graph, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const specifiers = Option.match(text, {\n onNone: (): readonly string[] => [],\n onSome: (source) => specifiersIn(graph.api, file, source),\n });\n const references = yield* pipe(\n specifiers,\n Effect.forEach((specifier) => referenceOf(graph, file, specifier)),\n );\n const found = Arr.getSomes(references);\n return { packages: Arr.getFailures(found), sources: Arr.getSuccesses(found) };\n});\n\nconst packagesFrom = (\n graph: Graph,\n walk: Walk,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(walk.pending, {\n onEmpty: () => Effect.succeed(walk.packages),\n onNonEmpty: ([next, ...rest]) => {\n if (HashSet.has(walk.visited, next)) {\n return packagesFrom(graph, { ...walk, pending: rest });\n }\n return referencesIn(graph, next).pipe(\n Effect.flatMap(({ packages, sources }) =>\n packagesFrom(graph, {\n pending: [...rest, ...sources],\n visited: HashSet.add(walk.visited, next),\n packages: HashSet.union(walk.packages, HashSet.fromIterable(packages)),\n }),\n ),\n );\n },\n });\n\n/** @internal */\nexport const packagesByEntry = Effect.fn(\"packagesByEntry\")(function* packagesByEntry(\n api: API,\n directory: string,\n entries: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const imports = pipe(\n manifest,\n Option.flatMap(decodeImports),\n Option.flatMap((field) => Option.fromUndefinedOr(field.imports)),\n Option.getOrElse((): Readonly<Record<string, string>> => ({})),\n );\n const graph: Graph = { api, directory, imports };\n return yield* pipe(\n entries,\n Effect.forEach((entry) =>\n packagesFrom(graph, {\n pending: [entry],\n visited: HashSet.empty(),\n packages: HashSet.empty(),\n }).pipe(Effect.map((packages) => [entry, packages] as const)),\n ),\n );\n});\n","import {\n Array as Arr,\n Effect,\n HashSet,\n Number as Num,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst EMPTY = 0;\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\nconst PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });\nconst PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));\nconst InstalledManifest = Schema.Struct({\n dependencies: DependencyMap,\n optionalDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n peerDependenciesMeta: PeerMeta,\n});\ntype Installed = typeof InstalledManifest.Type;\n\ntype Pending = readonly (readonly [string, string])[];\n\ninterface Collect {\n readonly pending: Pending;\n readonly seen: HashSet.HashSet<string>;\n}\n\nconst decodeManifest = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));\n\nexport const keysOf = (map: Readonly<Record<string, string>> | undefined): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(map),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst isOptionalPeer = (manifest: Installed, name: string): boolean =>\n pipe(\n Option.fromUndefinedOr(manifest.peerDependenciesMeta),\n Option.flatMap(Rec.get(name)),\n Option.exists((meta) => meta.optional === true),\n );\n\nconst installedNames = (manifest: Installed): readonly string[] => [\n ...keysOf(manifest.dependencies),\n ...keysOf(manifest.optionalDependencies),\n ...pipe(\n keysOf(manifest.peerDependencies),\n Arr.filter((name) => !isOptionalPeer(manifest, name)),\n ),\n];\n\nconst childrenOf = Effect.fn(\"childrenOf\")(function* childrenOf(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(installedNames),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((child) => [directory, child] as const),\n );\n});\n\nconst resolveFrom = (\n from: string,\n name: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* resolvePackage() {\n const files = yield* RepositoryFiles;\n const candidate = files.join(from, NODE_MODULES, name);\n const found = yield* files.exists(files.join(candidate, MANIFEST_FILE));\n if (found) {\n const real = yield* files.realPath(candidate);\n return Option.some(real);\n }\n const parent = files.dirname(from);\n if (parent === from) {\n return Option.none<string>();\n }\n return yield* resolveFrom(parent, name);\n });\n\nconst unseen = (\n from: string,\n name: string,\n seen: HashSet.HashSet<string>,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n resolveFrom(from, name).pipe(\n Effect.map(Option.filter((directory) => !HashSet.has(seen, directory))),\n );\n\nconst closureOf = (\n provided: HashSet.HashSet<string>,\n collect: Collect,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(collect.pending, {\n onEmpty: () => Effect.succeed(collect.seen),\n onNonEmpty: ([[from, name], ...rest]) => {\n if (HashSet.has(provided, name)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return unseen(from, name, collect.seen).pipe(\n Effect.flatMap((resolved) => {\n if (Option.isNone(resolved)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return childrenOf(resolved.value).pipe(\n Effect.flatMap((children) =>\n closureOf(provided, {\n pending: [...rest, ...children],\n seen: HashSet.add(collect.seen, resolved.value),\n }),\n ),\n );\n }),\n );\n },\n });\n\nconst directorySize = (directory: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* sizeOfDirectory() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const entries = pipe(\n names,\n Arr.filter((name) => name !== NODE_MODULES),\n Arr.map((name) => files.join(directory, name)),\n );\n const sizes = yield* pipe(\n entries,\n Effect.forEach((entry) =>\n files.isDirectory(entry).pipe(\n Effect.flatMap((kind) => {\n if (Option.isNone(kind)) {\n return Effect.succeed(EMPTY);\n }\n if (kind.value) {\n return directorySize(entry);\n }\n return files.fileSize(entry);\n }),\n ),\n ),\n );\n return Num.sumAll(sizes);\n });\n\nexport interface ClosureRoot {\n readonly provided: HashSet.HashSet<string>;\n readonly from: string;\n readonly name: string;\n}\n\nexport const installedClosure = ({\n provided,\n from,\n name,\n}: ClosureRoot): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n closureOf(provided, { pending: [[from, name]], seen: HashSet.empty() });\n\nexport const installedSize = (directory: string): Effect.Effect<number, never, RepositoryFiles> => {\n if (Str.includes(`/${NODE_MODULES}/`)(directory)) {\n return directorySize(directory);\n }\n return Effect.succeed(EMPTY);\n};\n","import {\n Array as Arr,\n Effect,\n HashMap,\n HashSet,\n Number as Num,\n Option,\n Order,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE, publicEntriesOf, publishedWorkspaces } from \"#/entities/package/index.ts\";\nimport type { PublicEntry, PublishedWorkspace } from \"#/entities/package/index.ts\";\nimport { typeScriptCompiler } from \"#/entities/project/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { packagesByEntry } from \"./import-graph.ts\";\nimport { installedClosure, installedSize, keysOf } from \"./installed-closure.ts\";\n\nconst INSTALL_SIZE: RuleName = \"install-size\";\nconst STACK_DEPENDENCY: RuleName = \"stack-dependency\";\nconst STACK_CATALOG = \"catalog:stack\";\nconst BUDGET_KEY = \"installSize\";\nconst DEPENDENCIES_KEY = '\"dependencies\"';\nconst LISTED_LARGEST = 5;\nconst SIZE_CONCURRENCY = 32;\nconst MEGABYTE = 1_000_000;\nconst MEGABYTE_DIGITS = 1;\nconst START = 0;\nconst SINGLE_ENTRY = 1;\n\ninterface DependencySize {\n readonly name: string;\n readonly size: number;\n readonly entries: readonly string[];\n}\n\ninterface Published {\n readonly workspace: PublishedWorkspace;\n readonly entries: readonly PublicEntry[];\n readonly provided: HashSet.HashSet<string>;\n}\n\ninterface Measured {\n readonly closures: readonly (readonly [string, HashSet.HashSet<string>])[];\n readonly sizeOf: (packages: HashSet.HashSet<string>) => number;\n readonly total: number;\n}\n\ninterface Overrun {\n readonly workspace: PublishedWorkspace;\n readonly total: number;\n readonly largest: readonly DependencySize[];\n readonly entryCount: number;\n}\n\nconst megabytes = (bytes: number): string => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;\n\nconst usageHint = (dependency: DependencySize, entryCount: number): string => {\n const partial =\n entryCount > SINGLE_ENTRY &&\n dependency.entries.length > START &&\n dependency.entries.length < entryCount;\n if (!partial) {\n return \"\";\n }\n return ` (imported only from ${Arr.join(dependency.entries, \", \")})`;\n};\n\nconst listed = ({ largest, entryCount }: Overrun): string =>\n pipe(\n largest,\n Arr.map(\n (dependency) =>\n `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`,\n ),\n Arr.join(\", \"),\n );\n\nconst budgetProblem = Effect.fn(\"budgetProblem\")(function* budgetProblem(overrun: Overrun) {\n const files = yield* RepositoryFiles;\n const { workspace, total } = overrun;\n const config = yield* files.readFile(workspace.configFile);\n const source = Option.getOrElse(config, () => \"\");\n const index = Option.getOrElse(Str.indexOf(BUDGET_KEY)(source), () => START);\n return {\n file: workspace.configFile,\n ...positionOf(source)(index),\n rule: INSTALL_SIZE,\n message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`,\n } satisfies Problem;\n});\n\nconst measure = Effect.fn(\"measure\")(function* measure(\n { workspace, provided }: Published,\n direct: readonly string[],\n) {\n const closures = yield* pipe(\n direct,\n Effect.forEach((name) =>\n installedClosure({ provided, from: workspace.directory, name }).pipe(\n Effect.map((packages) => [name, packages] as const),\n ),\n ),\n );\n const everything = pipe(\n closures,\n Arr.flatMap(([, packages]) => Arr.fromIterable(packages)),\n HashSet.fromIterable,\n );\n const measured = yield* Effect.forEach(\n everything,\n (found) => installedSize(found).pipe(Effect.map((size) => [found, size] as const)),\n { concurrency: SIZE_CONCURRENCY },\n );\n const sizes = HashMap.fromIterable(measured);\n const sizeOf = (packages: HashSet.HashSet<string>): number =>\n Num.sumAll(\n pipe(\n Arr.fromIterable(packages),\n Arr.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START)),\n ),\n );\n return { closures, sizeOf, total: sizeOf(everything) } satisfies Measured;\n});\n\nconst importersOf = Effect.fn(\"importersOf\")(function* importersOf({\n workspace,\n entries,\n}: Published) {\n const compiler = yield* typeScriptCompiler;\n const sources = pipe(\n entries,\n Arr.map((entry) => entry.source),\n Arr.dedupe,\n );\n const byEntry = yield* packagesByEntry(compiler.api, workspace.directory, sources);\n const reached = HashMap.fromIterable(byEntry);\n return (name: string): readonly string[] =>\n pipe(\n entries,\n Arr.filter((entry) =>\n pipe(HashMap.get(reached, entry.source), Option.exists(HashSet.has(name))),\n ),\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n );\n}, Effect.scoped);\n\nconst bySizeDescending = Order.mapInput(\n Order.flip(Order.Number),\n (dependency: DependencySize) => dependency.size,\n);\n\nconst sizeProblems = Effect.fn(\"sizeProblems\")(function* sizeProblems(\n published: Published,\n direct: readonly string[],\n) {\n const { closures, sizeOf, total } = yield* measure(published, direct);\n if (total <= published.workspace.installBudget) {\n return [];\n }\n const importers = yield* importersOf(published);\n const largest = pipe(\n closures,\n Arr.map(([name, packages]): DependencySize => ({\n name,\n size: sizeOf(packages),\n entries: importers(name),\n })),\n Arr.sortBy(bySizeDescending),\n Arr.take(LISTED_LARGEST),\n );\n const entryCount = pipe(\n published.entries,\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n ).length;\n const problem = yield* budgetProblem({\n workspace: published.workspace,\n total,\n largest,\n entryCount,\n });\n return [problem];\n});\n\nconst stackProblems = (\n file: string,\n source: string,\n dependencies: Readonly<Record<string, string>>,\n): readonly Problem[] => {\n const section = Option.getOrElse(Str.indexOf(DEPENDENCIES_KEY)(source), () => START);\n const rest = Str.slice(section)(source);\n return pipe(\n Rec.toEntries(dependencies),\n Arr.filter(([, specifier]) => specifier === STACK_CATALOG),\n Arr.map(([name]): Problem => ({\n file,\n ...positionOf(source)(\n section + Option.getOrElse(Str.indexOf(`\"${name}\"`)(rest), () => START),\n ),\n rule: STACK_DEPENDENCY,\n message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`,\n })),\n );\n};\n\nconst PublishedManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n peerDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nconst problemsOf = Effect.fn(\"problemsOf\")(function* problemsOf(\n workspace: PublishedWorkspace,\n file: string,\n source: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = Schema.decodeOption(Schema.fromJsonString(PublishedManifest))(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n const dependencies = Option.getOrElse(\n Option.fromUndefinedOr(manifest.value.dependencies),\n () => ({}),\n );\n const entries = publicEntriesOf({\n manifest: manifest.value,\n join: (target) => files.join(workspace.directory, target),\n packEntries: workspace.packEntries,\n });\n const provided = HashSet.fromIterable(keysOf(manifest.value.peerDependencies));\n const sized = yield* sizeProblems({ workspace, entries, provided }, Rec.keys(dependencies));\n return [...stackProblems(file, source, dependencies), ...sized];\n});\n\nconst workspaceProblems = Effect.fn(\"workspaceProblems\")(function* workspaceProblems(\n workspace: PublishedWorkspace,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(workspace.directory, MANIFEST_FILE);\n const source = yield* files.readFile(file);\n return yield* Option.match(source, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: (text) => problemsOf(workspace, file, text),\n });\n});\n\n/** @internal */\nexport const checkPublishedPackages = Effect.fn(\"checkPublishedPackages\")(\n function* checkPublishedPackages(root: string) {\n const workspaces = yield* publishedWorkspaces(root);\n const found = yield* pipe(workspaces, Effect.forEach(workspaceProblems));\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.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\nexport interface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nexport const 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","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\nexport type 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\nexport interface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\nexport interface 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\";\nexport const BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\n\nexport interface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nexport const 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\nexport const withoutOverride =\n (key: string) =>\n (manifest: string): string => {\n const document = parseDocument(manifest);\n document.deleteIn([OVERRIDES, key]);\n return document.toString();\n };\n\nexport const withBaselineProbe = (manifest: string): string => {\n const document = parseDocument(manifest);\n document.setIn([OVERRIDES, BASELINE_PROBE], REMOVED_DEPENDENCY);\n return document.toString();\n};\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 type { Problem } from \"#/shared/lib/problem.ts\";\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\";\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 */\nexport const 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","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst AGENT_DOC = /(?:^|\\/)(?:AGENTS|CLAUDE)\\.md$/u;\nconst RECOMMENDED_LINES = 200;\nconst READ_CONCURRENCY = 16;\nconst FIRST = 1;\nconst RULE: RuleName = \"agent-docs-length\";\n\nconst lineCount = (source: string): number => pipe(Str.trimEnd(source), Str.split(\"\\n\")).length;\n\nconst problemFor =\n (file: string) =>\n (lines: number): Option.Option<Problem> => {\n if (lines <= RECOMMENDED_LINES) {\n return Option.none();\n }\n return Option.some({\n file,\n line: RECOMMENDED_LINES + FIRST,\n column: FIRST,\n rule: RULE,\n message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`,\n });\n };\n\n/** @internal */\nexport const checkAgentDocsLength = Effect.fn(\"checkAgentDocsLength\")(\n function* checkAgentDocsLength(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const docs = pipe(\n listed,\n Arr.filter((name) => AGENT_DOC.test(name)),\n );\n const found = yield* Effect.forEach(\n docs,\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(Effect.map(Option.flatMap((source) => problemFor(file)(lineCount(source)))));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n },\n);\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, publicEntriesOf } from \"#/entities/package/index.ts\";\nimport type { EntryManifest } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"colocated-test\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst ROOT_SUBPATH = \".\";\nconst NAME_GROUP = \"name\";\nconst SPECIFIER_GROUP = \"specifier\";\nconst SCRIPT = /\\.[cm]?[jt]sx?$/u;\nconst TEST_FILE = /\\.test\\.[cm]?[jt]sx?$/u;\nconst MANIFEST_NAME = /package\\.json$/u;\nconst SEPARATE_TEST_DIRECTORY = /(?:^|\\/)(?:__tests__|__mocks__|tests?|specs?)\\//u;\nconst RELATIVE_REFERENCE = /[\"'`]\\.\\/(?<name>[^/\"'`]+)/gu;\nconst DIRNAME_REFERENCE = /import\\.meta\\.dirname\\s*,\\s*[\"'](?<name>[^/\"']+)[\"']/gu;\nconst MODULE_SPECIFIER =\n /(?:\\bfrom\\s+|\\bimport\\s*\\(\\s*|\\bimport\\s+|\\bvi\\.mock\\(\\s*)[\"'](?<specifier>[^\"'.#][^\"']*)[\"']/gu;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst DIRECTORY_MESSAGE =\n \"sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.\";\nconst SIBLING_MESSAGE =\n \"refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.\";\n\nconst Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface TestFile {\n readonly name: string;\n readonly base: string;\n readonly file: string;\n readonly directory: string;\n}\n\ninterface Context {\n readonly root: string;\n readonly packages: readonly string[];\n}\n\ninterface Beside {\n readonly join: (target: string) => string;\n readonly dirname: (file: string) => string;\n readonly directory: string;\n}\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nconst problemFor = (test: TestFile, message: string): Problem => ({\n file: test.file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${test.base} ${message}`,\n});\n\nconst groupsOf = (source: string, pattern: RegExp, group: string): readonly string[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((match) =>\n pipe(\n Option.fromUndefinedOr(match.groups),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])),\n ),\n ),\n Arr.getSomes,\n );\n\nconst namesSibling = (source: string): boolean =>\n pipe(\n [\n ...groupsOf(source, RELATIVE_REFERENCE, NAME_GROUP),\n ...groupsOf(source, DIRNAME_REFERENCE, NAME_GROUP),\n ],\n Arr.some((name) => !TEST_FILE.test(name)),\n );\n\nconst ownerOf = (packages: readonly string[], name: string): Option.Option<string> => {\n const owners = pipe(\n packages,\n Arr.filter((directory) => Str.startsWith(directory)(name)),\n );\n return Arr.last(Arr.sort(owners, byLength));\n};\n\nconst specifiersBeside =\n ({ join, dirname, directory }: Beside) =>\n (manifest: EntryManifest): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(manifest.name),\n Option.map((name) =>\n pipe(\n publicEntriesOf({ manifest, join, packEntries: [] }),\n Arr.filter(({ source }) => dirname(source) === directory),\n Arr.map(({ label }) => Str.replace(ROOT_SUBPATH, name)(label)),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst ownSpecifiers = Effect.fn(\"ownSpecifiers\")(function* ownSpecifiers(\n context: Context,\n test: TestFile,\n) {\n const files = yield* RepositoryFiles;\n const owner = ownerOf(context.packages, test.name);\n if (Option.isNone(owner)) {\n return [];\n }\n const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));\n const join = (target: string): string => files.join(context.root, owner.value, target);\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(specifiersBeside({ join, dirname: files.dirname, directory: test.directory })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst refersToOwnDirectory = Effect.fn(\"refersToOwnDirectory\")(function* refersToOwnDirectory(\n context: Context,\n test: TestFile,\n source: string,\n) {\n if (namesSibling(source)) {\n return true;\n }\n const specifiers = groupsOf(source, MODULE_SPECIFIER, SPECIFIER_GROUP);\n if (Arr.isReadonlyArrayEmpty(specifiers)) {\n return false;\n }\n const own = yield* ownSpecifiers(context, test);\n return pipe(\n specifiers,\n Arr.some((specifier) => pipe(own, Arr.contains(specifier))),\n );\n});\n\nconst refersIn = Effect.fn(\"refersIn\")(function* refersIn(context: Context, test: TestFile) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(test.file);\n if (Option.isNone(source)) {\n return true;\n }\n return yield* refersToOwnDirectory(context, test, source.value);\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(context: Context, test: TestFile) {\n if (SEPARATE_TEST_DIRECTORY.test(test.name)) {\n return Option.some(problemFor(test, DIRECTORY_MESSAGE));\n }\n if (!TEST_FILE.test(test.name)) {\n return Option.none<Problem>();\n }\n const refers = yield* refersIn(context, test);\n if (refers) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(test, SIBLING_MESSAGE));\n});\n\n/** @internal */\nexport const checkColocatedTests = Effect.fn(\"checkColocatedTests\")(function* checkColocatedTests(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n const names = pipe(listed, Arr.filter(Str.isNonEmpty));\n const context: Context = {\n root,\n packages: pipe(\n names,\n Arr.filter((name) => files.basename(name) === MANIFEST_FILE),\n Arr.map(Str.replace(MANIFEST_NAME, \"\")),\n ),\n };\n const tests = pipe(\n names,\n Arr.filter((name) => SCRIPT.test(name)),\n Arr.map((name): TestFile => {\n const file = files.join(root, name);\n return { name, base: files.basename(name), file, directory: files.dirname(file) };\n }),\n );\n const found = yield* Effect.forEach(tests, (test) => problemIn(context, test), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, HashSet, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst WORKSPACE_AGENT_DOC = \"AGENTS.md\";\nconst README = /^README(?:\\.[^/]+)?$/iu;\n\nconst RootConfig = Schema.Struct({\n msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }),\n});\n\nconst taggedError = Schema.TaggedError;\n\nclass RootConfigUnreadable extends taggedError<\n RootConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"RootConfigUnreadable\", { file: Schema.String }) {}\n\nconst isNested = (name: string): boolean => Str.includes(SEPARATOR)(name);\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 WORKSPACE_AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.\";\nconst README_MESSAGE =\n \"is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.\";\n\ninterface Allowed {\n readonly workspaces: HashSet.HashSet<string>;\n readonly workspaceAgentDocs: boolean;\n}\n\ninterface NestedDoc {\n readonly file: string;\n readonly base: string;\n readonly directory: string;\n}\n\nconst agentDocProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!allowed.workspaceAgentDocs) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));\n};\n\nconst readmeProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n};\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n allowed: Allowed,\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const doc: NestedDoc = { file, base: files.basename(name), directory: files.dirname(file) };\n if (AGENT_DOCS.test(doc.base)) {\n return agentDocProblem(doc, allowed);\n }\n return readmeProblem(doc, allowed);\n});\n\nconst allowsWorkspaceAgentDocs = Effect.fn(\"allowsWorkspaceAgentDocs\")(\n function* allowsWorkspaceAgentDocs(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return false;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => RootConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(RootConfig)), Option.isSome);\n },\n);\n\n/** @internal */\nexport const checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);\n const allowed: Allowed = {\n workspaces: pipe(\n nested,\n Arr.filter((name) => files.basename(name) === MANIFEST_FILE),\n Arr.map((name) => files.dirname(files.join(root, name))),\n HashSet.fromIterable,\n ),\n workspaceAgentDocs,\n };\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, allowed, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { namedWorkspaces } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-readme\";\nconst ROOT_DOC = /^(?:README(?:\\.[^/]+)?|AGENTS\\.md|CLAUDE\\.md)$/iu;\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst CHECK_POLICY = \"@r_masseater/msch\";\n\nconst isCheckPolicy = ({ packageName }: NamedWorkspace): boolean =>\n Option.contains(packageName, CHECK_POLICY);\n\nconst messageFor = (directory: string): string =>\n `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;\n\nconst problemsIn =\n (file: string, source: string) =>\n ({ directory, pattern }: NamedWorkspace): readonly Problem[] => {\n const message = messageFor(directory);\n const at = positionOf(source);\n return pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((found) => ({ file, ...at(found.index ?? START), rule: RULE, message })),\n );\n };\n\nconst problemsInReadme = Effect.fn(\"problemsInReadme\")(function* problemsInReadme(\n file: string,\n workspaces: readonly NamedWorkspace[],\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n return pipe(\n text,\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => pipe(workspaces, Arr.flatMap(problemsIn(file, source))),\n }),\n );\n});\n\n/** @internal */\nexport const checkRootReadme = Effect.fn(\"checkRootReadme\")(function* checkRootReadme(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const readmes = pipe(\n names,\n Arr.filter((name) => ROOT_DOC.test(name)),\n );\n const named = yield* namedWorkspaces(root);\n const workspaces = pipe(\n named,\n Arr.filter((workspace) => !isCheckPolicy(workspace)),\n );\n const found = yield* Effect.forEach(\n readmes,\n (name) => problemsInReadme(files.join(root, name), workspaces),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkAgentDocsLength } from \"./agent-docs-length.ts\";\nimport { checkColocatedTests } from \"./colocated-tests.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkRootReadme } from \"./root-readme.ts\";\n\n/** @internal */\nexport const checkPlacement = Effect.fn(\"checkPlacement\")(function* checkPlacement(root: string) {\n const found = yield* Effect.all(\n [\n checkNestedDocs(root),\n checkRootReadme(root),\n checkColocatedTests(root),\n checkAgentDocsLength(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Schema, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { workspaceDirectories, hasVerifyTask } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unverified-crate\";\nconst CARGO_FILE = \"Cargo.toml\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst CrateEntry = Schema.Struct({ name: Schema.String, manifest_path: Schema.String });\nconst CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));\nconst decodeCrateList = Schema.decodeUnknownEffect(CrateList);\n\ninterface Crate {\n readonly name: string;\n readonly manifest: string;\n}\n\nconst cratesIn = Effect.fn(\"cratesIn\")(function* cratesIn(root: string) {\n const handle = yield* ChildProcess.make(\n \"cargo\",\n [\"metadata\", \"--no-deps\", \"--format-version\", \"1\", \"--offline\"],\n { cwd: root, extendEnv: true, stdin: \"ignore\" },\n );\n const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const list = yield* decodeCrateList(output);\n return pipe(\n list.packages,\n Arr.map((crate): Crate => ({ name: crate.name, manifest: crate.manifest_path })),\n );\n}, Effect.scoped);\n\nconst owningWorkspace =\n (directories: readonly string[]) =>\n (directory: string): Option.Option<string> => {\n const owners = pipe(\n directories,\n Arr.filter(\n (workspace) =>\n directory === workspace || Str.startsWith(`${workspace}${SEPARATOR}`)(directory),\n ),\n );\n return Arr.last(Arr.sort(owners, Str.Order));\n };\n\nconst problemFor = (crate: Crate, message: string): Problem => ({\n file: crate.manifest,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `crate ${crate.name} ${message}, so vp run verify never checks it.`,\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n directories: readonly string[],\n crate: Crate,\n) {\n const files = yield* RepositoryFiles;\n const workspace = owningWorkspace(directories)(\n files.relative(root, files.dirname(crate.manifest)),\n );\n if (Option.isNone(workspace)) {\n return Option.some(problemFor(crate, \"is outside every workspace package\"));\n }\n const verified = yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE));\n if (verified) {\n return Option.none<Problem>();\n }\n return Option.some(\n problemFor(crate, `is in ${workspace.value}, whose ${CONFIG_FILE} has no verify task`),\n );\n});\n\n/** @internal */\nexport const checkCrates = Effect.fn(\"checkCrates\")(function* checkCrates(root: string) {\n const files = yield* RepositoryFiles;\n const cargo = yield* files.exists(files.join(root, CARGO_FILE));\n if (!cargo) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const crates = yield* cratesIn(root);\n const found = yield* Effect.forEach(crates, (crate) => problemIn(root, directories, crate), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option } from \"effect\";\n\nimport {\n workspaceConfigOf,\n workspaceDirectories,\n VERIFY_TASK,\n definesTask,\n hasVerifyTask,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nconst RULE: RuleName = \"hidden-verify\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, directory: string) {\n const config = yield* workspaceConfigOf(root, directory);\n if (Option.isNone(config)) {\n return Option.none<Problem>();\n }\n const { file, program } = config.value;\n if (definesTask(VERIFY_TASK)(program)) {\n return Option.none<Problem>();\n }\n const verified = yield* hasVerifyTask(file);\n return Option.some<Problem>({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${directory} gets its verify task from code outside ${CONFIG_FILE}. The root verify reads ${CONFIG_FILE} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE}.`,\n }).pipe(Option.filter(() => verified));\n});\n\n/** @internal */\nexport const checkHiddenVerify = Effect.fn(\"checkHiddenVerify\")(function* checkHiddenVerify(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(directories, (directory) => problemIn(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nimport { childrenOf, workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-workspace-path\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst PATH_CHARACTER = /[\\w.@/-]/u;\nconst NAME_CHARACTER = /[\\w.@-]/u;\nconst FIRST = 0;\nconst NEXT = 1;\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\ninterface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nconst stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n\nconst isBoundary = (character: string, allowed: RegExp): boolean =>\n character === \"\" || !allowed.test(character);\n\nconst mentions =\n (directory: string) =>\n (text: string): boolean => {\n const parts = Str.split(text, directory);\n return pipe(\n Arr.drop(parts, NEXT),\n Arr.some((after, index) => {\n const before = parts[index] ?? \"\";\n const previous = Str.slice(before.length - NEXT)(before);\n const following = Str.slice(FIRST, NEXT)(after);\n return (\n isBoundary(previous, PATH_CHARACTER) &&\n (following === \"/\" || isBoundary(following, NAME_CHARACTER))\n );\n }),\n );\n };\n\nconst problemsIn =\n (file: string, source: string, directories: readonly string[]) =>\n (found: FoundString): readonly Problem[] =>\n pipe(\n directories,\n Arr.filter((directory) => mentions(directory)(found.text)),\n Arr.map((directory): Problem => ({\n file,\n ...positionOf(source)(found.start),\n rule: RULE,\n message: `${directory} is a workspace. The root ${CONFIG_FILE} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE}: msch.lint, msch.devDependencies or its verify task.`,\n })),\n );\n\n/** @internal */\nexport const checkRootWorkspacePaths = Effect.fn(\"checkRootWorkspacePaths\")(\n function* checkRootWorkspacePaths(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: \"ts\" }));\n return pipe(\n stringsIn(parsed.program),\n Arr.flatMap(problemsIn(file, source.value, directories)),\n );\n },\n);\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n KeySchema,\n keyName,\n literalOf,\n nestedValues,\n workspaceConfigOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"shared-uncached-task\";\nconst TASKS_PATH = [\"run\", \"tasks\"] as const;\nconst READ_CONCURRENCY = 8;\nconst SHARED = 2;\nconst OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\\//u;\n\nconst TaskProperty = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n start: Schema.Finite,\n});\nconst TaskObject = Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n});\nconst UncachedTask = Schema.Struct({\n cache: Schema.Literal(false),\n command: Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]),\n});\n\nconst decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);\nconst decodeTaskObject = Schema.decodeUnknownOption(TaskObject);\nconst decodeUncachedTask = Schema.decodeUnknownOption(UncachedTask);\nconst encodeDefinition = Schema.encodeOption(Schema.fromJsonString(Schema.Unknown));\n\ninterface UncachedDefinition {\n readonly directory: string;\n readonly file: string;\n readonly position: Pick<Problem, \"line\" | \"column\">;\n readonly name: string;\n readonly command: string;\n readonly definition: string;\n}\n\nconst commandText = (command: typeof UncachedTask.Type.command): string =>\n Arr.join(Arr.ensure(command), \" && \");\n\nconst runsOwnProgram = (command: string): boolean =>\n pipe(\n Str.trim(command),\n Str.split(/\\s+/u),\n Arr.head,\n Option.exists((program) => OWN_PROGRAM.test(program)),\n );\n\ninterface ConfigFile {\n readonly directory: string;\n readonly file: string;\n readonly source: string;\n}\n\nconst definitionOf =\n ({ directory, file, source }: ConfigFile) =>\n (task: typeof TaskProperty.Type): Option.Option<UncachedDefinition> =>\n Option.gen(function* uncachedDefinition() {\n const literal = yield* literalOf(task.value);\n const { command } = yield* decodeUncachedTask(literal);\n const text = commandText(command);\n if (runsOwnProgram(text)) {\n return yield* Option.none();\n }\n const definition = yield* encodeDefinition(literal);\n return {\n directory,\n file,\n position: positionOf(source)(task.start),\n name: keyName(task.key),\n command: text,\n definition,\n };\n });\n\nconst definitionsIn = Effect.fn(\"definitionsIn\")(function* definitionsIn(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n if (Option.isNone(config)) {\n return [];\n }\n const { file, source, program } = config.value;\n return pipe(\n nestedValues(TASKS_PATH)(program),\n Arr.flatMap((tasks) =>\n pipe(\n decodeTaskObject(tasks),\n Option.map(({ properties }) => properties),\n Option.getOrElse((): readonly unknown[] => []),\n ),\n ),\n Arr.flatMap((property) =>\n pipe(\n decodeTaskProperty(property),\n Option.flatMap(definitionOf({ directory, file, source })),\n Option.toArray,\n ),\n ),\n );\n});\n\nconst problemsOf = (definitions: readonly UncachedDefinition[]): readonly Problem[] => {\n const directories = pipe(\n definitions,\n Arr.map(({ directory }) => directory),\n Arr.dedupe,\n );\n if (directories.length < SHARED) {\n return [];\n }\n return pipe(\n definitions,\n Arr.map(({ file, position, name, command }): Problem => ({\n file,\n ...position,\n rule: RULE,\n message: `The uncached task ${name} (${command}) is written the same way in ${Arr.join(directories, \", \")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`,\n })),\n );\n};\n\n/** @internal */\nexport const checkSharedUncachedTasks = Effect.fn(\"checkSharedUncachedTasks\")(\n function* checkSharedUncachedTasks(root: string) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(\n directories,\n (directory) => definitionsIn(root, directory),\n { concurrency: READ_CONCURRENCY },\n );\n return pipe(\n Arr.flatten(found),\n Arr.groupBy(({ name, definition }) => `${name}\\u0000${definition}`),\n Rec.values,\n Arr.flatMap(problemsOf),\n );\n },\n);\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, isSeq, parseDocument, visit } from \"yaml\";\nimport type { Pair, Scalar, YAMLMap, YAMLSeq } from \"yaml\";\n\nconst MISSING_OFFSET = 0;\n\n/** @internal */\nexport interface Located {\n readonly text: string;\n readonly offset: number;\n}\n\n/** @internal */\nexport type Entry = readonly [string, unknown];\n\ntype Ranged = Scalar | YAMLMap | YAMLSeq;\n\nconst isRanged = (node: unknown): node is Ranged => isScalar(node) || isMap(node) || isSeq(node);\n\n/** @internal */\nexport const isText = (node: unknown): node is Scalar<string> =>\n isScalar(node) && typeof node.value === \"string\";\n\nconst isTextPair = (pair: unknown): pair is Pair<Scalar<string>> =>\n isPair(pair) && isText(pair.key);\n\nconst offsetOf = (node: unknown): number =>\n pipe(\n Option.liftPredicate(node, isRanged),\n Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)),\n Option.map(([start]) => start),\n Option.getOrElse(() => MISSING_OFFSET),\n );\n\n/** @internal */\nexport const stringOf = (node: unknown): Option.Option<Located> =>\n pipe(\n Option.liftPredicate(node, isText),\n Option.map((scalar) => ({ text: scalar.value, offset: offsetOf(scalar) })),\n );\n\n/** @internal */\nexport const childOf =\n (key: string) =>\n (node: unknown): unknown =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): unknown => map.get(key, true)),\n Option.getOrUndefined,\n );\n\n/** @internal */\nexport const workingDirectoryOf = (owner: unknown): Option.Option<Located> => {\n const run = childOf(\"run\")(childOf(\"defaults\")(owner));\n return stringOf(childOf(\"working-directory\")(run));\n};\n\n/** @internal */\nexport const itemsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isSeq),\n Option.map((seq): readonly unknown[] => seq.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\nconst pairsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): readonly unknown[] => map.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\n/** @internal */\nexport const entriesOf = (node: unknown): readonly Entry[] =>\n pipe(\n pairsOf(node),\n Arr.filter(isTextPair),\n Arr.map((pair): Entry => [pair.key.value, pair.value]),\n );\n\n/** @internal */\nexport const scalarsIn = (source: string): readonly Located[] => {\n const found: Located[] = [];\n visit(parseDocument(source), {\n Scalar: (_key, node) => {\n found.push(...Option.toArray(stringOf(node)));\n },\n });\n return found;\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport { parseDocument } from \"yaml\";\n\nimport {\n childOf,\n entriesOf,\n itemsOf,\n scalarsIn,\n stringOf,\n workingDirectoryOf,\n} from \"./workflow-nodes.ts\";\nimport type { Entry, Located } from \"./workflow-nodes.ts\";\n\nconst ROOT = \".\";\nconst LOCAL = \"./\";\nconst NEGATION = \"!\";\nconst SEPARATOR = \"/\";\nconst LINE = \"\\n\";\nconst UNRESOLVED_MARKERS = [\"${{\", \"$\", \"{\"];\nconst ABSOLUTE_MARKERS = [\"/\", \"~\"];\nconst FILE_INPUT_SUFFIX = \"-file\";\nconst DEPENDENCY_PATH_INPUT = \"cache-dependency-path\";\nconst FILTER_KEYS = [\"paths\", \"paths-ignore\"];\nconst HASH_FILES = /hashFiles\\((?<arguments>[^)]*)\\)/gu;\nconst QUOTED = /'(?<path>[^']*)'/gu;\nconst SCRIPT = /^[\\w.@/-]+\\.(?:ts|mts|cts|sh)$/u;\nconst TOKEN_SEPARATOR = /[\\s;&|()<>\"'`=]+/u;\n\n/** @internal */\nexport const ACTION_DEFINITIONS: readonly string[] = [\"action.yml\", \"action.yaml\"];\n\n/** @internal */\nexport type ReferenceKind = \"glob\" | \"file\" | \"script\" | \"directory\" | \"action\";\n\n/** @internal */\nexport interface WorkflowReference {\n readonly kind: ReferenceKind;\n readonly field: string;\n readonly path: string;\n readonly offset: number;\n}\n\nconst containsAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.includes(marker)(path)),\n );\n\nconst startsWithAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.startsWith(marker)(path)),\n );\n\nconst isLiteralPath = (path: string): boolean =>\n Str.isNonEmpty(path) &&\n !containsAny(UNRESOLVED_MARKERS)(path) &&\n !startsWithAny(ABSOLUTE_MARKERS)(path);\n\nconst withoutLocal = (path: string): string => {\n if (Str.startsWith(LOCAL)(path)) {\n return Str.slice(LOCAL.length)(path);\n }\n return path;\n};\n\nconst joinPath = (base: string, path: string): string => {\n const relative = withoutLocal(Str.trim(path));\n if (base === ROOT) {\n return relative;\n }\n return `${base}${SEPARATOR}${relative}`;\n};\n\nconst reference =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n ({ text, offset }: Located): readonly WorkflowReference[] => {\n const path = Str.trim(text);\n if (!isLiteralPath(path) || !isLiteralPath(base)) {\n return [];\n }\n return [{ kind, field, path: joinPath(base, path), offset }];\n };\n\nconst isPositive = ({ text }: Located): boolean => !Str.startsWith(NEGATION)(Str.trim(text));\n\nconst globsIn = (field: string, node: unknown): readonly WorkflowReference[] =>\n pipe(\n itemsOf(node),\n Arr.flatMap((item) => Option.toArray(stringOf(item))),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", field)),\n );\n\nconst filtersOf = ([event, filters]: Entry): readonly WorkflowReference[] =>\n pipe(\n FILTER_KEYS,\n Arr.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))),\n );\n\nconst directoryOf = (located: Option.Option<Located>, base: string): string =>\n pipe(\n located,\n Option.map(({ text }) => joinPath(ROOT, text)),\n Option.getOrElse(() => base),\n );\n\nconst located =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n (found: Option.Option<Located>): readonly WorkflowReference[] =>\n pipe(found, Option.toArray, Arr.flatMap(reference(kind, field, base)));\n\nconst localUses = (node: unknown): Option.Option<Located> =>\n pipe(\n stringOf(childOf(\"uses\")(node)),\n Option.filter(({ text }) => Str.startsWith(LOCAL)(text)),\n );\n\nconst scriptsIn =\n (field: string, base: string) =>\n ({ text, offset }: Located): readonly WorkflowReference[] =>\n pipe(\n Str.split(text, TOKEN_SEPARATOR),\n Arr.filter((token) => SCRIPT.test(token)),\n Arr.dedupe,\n Arr.flatMap((token) => reference(\"script\", field, base)({ text: token, offset })),\n );\n\nconst isFileInput = ([key]: Entry): boolean =>\n Str.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;\n\nconst linesOf = ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Str.split(text, LINE),\n Arr.map((line) => ({ text: line, offset })),\n );\n\nconst fileInputOf =\n (field: string) =>\n ([key, value]: Entry): readonly WorkflowReference[] =>\n pipe(\n stringOf(value),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.flatMap(reference(\"glob\", `${field}.with.${key}`)),\n );\n\nconst fileInputsIn = (field: string, step: unknown): readonly WorkflowReference[] =>\n pipe(entriesOf(childOf(\"with\")(step)), Arr.filter(isFileInput), Arr.flatMap(fileInputOf(field)));\n\nconst stepReferences =\n (job: string, base: string) =>\n (step: unknown, index: number): readonly WorkflowReference[] => {\n const field = `jobs.${job}.steps[${index}]`;\n const own = stringOf(childOf(\"working-directory\")(step));\n const directory = directoryOf(own, base);\n return [\n ...located(\"action\", `${field}.uses`)(localUses(step)),\n ...located(\"directory\", `${field}.working-directory`)(own),\n ...pipe(\n stringOf(childOf(\"run\")(step)),\n Option.toArray,\n Arr.flatMap(scriptsIn(`${field}.run`, directory)),\n ),\n ...fileInputsIn(field, step),\n ];\n };\n\nconst jobReferences =\n (base: string) =>\n ([job, node]: Entry): readonly WorkflowReference[] => {\n const own = workingDirectoryOf(node);\n const steps = itemsOf(childOf(\"steps\")(node));\n const directory = directoryOf(own, base);\n return [\n ...located(\"file\", `jobs.${job}.uses`)(localUses(node)),\n ...located(\"directory\", `jobs.${job}.defaults.run.working-directory`)(own),\n ...pipe(steps, Arr.flatMap(stepReferences(job, directory))),\n ];\n };\n\nconst groupsOf =\n (pattern: RegExp, group: string) =>\n ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[group])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, offset })),\n );\n\nconst hashFilesIn = (source: string): readonly WorkflowReference[] =>\n pipe(\n scalarsIn(source),\n Arr.flatMap(groupsOf(HASH_FILES, \"arguments\")),\n Arr.flatMap(groupsOf(QUOTED, \"path\")),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", \"hashFiles\")),\n );\n\nconst jobsOf = (source: string): readonly Entry[] =>\n entriesOf(childOf(\"jobs\")(parseDocument(source).contents));\n\n/** @internal */\nexport const workflowReferences = (source: string): readonly WorkflowReference[] => {\n const root = parseDocument(source).contents;\n const workflowDefault = workingDirectoryOf(root);\n const base = directoryOf(workflowDefault, ROOT);\n return [\n ...pipe(entriesOf(childOf(\"on\")(root)), Arr.flatMap(filtersOf)),\n ...located(\"directory\", \"defaults.run.working-directory\")(workflowDefault),\n ...pipe(jobsOf(source), Arr.flatMap(jobReferences(base))),\n ...hashFilesIn(source),\n ];\n};\n\nconst pathInputOf = (step: unknown): unknown => childOf(\"path\")(childOf(\"with\")(step));\n\nconst outputPathsOf = (step: unknown): readonly string[] =>\n pipe(\n stringOf(pathInputOf(step)),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.map(({ text }) => joinPath(ROOT, text)),\n Arr.filter(isLiteralPath),\n );\n\n/** @internal */\nexport const producedPaths = (source: string): readonly string[] =>\n pipe(\n jobsOf(source),\n Arr.flatMap(([, job]) => itemsOf(childOf(\"steps\")(job))),\n Arr.flatMap(outputPathsOf),\n );\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { ACTION_DEFINITIONS, producedPaths, workflowReferences } from \"./workflow-references.ts\";\nimport type { ReferenceKind, WorkflowReference } from \"./workflow-references.ts\";\n\nconst RULE: RuleName = \"workflow-path\";\nconst WORKFLOW_DIRECTORY = \".github/workflows/\";\nconst WORKFLOW_EXTENSIONS = [\".yml\", \".yaml\"];\nconst READ_CONCURRENCY = 8;\nconst WILDCARD = /[*?[]/u;\nconst SEPARATOR = \"/\";\nconst FIRST = 0;\n\nconst EXPECTED: Readonly<Record<ReferenceKind, string>> = {\n action: \"a directory with action.yml\",\n directory: \"a directory\",\n file: \"a file\",\n glob: \"a pattern that matches a tracked file\",\n script: \"a file\",\n};\n\ntype Resolver = (root: string, path: string) => Effect.Effect<boolean, never, RepositoryFiles>;\n\nconst isWorkflow = (file: string): boolean =>\n Str.startsWith(WORKFLOW_DIRECTORY)(file) &&\n pipe(\n WORKFLOW_EXTENSIONS,\n Arr.some((extension) => Str.endsWith(extension)(file)),\n );\n\nconst matchesAny = Effect.fn(\"matchesAny\")(function* matchesAny(\n root: string,\n pathspecs: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const matched = yield* files.matchingFiles(root, pathspecs);\n return Arr.isReadonlyArrayNonEmpty(matched);\n});\n\nconst existsAt: Resolver = Effect.fn(\"existsAt\")(function* existsAt(root: string, path: string) {\n const files = yield* RepositoryFiles;\n return yield* files.exists(files.join(root, path));\n});\n\nconst matchesGlob: Resolver = (root, path) => matchesAny(root, [`:(glob)${path}`]);\n\nconst isDirectoryAt: Resolver = Effect.fn(\"isDirectoryAt\")(function* isDirectoryAt(\n root: string,\n path: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* files.isDirectory(files.join(root, path));\n return Option.getOrElse(directory, () => false);\n});\n\nconst hasAction: Resolver = Effect.fn(\"hasAction\")(function* hasAction(root: string, path: string) {\n const found = yield* pipe(\n ACTION_DEFINITIONS,\n Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR}${name}`)),\n );\n return pipe(found, Arr.some(Boolean));\n});\n\nconst suffixAt =\n (segments: readonly string[]) =>\n (index: number): string =>\n `:(glob)**/${pipe(segments, Arr.drop(index), Arr.join(SEPARATOR))}`;\n\nconst findsScript: Resolver = Effect.fn(\"findsScript\")(function* findsScript(\n root: string,\n path: string,\n) {\n if (yield* existsAt(root, path)) {\n return true;\n }\n const segments = Str.split(path, SEPARATOR);\n return yield* matchesAny(root, Arr.makeBy(segments.length, suffixAt(segments)));\n});\n\nconst RESOLVERS: Readonly<Record<ReferenceKind, Resolver>> = {\n action: hasAction,\n directory: isDirectoryAt,\n file: existsAt,\n glob: matchesGlob,\n script: findsScript,\n};\n\nconst staticPrefix = (path: string): string => {\n const prefix = Arr.headNonEmpty(Str.split(path, WILDCARD));\n if (Str.endsWith(SEPARATOR)(prefix)) {\n return Str.slice(FIRST, -SEPARATOR.length)(prefix);\n }\n return prefix;\n};\n\nconst isIgnored = Effect.fn(\"isIgnored\")(function* isIgnored(root: string, path: string) {\n const prefix = staticPrefix(path);\n if (Str.isEmpty(prefix)) {\n return false;\n }\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredPaths(root, [prefix]);\n return Arr.isReadonlyArrayNonEmpty(ignored);\n});\n\nconst overlaps =\n (path: string) =>\n (produced: string): boolean =>\n produced === path ||\n Str.startsWith(`${path}${SEPARATOR}`)(produced) ||\n Str.startsWith(`${produced}${SEPARATOR}`)(path);\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n produced: readonly string[],\n found: WorkflowReference,\n) {\n const prefix = staticPrefix(found.path);\n if (pipe(produced, Arr.some(overlaps(prefix)))) {\n return false;\n }\n if (yield* RESOLVERS[found.kind](root, found.path)) {\n return false;\n }\n return !(yield* isIgnored(root, found.path));\n});\n\nconst problemOf =\n (file: string, source: string) =>\n (found: WorkflowReference): Problem => ({\n file,\n ...positionOf(source)(found.offset),\n rule: RULE,\n message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`,\n });\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(root: string, workflow: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, workflow);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const produced = producedPaths(source.value);\n const missing = yield* Effect.filter(workflowReferences(source.value), (found) =>\n isMissing(root, produced, found),\n );\n return pipe(missing, Arr.map(problemOf(file, source.value)));\n});\n\n/** @internal */\nexport const checkWorkflowPaths = Effect.fn(\"checkWorkflowPaths\")(function* checkWorkflowPaths(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(listed, Arr.filter(isWorkflow)),\n (workflow) => problemsIn(root, workflow),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkCrates } from \"./crates.ts\";\nimport { checkHiddenVerify } from \"./hidden-verify.ts\";\nimport { checkRootWorkspacePaths } from \"./root-workspace-paths.ts\";\nimport { checkSharedUncachedTasks } from \"./shared-uncached-tasks.ts\";\nimport { checkWorkflowPaths } from \"./workflow-paths.ts\";\n\n/** @internal */\nexport const checkWorkspaces = Effect.fn(\"checkWorkspaces\")(function* checkWorkspaces(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkCrates(root),\n checkHiddenVerify(root),\n checkRootWorkspacePaths(root),\n checkSharedUncachedTasks(root),\n checkWorkflowPaths(root),\n ],\n {\n concurrency: \"unbounded\",\n },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst SHELL_FILE = /\\.(?:sh|bash|zsh|ksh|fish|command)$/u;\nconst SHELL_SHEBANG = /^#!\\S*(?:\\/|\\s)(?:env\\s+)?(?:-\\S+\\s+)*(?:ba|z|k|da)?sh\\b|^#!\\S*fish\\b/u;\nconst EXTENSION = /\\.[^./]+$/u;\nconst SETTINGS_FILE = \".claude/settings.json\";\nconst READ_CONCURRENCY = 64;\nconst FIRST = 1;\nconst RULE: RuleName = \"shell-script\";\nconst MESSAGE =\n \"is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.\";\n\nconst HookSchema = Schema.Struct({\n command: Schema.optional(Schema.String),\n args: Schema.optional(Schema.Array(Schema.String)),\n});\nconst MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });\nconst HooksSchema = Schema.Struct({ SessionStart: Schema.optional(Schema.Array(MatcherSchema)) });\nconst SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });\nconst decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));\n\ntype Hook = typeof HookSchema.Type;\ntype Matcher = typeof MatcherSchema.Type;\n\nconst NO_TEXT: readonly string[] = [];\n\nconst commandText = ({ command, args }: Hook): readonly string[] => [\n ...Option.toArray(Option.fromUndefinedOr(command)),\n ...pipe(\n Option.fromUndefinedOr(args),\n Option.getOrElse(() => NO_TEXT),\n ),\n];\n\nconst matcherText = ({ hooks }: Matcher): readonly string[] =>\n pipe(\n hooks,\n Arr.flatMap((hook) => commandText(hook)),\n );\n\nconst sessionStartCommands = (source: string): readonly string[] => {\n const matchers = pipe(\n decodeSettings(source),\n Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)),\n Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)),\n );\n return pipe(\n matchers,\n Option.map(Arr.flatMap((matcher) => matcherText(matcher))),\n Option.getOrElse(() => NO_TEXT),\n );\n};\n\nconst baseName = (name: string): string =>\n pipe(\n Str.split(\"/\")(name),\n Arr.last,\n Option.getOrElse(() => name),\n );\n\nconst hasExtension = (name: string): boolean => EXTENSION.test(baseName(name));\n\nconst startsWithShellShebang = (source: string): boolean => SHELL_SHEBANG.test(source);\n\nconst problemFor = (file: string): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n});\n\n/** @internal */\nexport const checkShellScripts = Effect.fn(\"checkShellScripts\")(function* checkShellScripts(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));\n const commands = pipe(\n settings,\n Option.map(sessionStartCommands),\n Option.getOrElse(() => NO_TEXT),\n );\n const isSessionStartHook = (name: string): boolean =>\n pipe(commands, Arr.some(Str.includes(name)));\n const isShell = (name: string): Effect.Effect<boolean> => {\n const file = files.join(root, name);\n if (SHELL_FILE.test(name)) {\n return files.exists(file);\n }\n if (hasExtension(name)) {\n return Effect.succeed(false);\n }\n return files.readFile(file).pipe(Effect.map(Option.exists(startsWithShellShebang)));\n };\n const candidates = pipe(\n names,\n Arr.filter((name) => !isSessionStartHook(name)),\n );\n const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY });\n return pipe(\n shell,\n Arr.map((name) => problemFor(files.join(root, name))),\n );\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport type { Range } from \"yaml\";\nimport { isPair, isScalar, parseDocument, visit } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst WORKFLOW_FILE = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/u;\nconst COMMAND_CHAIN = /&&|\\|\\||;|\\|/u;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst COMMENT = \"#\";\nconst RUN_KEY = \"run\";\nconst RULE: RuleName = \"workflow-script\";\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst ONE_COMMAND = 1;\nconst MESSAGE =\n \"runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.\";\n\ninterface RunScript {\n readonly text: string;\n readonly start: number;\n}\n\nconst startOf = (range: Readonly<Range> | null | undefined): number =>\n pipe(\n Option.fromNullishOr(range),\n Option.map(([start]) => start),\n Option.getOrElse(() => START),\n );\n\nconst runScriptsOf = (source: string): readonly RunScript[] => {\n const found: RunScript[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (\n isPair(pair) &&\n isScalar(pair.key) &&\n pair.key.value === RUN_KEY &&\n isScalar(pair.value) &&\n typeof pair.value.value === \"string\"\n ) {\n found.push({ text: pair.value.value, start: startOf(pair.value.range) });\n }\n },\n });\n return found;\n};\n\nconst isCommand = (line: string): boolean => Str.isNonEmpty(line) && !Str.startsWith(COMMENT)(line);\n\nconst chainsCommands = (line: string): boolean =>\n COMMAND_CHAIN.test(Str.replaceAll(QUOTED, \"\")(line));\n\nconst runsMoreThanOneCommand = ({ text }: RunScript): boolean => {\n const lines = pipe(Str.split(\"\\n\")(text), Arr.map(Str.trim), Arr.filter(isCommand));\n return lines.length > ONE_COMMAND || pipe(lines, Arr.some(chainsCommands));\n};\n\nconst problemsIn =\n (file: string) =>\n (source: string): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n runScriptsOf(source),\n Arr.filter(runsMoreThanOneCommand),\n Arr.map(({ start }) => ({ file, ...at(start), rule: RULE, message: MESSAGE })),\n );\n };\n\n/** @internal */\nexport const checkWorkflows = Effect.fn(\"checkWorkflows\")(function* checkWorkflows(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const workflows = pipe(\n names,\n Arr.filter((name) => WORKFLOW_FILE.test(name)),\n );\n const found = yield* Effect.forEach(\n workflows,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map((text) =>\n pipe(\n text,\n Option.map(problemsIn(file)),\n Option.getOrElse(() => []),\n ),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkShellScripts } from \"./shell-scripts.ts\";\nimport { checkWorkflows } from \"./workflows.ts\";\n\n/** @internal */\nexport const checkScripts = Effect.fn(\"checkScripts\")(function* checkScripts(root: string) {\n const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","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 \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/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\nexport const 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\nexport const 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\nexport const 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","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 \"#/shared/lib/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 \"#/shared/lib/compiler.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n NODE_MODULES_SEGMENT,\n symbolAt,\n} from \"#/shared/lib/syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\n\nexport interface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\nexport interface 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\nexport const 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","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface 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\nexport interface 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\nexport const OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nexport const 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\nexport const 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\nexport const 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","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { declarationKey, locationOf } from \"#/entities/project/index.ts\";\nimport { isSatisfiesExpression, isVariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node } from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/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\nexport const 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","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport { declarationKey, describeLibraryType, isObjectType } from \"#/entities/project/index.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"#/entities/project/index.ts\";\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"#/shared/lib/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 \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf, isGenericDeclaration, isTypeDeclaration } from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf } from \"#/shared/lib/values.ts\";\n\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\n\nexport interface 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\nexport const 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","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 \"#/shared/lib/compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n childrenOf,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n} from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface 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\nexport const 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","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { describeLibraryType } from \"#/entities/project/index.ts\";\nimport type { LibraryVocabulary } from \"#/entities/project/index.ts\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"#/shared/lib/syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { Flow } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\n\nexport interface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\nexport interface 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\nexport const 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\nexport const 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","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport { isVariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node, VariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { contains, descendantsOf } from \"#/shared/lib/syntax.ts\";\n\nimport { flowsIn } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesUnder } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\nexport interface 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\nexport const 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","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { nearestManifestDirectory } from \"#/entities/project/index.ts\";\nimport type { ProjectInputs } from \"#/entities/project/index.ts\";\nimport { ProblemList } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst CACHE_DIRECTORY = [NODE_MODULES, \".cache\", \"msch\", \"value-owners\"] as const;\nconst CACHE_SUFFIX = \".json\";\nconst MANIFEST_ENTRY = \"package.json\";\nconst FINGERPRINTED = [\"src\", \"dist\"] as const;\nconst EMPTY = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nconst ValueSchema = Schema.Union([Schema.String, Schema.Finite]);\n\nconst UnownedSiteSchema = Schema.Struct({\n scope: Schema.Struct({ name: Schema.String, dependencies: Schema.Array(Schema.String) }),\n file: Schema.String,\n start: Schema.Int,\n line: Schema.Int,\n column: Schema.Int,\n values: Schema.Array(ValueSchema),\n});\n\nconst AnalysisSchema = Schema.Struct({\n problems: ProblemList,\n unowned: Schema.Array(UnownedSiteSchema),\n});\n\nconst AnalysisJson = Schema.fromJsonString(AnalysisSchema);\n\nexport type Analysis = typeof AnalysisSchema.Type;\n\nexport type Hasher = (text: string) => Effect.Effect<string>;\n\nexport type FileDigest = (file: string) => Effect.Effect<string, never, RepositoryFiles>;\n\nexport interface AnalysisCache {\n readonly root: string;\n readonly directory: string;\n readonly salt: string;\n readonly digestFile: FileDigest;\n readonly hash: Hasher;\n}\n\nconst hasher = Effect.gen(function* currentHasher() {\n const files = yield* RepositoryFiles;\n const hash: Hasher = files.hash;\n return hash;\n});\n\nconst entryOf = (file: string, found: string): string => `${file}${FIELD_SEPARATOR}${found}`;\n\nconst fileDigest = (hash: Hasher): FileDigest => {\n const digests = new Map<string, string>();\n return (file) =>\n Option.match(Option.fromUndefinedOr(digests.get(file)), {\n onSome: Effect.succeed,\n onNone: () =>\n Effect.gen(function* readDigest() {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const found = yield* hash(Option.getOrElse(text, () => EMPTY));\n digests.set(file, found);\n return found;\n }),\n });\n};\n\nconst digestEntries =\n (digestFile: FileDigest) =>\n (\n named: readonly (readonly [string, string])[],\n ): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n pipe(\n named,\n Effect.forEach(([name, file]) =>\n digestFile(file).pipe(Effect.map((found) => entryOf(name, found))),\n ),\n );\n\nconst fingerprintedFiles = Effect.fn(\"fingerprintedFiles\")(function* fingerprintedFiles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const nested = yield* pipe(\n FINGERPRINTED,\n Effect.forEach((entry) => {\n const base = files.join(root, entry);\n return files.walkDirectory(base).pipe(Effect.map(Arr.map((file) => files.join(base, file))));\n }),\n );\n return Arr.sort([files.join(root, MANIFEST_ENTRY), ...Arr.flatten(nested)], Str.Order);\n});\n\nconst fingerprintOf = Effect.fn(\"fingerprintOf\")(function* fingerprintOf(hash: Hasher) {\n const root = yield* nearestManifestDirectory(import.meta.dirname);\n const listed = yield* fingerprintedFiles(root);\n const entries = yield* digestEntries(fileDigest(hash))(\n pipe(\n listed,\n Arr.map((file) => [file, file] as const),\n ),\n );\n return yield* hash(Arr.join(entries, LINE_SEPARATOR));\n});\n\nexport const analysisCache = Effect.fn(\"analysisCache\")(function* analysisCache(\n root: string,\n owners: string,\n) {\n const files = yield* RepositoryFiles;\n const hash = yield* hasher;\n const fingerprint = yield* fingerprintOf(hash);\n const salt = yield* hash(Arr.join([fingerprint, owners], FIELD_SEPARATOR));\n return {\n root,\n directory: files.join(root, ...CACHE_DIRECTORY),\n salt,\n digestFile: fileDigest(hash),\n hash,\n } satisfies AnalysisCache;\n});\n\nexport const keyOf =\n (cache: AnalysisCache) =>\n (configPath: string, inputs: ProjectInputs): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* deriveKey() {\n const files = yield* RepositoryFiles;\n const entries = yield* digestEntries(cache.digestFile)(\n pipe(\n inputs.files,\n Arr.map((file) => [file, files.join(cache.root, file)] as const),\n ),\n );\n const header = [cache.salt, files.relative(cache.root, configPath), inputs.options];\n return yield* cache.hash(\n Arr.join([...header, ...inputs.dependencies, ...entries], LINE_SEPARATOR),\n );\n });\n\nconst entryFile = (cache: AnalysisCache, key: string): string =>\n `${cache.directory}/${key}${CACHE_SUFFIX}`;\n\nexport const readAnalysis =\n (cache: AnalysisCache) =>\n (key: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* readCached() {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(entryFile(cache, key));\n return yield* Option.match(text, {\n onNone: () => Effect.succeedNone,\n onSome: (found) => Schema.decodeEffect(AnalysisJson)(found).pipe(Effect.option),\n });\n });\n\nexport const writeAnalysis =\n (cache: AnalysisCache) =>\n (key: string, analysis: Analysis): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* writeCached() {\n const files = yield* RepositoryFiles;\n const text = yield* Schema.encodeEffect(AnalysisJson)(analysis).pipe(Effect.option);\n yield* Option.match(text, {\n onNone: () => Effect.void,\n onSome: (found) => files.writeFile(entryFile(cache, key), found),\n });\n });\n\nexport const pruneAnalyses =\n (cache: AnalysisCache) =>\n (kept: readonly string[]): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* pruneCached() {\n const files = yield* RepositoryFiles;\n const keep = new Set(\n pipe(\n kept,\n Arr.map((key) => `${key}${CACHE_SUFFIX}`),\n ),\n );\n const present = yield* files.readDirectory(cache.directory);\n yield* pipe(\n present,\n Arr.filter((name) => !keep.has(name)),\n Effect.forEach((name) => files.removeFile(files.join(cache.directory, name))),\n Effect.asVoid,\n );\n });\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { formatValues, valueKey } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\n\nexport interface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\nexport interface 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\nexport const 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\nexport const 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","import { Effect, Option, Schema, Array as Arr, pipe } from \"effect\";\n\nimport {\n listConfigFiles,\n mentions,\n projectInputs,\n typeScriptCompiler,\n withProject,\n} from \"#/entities/project/index.ts\";\nimport type { Project, Workspace } from \"#/entities/project/index.ts\";\nimport { sortProblems } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport { analysisCache, keyOf, pruneAnalyses, readAnalysis, writeAnalysis } from \"./cache.ts\";\nimport type { Analysis, AnalysisCache } from \"./cache.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.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 Context {\n readonly workspace: Workspace;\n readonly owners: readonly Owner[];\n readonly cache: AnalysisCache;\n readonly listed: readonly string[];\n}\n\nconst freshAnalysis =\n ({ workspace, owners }: Context) =>\n (configPath: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\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\nconst keyedAnalysis =\n (context: Context) =>\n (\n configPath: string,\n key: string,\n ): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* lookupAnalysis() {\n const cached = yield* readAnalysis(context.cache)(key);\n if (Option.isSome(cached)) {\n return cached;\n }\n const fresh = yield* freshAnalysis(context)(configPath);\n yield* Option.match(fresh, {\n onNone: () => Effect.void,\n onSome: (analysis) => writeAnalysis(context.cache)(key, analysis),\n });\n return fresh;\n });\n\nconst analyzeConfig =\n (context: Context) =>\n (\n configPath: string,\n ): Effect.Effect<Option.Option<readonly [string, Analysis]>, never, RepositoryFiles> =>\n Effect.gen(function* analyzeOne() {\n const inputs = yield* projectInputs(context)(configPath);\n if (Option.isNone(inputs)) {\n return Option.none();\n }\n const key = yield* keyOf(context.cache)(configPath, inputs.value);\n const analysis = yield* keyedAnalysis(context)(configPath, key);\n return pipe(\n analysis,\n Option.map((found) => [key, found] as const),\n );\n });\n\nconst encodeOwners = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst cacheFor = Effect.fn(\"cacheFor\")(function* cacheFor(root: string, owners: readonly Owner[]) {\n const plain = pipe(\n owners,\n Arr.map((owner) => ({ ...owner, packageName: Option.getOrNull(owner.packageName) })),\n );\n const encoded = yield* encodeOwners(plain).pipe(Effect.orElseSucceed(() => \"\"));\n return yield* analysisCache(root, encoded);\n});\n\nconst analyzeProjects = Effect.fn(\"analyzeProjects\")(function* analyzeProjects(\n workspace: Workspace,\n owners: readonly Owner[],\n configPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const cache = yield* cacheFor(workspace.root, owners);\n const listed = yield* files.listedFiles(workspace.root);\n const keyed = yield* pipe(\n configPaths,\n Effect.forEach(analyzeConfig({ workspace, owners, cache, listed })),\n );\n const found = Arr.getSomes(keyed);\n yield* pruneAnalyses(cache)(\n pipe(\n found,\n Arr.map(([key]) => key),\n ),\n );\n return pipe(\n found,\n Arr.map(([, analysis]) => analysis),\n );\n});\n\nexport const checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(\n root: string,\n) {\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","import { Schema, String as Str } from \"effect\";\nimport type { Effect } from \"effect\";\n\nexport interface FoundComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport type Found = Effect.Effect<readonly FoundComment[], CommentsUnreadable>;\n\nconst taggedError = Schema.TaggedError;\n\nexport class CommentsUnreadable extends taggedError<\n CommentsUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentsUnreadable\", { reader: Schema.String, message: Schema.String }) {}\n\nexport const unreadable =\n (reader: string) =>\n (cause: unknown): CommentsUnreadable =>\n CommentsUnreadable.make({ reader, message: String(cause) });\n\nexport const trimmed = ({ index, text }: FoundComment): FoundComment => ({\n index,\n text: Str.trimEnd(text),\n});\n","import { DockerfileParser } from \"dockerfile-ast\";\nimport { Array as Arr, Effect, Number as Num, Record as Rec, String as Str, pipe } from \"effect\";\nimport { parse as parseSql } from \"sql-parser-cst\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { Parser as YamlParser } from \"yaml\";\n\nimport { trimmed, unreadable } from \"./found-comment.ts\";\nimport type { Found } from \"./found-comment.ts\";\n\nconst NEXT = 1;\n\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null;\n\nconst childrenOf = (value: unknown): readonly unknown[] => {\n if (Arr.isArray(value)) {\n return value;\n }\n if (isRecord(value)) {\n return Rec.values(value);\n }\n return [];\n};\n\nconst collect =\n <Item>(isItem: (value: unknown) => value is Item) =>\n (value: unknown): readonly Item[] => {\n if (isItem(value)) {\n return [value];\n }\n return pipe(childrenOf(value), Arr.flatMap(collect(isItem)));\n };\n\ninterface YamlSourceToken {\n readonly offset: number;\n readonly source: string;\n}\n\nconst isYamlComment = (value: unknown): value is YamlSourceToken =>\n isRecord(value) &&\n value[\"type\"] === \"comment\" &&\n typeof value[\"offset\"] === \"number\" &&\n typeof value[\"source\"] === \"string\";\n\nexport const yamlComments = (source: string): Found =>\n Effect.try({\n try: () =>\n pipe(\n Arr.fromIterable(new YamlParser().parse(source)),\n Arr.flatMap(collect(isYamlComment)),\n Arr.map((token) => trimmed({ index: token.offset, text: token.source })),\n ),\n catch: unreadable(\"yaml\"),\n });\n\nexport const tomlComments = (source: string): Found =>\n Effect.try({\n try: () =>\n pipe(\n parseTOML(source).comments,\n Arr.map(({ range: [start, end] }) =>\n trimmed({ index: start, text: Str.slice(start, end)(source) }),\n ),\n ),\n catch: unreadable(\"toml\"),\n });\n\ninterface SqlComment {\n readonly text: string;\n readonly range: readonly [number, number];\n}\n\nconst isSqlComment = (value: unknown): value is SqlComment =>\n isRecord(value) &&\n (value[\"type\"] === \"line_comment\" || value[\"type\"] === \"block_comment\") &&\n typeof value[\"text\"] === \"string\" &&\n Arr.isArray(value[\"range\"]);\n\nexport const sqlComments = (source: string): Found =>\n Effect.try({\n try: () => {\n const program = parseSql(source, {\n dialect: \"sqlite\",\n includeComments: true,\n includeRange: true,\n paramTypes: [],\n });\n return pipe(\n collect(isSqlComment)(program),\n Arr.map(({ range: [start], text }) => trimmed({ index: start, text })),\n );\n },\n catch: unreadable(\"sql\"),\n });\n\nconst offsetAt =\n (lines: readonly string[]) =>\n ({ line, character }: Readonly<{ line: number; character: number }>): number =>\n character +\n pipe(\n lines,\n Arr.take(line),\n Arr.map((text) => text.length + NEXT),\n Num.sumAll,\n );\n\nexport const dockerfileComments = (source: string): Found =>\n Effect.try({\n try: () => {\n const lines = Str.split(source, \"\\n\");\n return pipe(\n DockerfileParser.parse(source).getComments(),\n Arr.map((comment) =>\n trimmed({\n index: offsetAt(lines)(comment.getRange().start),\n text: comment.toString(),\n }),\n ),\n );\n },\n catch: unreadable(\"dockerfile\"),\n });\n","import { fileURLToPath } from \"node:url\";\n\nimport treeSitter from \"@vscode/tree-sitter-wasm\";\nimport { isComment, isTag, isText } from \"domhandler\";\nimport type { AnyNode, Text } from \"domhandler\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport { DomUtils, parseDocument } from \"htmlparser2\";\n\nimport { dockerfileComments, sqlComments, tomlComments, yamlComments } from \"./config-comments.ts\";\nimport { trimmed, unreadable } from \"./found-comment.ts\";\nimport type { CommentsUnreadable, Found, FoundComment } from \"./found-comment.ts\";\n\nconst GRAMMARS = [\n \"bash\",\n \"c-sharp\",\n \"cpp\",\n \"css\",\n \"go\",\n \"java\",\n \"javascript\",\n \"php\",\n \"powershell\",\n \"ruby\",\n \"rust\",\n \"tsx\",\n \"typescript\",\n] as const;\n\nexport type Grammar = (typeof GRAMMARS)[number];\n\nexport type Markup = \"html\" | \"xml\";\n\nexport type Reader = Grammar | Markup | \"yaml\" | \"toml\" | \"sql\" | \"dockerfile\";\n\nexport type Grammars = (grammar: Grammar) => Option.Option<treeSitter.Language>;\n\nconst COMMENT_NODES = [\"comment\", \"line_comment\", \"block_comment\", \"multiline_comment\"];\nconst START = 0;\nconst NEXT = 1;\nconst NONE: readonly FoundComment[] = [];\n\nconst grammarFile = (grammar: Grammar): string =>\n fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));\n\nconst loadGrammar = (\n grammar: Grammar,\n): Effect.Effect<readonly [Grammar, treeSitter.Language], CommentsUnreadable> =>\n Effect.tryPromise({\n try: () => treeSitter.Language.load(grammarFile(grammar)),\n catch: unreadable(grammar),\n }).pipe(Effect.map((language) => [grammar, language] as const));\n\nexport const loadGrammars = Effect.fn(\"loadGrammars\")(function* loadGrammars() {\n yield* Effect.tryPromise({\n try: () => treeSitter.Parser.init(),\n catch: unreadable(\"javascript\"),\n });\n const loaded = yield* pipe(\n GRAMMARS,\n Effect.forEach((grammar) => loadGrammar(grammar)),\n );\n const languages = Rec.fromEntries(loaded);\n const grammars: Grammars = (grammar) => Rec.get(languages, grammar);\n return grammars;\n});\n\nconst commentNodesIn = (language: treeSitter.Language, source: string): readonly FoundComment[] => {\n const parser = new treeSitter.Parser();\n parser.setLanguage(language);\n const tree = parser.parse(source);\n parser.delete();\n if (tree === null) {\n return NONE;\n }\n const found = pipe(\n tree.rootNode.descendantsOfType(COMMENT_NODES),\n Arr.flatMap((node) => Option.toArray(Option.fromNullishOr(node))),\n Arr.map((node) => trimmed({ index: node.startIndex, text: node.text })),\n );\n tree.delete();\n return found;\n};\n\nconst syntaxComments =\n (grammars: Grammars, grammar: Grammar) =>\n (source: string): Found =>\n Option.match(grammars(grammar), {\n onNone: () => Effect.fail(unreadable(grammar)(\"the grammar is not loaded\")),\n onSome: (language) =>\n Effect.try({ try: () => commentNodesIn(language, source), catch: unreadable(grammar) }),\n });\n\nconst SCRIPT_TYPE = /^(?:|module|text\\/javascript|application\\/javascript)$/iu;\nconst SHADER_TYPE = /shader|glsl/iu;\n\ninterface EmbeddingTag {\n readonly name: string;\n readonly attribs: Readonly<Record<string, string>>;\n}\n\nconst scriptGrammar = (attribs: EmbeddingTag[\"attribs\"]): Option.Option<Grammar> => {\n const type = Str.trim(Option.getOrElse(Rec.get(attribs, \"type\"), () => \"\"));\n if (Rec.get(attribs, \"lang\").pipe(Option.contains(\"ts\"))) {\n return Option.some<Grammar>(\"typescript\");\n }\n if (SHADER_TYPE.test(type)) {\n return Option.some<Grammar>(\"cpp\");\n }\n return Option.liftPredicate<Grammar>(\"javascript\", () => SCRIPT_TYPE.test(type));\n};\n\nconst embeddedGrammar = ({ name, attribs }: EmbeddingTag): Option.Option<Grammar> => {\n if (name === \"style\") {\n return Option.some<Grammar>(\"css\");\n }\n if (name === \"script\") {\n return scriptGrammar(attribs);\n }\n return Option.none();\n};\n\nconst shifted =\n (offset: number) =>\n ({ index, text }: FoundComment): FoundComment => ({ index: index + offset, text });\n\nconst markupComment =\n (source: string) =>\n (node: AnyNode): readonly FoundComment[] => {\n if (!isComment(node) || node.startIndex === null || node.endIndex === null) {\n return NONE;\n }\n return [\n { index: node.startIndex, text: Str.slice(node.startIndex, node.endIndex + NEXT)(source) },\n ];\n };\n\nconst textComments =\n (grammars: Grammars, grammar: Grammar) =>\n (text: Text): Found => {\n const shift = shifted(text.startIndex ?? START);\n return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Arr.map(shift)));\n };\n\nconst embeddedComments =\n (grammars: Grammars) =>\n (node: AnyNode): Found => {\n if (!isTag(node)) {\n return Effect.succeed(NONE);\n }\n const texts = pipe(node.children, Arr.filter(isText));\n return Option.match(embeddedGrammar(node), {\n onNone: () => Effect.succeed(NONE),\n onSome: (grammar) =>\n pipe(texts, Effect.forEach(textComments(grammars, grammar)), Effect.map(Arr.flatten)),\n });\n };\n\nconst markupComments =\n (grammars: Grammars, markup: Markup) =>\n (source: string): Found =>\n Effect.gen(function* readMarkup() {\n const document = parseDocument(source, {\n xmlMode: markup === \"xml\",\n withStartIndices: true,\n withEndIndices: true,\n });\n const nodes = DomUtils.filter(() => true, document.children, true);\n const own = pipe(nodes, Arr.flatMap(markupComment(source)));\n if (markup === \"xml\") {\n return own;\n }\n const embedded = yield* pipe(nodes, Effect.forEach(embeddedComments(grammars)));\n return [...own, ...Arr.flatten(embedded)];\n });\n\nconst isGrammar = (reader: Reader): reader is Grammar => pipe(GRAMMARS, Arr.contains(reader));\n\nexport const commentsWith =\n (grammars: Grammars) =>\n (reader: Reader, source: string): Found => {\n if (isGrammar(reader)) {\n return syntaxComments(grammars, reader)(source);\n }\n const readers = {\n html: markupComments(grammars, \"html\"),\n xml: markupComments(grammars, \"xml\"),\n yaml: yamlComments,\n toml: tomlComments,\n sql: sqlComments,\n dockerfile: dockerfileComments,\n } satisfies Record<Exclude<Reader, Grammar>, (text: string) => Found>;\n return readers[reader](source);\n };\n","import path from \"node:path\";\n\nimport {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Predicate,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { COMMENT_DIRECTIVES } from \"#/shared/lib/comment-directives.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { commentsWith, loadGrammars } from \"./comment-readers.ts\";\nimport type { Reader } from \"./comment-readers.ts\";\nimport type { FoundComment } from \"./found-comment.ts\";\n\nconst RULE: RuleName = \"comment\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst VENDORED_PATHSPEC = \":(attr:linguist-vendored)\";\nconst READ_CONCURRENCY = 64;\nconst START = 0;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\n\nconst READERS: readonly (readonly [RegExp, Reader])[] = [\n [/\\.(?:[cm]?jsx?)$/u, \"javascript\"],\n [/\\.(?:[cm]?ts)$/u, \"typescript\"],\n [/\\.tsx$/u, \"tsx\"],\n [/\\.rs$/u, \"rust\"],\n [/\\.(?:cs|csx)$/u, \"c-sharp\"],\n [/\\.(?:sh|bash|zsh|ksh)$/u, \"bash\"],\n [/(?:^|\\/)\\.(?:vite-hooks|husky|githooks)\\/[^./][^/]*$/u, \"bash\"],\n [/\\.(?:ps1|psm1|psd1)$/u, \"powershell\"],\n [/\\.go$/u, \"go\"],\n [/\\.(?:java|kt|kts)$/u, \"java\"],\n [/\\.(?:rb|rake)$/u, \"ruby\"],\n [/\\.php$/u, \"php\"],\n [/\\.(?:c|h|cc|cpp|cxx|hpp|hh|m|mm|glsl|frag|vert|comp|wgsl|hlsl|metal)$/u, \"cpp\"],\n [/\\.(?:css|pcss)$/u, \"css\"],\n [/\\.(?:html?|vue|svelte|astro)$/u, \"html\"],\n [/\\.(?:xml|xaml|plist|resx|props|targets|[a-z]+proj|manifest|nuspec)$/u, \"xml\"],\n [/\\.ya?ml$/u, \"yaml\"],\n [/\\.toml$/u, \"toml\"],\n [/\\.sql$/u, \"sql\"],\n [/(?:^|\\/)(?:Dockerfile|Containerfile)(?:\\.[^/]+)?$|\\.dockerfile$/u, \"dockerfile\"],\n];\n\nconst SHEBANG_READERS: readonly (readonly [RegExp, Reader])[] = [\n [/^#!.*\\b(?:ba|z|k|da)?sh\\b/u, \"bash\"],\n [/^#!.*\\b(?:node|bun|deno|tsx)\\b/u, \"javascript\"],\n [/^#!.*\\bpwsh\\b/u, \"powershell\"],\n];\n\nconst SHEBANG = \"#!\";\nconst PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\\s*$/u;\nconst VERSION = /^\\s?v?\\d[\\w.+-]*$/u;\nconst DELIMITERS = /^(?:\\/\\/|\\/\\*|<!--|<#|#|--)|(?:\\*\\/|-->|#>)$/gu;\nconst MESSAGE =\n \"Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.\";\n\nconst Patterns = Schema.Array(Schema.String);\nconst CommentSettings = Schema.Struct({ allow: Patterns });\nconst MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });\nconst LintSettings = Schema.Struct({ ignorePatterns: Schema.optional(Patterns) });\n\nconst RootConfig = Schema.Struct({\n msch: Schema.optional(MschSettings),\n lint: Schema.optional(LintSettings),\n});\n\ntype RootConfigType = typeof RootConfig.Type;\n\ninterface RootSettings {\n readonly allow: readonly string[];\n readonly ignorePatterns: readonly string[];\n}\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst NO_SETTINGS: RootSettings = { allow: [], ignorePatterns: [] };\nconst NONE: readonly Problem[] = [];\n\nconst taggedError = Schema.TaggedError;\n\nclass CommentConfigUnreadable extends taggedError<\n CommentConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentConfigUnreadable\", { file: Schema.String }) {}\n\nconst shebangReader = (source: string): Option.Option<readonly [RegExp, Reader]> => {\n if (!Str.startsWith(SHEBANG)(source)) {\n return Option.none();\n }\n return pipe(\n SHEBANG_READERS,\n Arr.findFirst(([pattern]) => pattern.test(source)),\n );\n};\n\nconst readerOf = (name: string, source: string): Option.Option<Reader> =>\n pipe(\n READERS,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.orElse(() => shebangReader(source)),\n Option.map(([, reader]) => reader),\n );\n\nconst valueOf = (text: string): string => Str.replaceAll(DELIMITERS, \"\")(text);\n\nconst lineBefore = (source: string, index: number): string => {\n const lines = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return Option.getOrElse(Arr.last(lines), () => \"\");\n};\n\nconst isPinVersion = (source: string, { index, text }: FoundComment): boolean =>\n PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));\n\nconst isShebang = ({ index, text }: FoundComment): boolean =>\n index === START && Str.startsWith(SHEBANG)(text);\n\nconst isAllowed =\n (source: string, directives: RegExp) =>\n (comment: FoundComment): boolean =>\n isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);\n\nconst problemOf =\n (file: string, source: string) =>\n ({ index }: FoundComment): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: MESSAGE,\n });\n\nconst unreadableProblem = (file: string, message: string): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: RULE,\n message: `msch could not read the comments in this file: ${message}`,\n});\n\nconst settingsOf = ({ msch, lint }: RootConfigType): RootSettings => ({\n allow: pipe(\n Option.fromUndefinedOr(msch),\n Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)),\n Option.match({ onNone: () => NO_SETTINGS.allow, onSome: ({ allow }) => allow }),\n ),\n ignorePatterns: pipe(\n Option.fromUndefinedOr(lint),\n Option.flatMap(({ ignorePatterns }) => Option.fromUndefinedOr(ignorePatterns)),\n Option.getOrElse(() => NO_SETTINGS.ignorePatterns),\n ),\n});\n\nconst rootSettings = Effect.fn(\"rootSettings\")(function* rootSettings(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return NO_SETTINGS;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => CommentConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(\n config,\n Option.flatMap(Schema.decodeUnknownOption(RootConfig)),\n Option.match({ onNone: () => NO_SETTINGS, onSome: settingsOf }),\n );\n});\n\nconst directivePattern = (directives: readonly string[]): RegExp =>\n new RegExp(String.raw`^\\s?(?:${Arr.join(directives, \"|\")})`, \"u\");\n\nconst isIgnored =\n (patterns: readonly string[]) =>\n (name: string): boolean =>\n pipe(\n patterns,\n Arr.some((pattern) => path.matchesGlob(name, pattern)),\n );\n\nconst scannedFiles = Effect.fn(\"scannedFiles\")(function* scannedFiles(\n root: string,\n settings: RootSettings,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const generated = yield* files.generatedFiles(root);\n const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);\n const skipped = HashSet.fromIterable([\n ...generated,\n ...pipe(\n vendored,\n Arr.map((name) => files.join(root, name)),\n ),\n ]);\n return pipe(\n listed,\n Arr.filter((name) => !isIgnored(settings.ignorePatterns)(name)),\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n Arr.filter(({ file }) => !HashSet.has(skipped, file)),\n );\n});\n\n/** @internal */\nexport const checkComments = Effect.fn(\"checkComments\")(function* checkComments(root: string) {\n const files = yield* RepositoryFiles;\n const settings = yield* rootSettings(root);\n const scanned = yield* scannedFiles(root, settings);\n const directives = directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]);\n const grammars = yield* loadGrammars();\n const comments = commentsWith(grammars);\n const problemsIn = (\n { name, file }: Listed,\n source: string,\n ): Effect.Effect<readonly Problem[]> => {\n const kept = Predicate.not(isAllowed(source, directives));\n const toProblem = problemOf(file, source);\n return Option.match(readerOf(name, source), {\n onNone: () => Effect.succeed(NONE),\n onSome: (reader) =>\n comments(reader, source).pipe(\n Effect.map(Arr.filter(kept)),\n Effect.map(Arr.map(toProblem)),\n Effect.catchTag(\"CommentsUnreadable\", ({ message }) =>\n Effect.succeed([unreadableProblem(file, message)]),\n ),\n ),\n });\n };\n const found = yield* Effect.forEach(\n scanned,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.succeed(NONE),\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/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 */\nexport const 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","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\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 READ_CONCURRENCY = 64;\n\nexport interface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nexport const isScannedText = ({ name }: Listed): boolean =>\n SCANNED_FILE.test(name) && !LOCKFILE.test(name);\n\nexport const isToolVersions = ({ name }: Listed): boolean => TOOL_VERSIONS.test(name);\n\n/** @internal */\nexport const listedFiles = Effect.fn(\"listedFiles\")(function* listedFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n});\n\n/** @internal */\nexport const presentFiles = Effect.fn(\"presentFiles\")(function* presentFiles(\n listed: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n listed,\n Effect.filter(({ file }) => files.exists(file)),\n );\n});\n\n/** @internal */\nexport const scanText = Effect.fn(\"scanText\")(function* scanText(\n listed: readonly Listed[],\n problemsIn: (entry: Listed, source: string) => readonly Problem[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n listed,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/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 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 FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"python-file\";\nconst COMMAND_RULE: RuleName = \"python-command\";\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 = (entry: Listed): readonly RegExp[] => {\n if (isToolVersions(entry)) {\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),\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 => !isPython(entry) && isScannedText(entry);\n\n/** @internal */\nexport const checkPython = Effect.fn(\"checkPython\")(function* checkPython(root: string) {\n const listed = yield* listedFiles(root);\n const scanned = yield* scanText(pipe(listed, Arr.filter(isScanned)), commandProblems);\n const present = yield* presentFiles(pipe(listed, Arr.filter(isPython)));\n return [...pipe(present, Arr.map(fileProblem)), ...scanned];\n});\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst PNPM_DIRECTORY = \".pnpm/\";\nconst SEPARATOR = \"/\";\n\nconst FOREIGN_LOCKFILE =\n /(?:^|\\/)(?:package-lock\\.json|npm-shrinkwrap\\.json|yarn\\.lock|bun\\.lockb?)$/u;\nconst CARGO_MANIFEST_FILE = /(?:^|\\/)Cargo\\.toml$/u;\nconst CARGO_LOCK_FILE = /(?:^|\\/)Cargo\\.lock$/u;\nconst PNPM_OUTPUT = /(?:^|\\/)\\.pnpm\\//u;\nconst CARGO_WORKSPACE = /^\\[workspace\\]/mu;\nconst LEGACY_CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config$/u;\nconst CARGO_CONFIG_FILE = /(?:^|\\/)\\.cargo\\/config\\.toml$/u;\nconst PNPM_CARGO_START = /# >>> pnpm-managed cargo sources >>>/u;\nconst PNPM_CARGO_BLOCK =\n /# >>> pnpm-managed cargo sources >>>[\\s\\S]*?# <<< pnpm-managed cargo sources <<<\\n?/gu;\n\nconst SETUP_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])rustup[ \\t]+(?:toolchain[ \\t]+install|install|update|default|override[ \\t]+set|target[ \\t]+add|component[ \\t]+add)\\b/gu,\n /(?<![\\w./@-])cargo[ \\t]+(?:vendor|fetch)\\b/gu,\n /\\buses:\\s*[\"']?(?:dtolnay\\/rust-toolchain|actions-rust-lang\\/setup-rust-toolchain|actions-rs\\/toolchain|moonrepo\\/setup-rust)\\b/gu,\n];\n\nconst INSTALL_PATTERNS: readonly RegExp[] = [/(?<![\\w./@-])cargo[ \\t]+b?install\\b/gu];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:rust|rustup)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst START = 0;\nconst LAST_SEGMENT = 1;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"unneeded-file\";\nconst SETUP_RULE: RuleName = \"unneeded-setup\";\nconst CARGO_RULE: RuleName = \"cargo-outside-pnpm\";\n\nconst CargoSettings = Schema.Struct({ enabled: Schema.optionalKey(Schema.Boolean) });\nconst WorkspaceFile = Schema.Struct({ cargo: Schema.optionalKey(CargoSettings) });\nconst decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);\n\nconst cargoEnabled = (text: string): boolean =>\n pipe(\n decodeWorkspaceFile(parse(text)),\n Option.flatMap(({ cargo }) => Option.fromUndefinedOr(cargo)),\n Option.flatMap(({ enabled }) => Option.fromUndefinedOr(enabled)),\n Option.getOrElse(() => false),\n );\n\nconst problemAtStart =\n (rule: RuleName, message: string) =>\n ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule,\n message,\n });\n\nconst foreignLockfile = problemAtStart(\n FILE_RULE,\n \"pnpm-lock.yaml is this repository's lockfile, and pnpm never reads this one. Delete it.\",\n);\n\nconst nestedCargoLock = problemAtStart(\n FILE_RULE,\n \"Cargo reads only the Cargo.lock beside the workspace's Cargo.toml, and pnpm install writes that one. Delete this one.\",\n);\n\nconst legacyCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .cargo/config.toml, and Cargo warns when .cargo/config sits beside it. Move its settings into .cargo/config.toml and delete it.\",\n);\n\nconst pnpmOutput = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .pnpm/ from Cargo.lock and rust-toolchain.toml. Add this .pnpm directory to .gitignore and keep it out of the repository.\",\n);\n\nconst pnpmCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes this .cargo/config.toml, and it holds nothing else. Add /.cargo/config.toml to .gitignore and keep it out of the repository.\",\n);\n\nconst generatedCargoConfig = (entry: Listed, source: string): readonly Problem[] => {\n if (!CARGO_CONFIG_FILE.test(entry.name) || !PNPM_CARGO_START.test(source)) {\n return [];\n }\n if (Str.isNonEmpty(Str.trim(Str.replaceAll(PNPM_CARGO_BLOCK, \"\")(source)))) {\n return [];\n }\n return [pnpmCargoConfig(entry)];\n};\n\nconst cargoOutsidePnpm = problemAtStart(\n CARGO_RULE,\n `pnpm does not manage these crates. Set \\`cargo: { enabled: true }\\` in ${WORKSPACE_FILE} so pnpm install fetches the crates and the Rust toolchain.`,\n);\n\nconst setupProblem =\n ({ file }: Listed, source: string, advice: (command: string) => string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: SETUP_RULE,\n message: advice(Str.trim(found[WHOLE_MATCH])),\n });\n\nconst removeSetup = (command: string): string =>\n `pnpm install already installs the toolchain in rust-toolchain.toml and vendors the crates in Cargo.lock. Remove \\`${command}\\`.`;\n\nconst buildInstead = (command: string): string =>\n `\\`${command}\\` fetches crates that pnpm does not vendor. Add the tool as a dependency of a Cargo workspace that pnpm vendors, and build its binary there with \\`cargo build -p <crate> --bin <name>\\`.`;\n\nconst setupPatternsFor = (entry: Listed): readonly RegExp[] => {\n if (isToolVersions(entry)) {\n return [...SETUP_PATTERNS, ...TOOL_PATTERNS];\n }\n return SETUP_PATTERNS;\n};\n\nconst matchesOf =\n (source: string) =>\n (patterns: readonly RegExp[]): readonly RegExpMatchArray[] =>\n pipe(\n patterns,\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n );\n\nconst setupProblems = (entry: Listed, source: string): readonly Problem[] => {\n const found = matchesOf(source);\n const installs = pipe(\n found(INSTALL_PATTERNS),\n Arr.map(setupProblem(entry, source, buildInstead)),\n );\n return pipe(\n found(setupPatternsFor(entry)),\n Arr.map(setupProblem(entry, source, removeSetup)),\n Arr.appendAll(installs),\n Arr.appendAll(generatedCargoConfig(entry, source)),\n );\n};\n\nconst matches =\n (pattern: RegExp) =>\n ({ name }: Listed): boolean =>\n pattern.test(name);\n\nconst isCargoManifest = matches(CARGO_MANIFEST_FILE);\nconst isForeignLockfile = matches(FOREIGN_LOCKFILE);\nconst isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);\nconst isPnpmOutput = matches(PNPM_OUTPUT);\n\nconst directoryOf = (name: string): string =>\n pipe(Str.split(name, SEPARATOR), Arr.dropRight(LAST_SEGMENT), Arr.join(SEPARATOR));\n\nconst ancestorsOf = (directory: string): readonly string[] => {\n const parts = Str.split(directory, SEPARATOR);\n return pipe(\n Arr.makeBy(parts.length, (depth) => Arr.join(Arr.take(parts, depth), SEPARATOR)),\n Arr.filter((ancestor) => ancestor !== directory),\n );\n};\n\nconst readsCargoLock =\n (manifests: readonly string[], workspaces: readonly string[]) =>\n ({ name }: Listed): boolean => {\n const directory = directoryOf(name);\n const insideWorkspace = pipe(\n ancestorsOf(directory),\n Arr.some((ancestor) => Arr.contains(workspaces, ancestor)),\n );\n return (\n Arr.contains(manifests, directory) &&\n (Arr.contains(workspaces, directory) || !insideWorkspace)\n );\n };\n\nconst isWorkspaceManifest = (source: Option.Option<string>): boolean =>\n Option.exists(source, (text) => CARGO_WORKSPACE.test(text));\n\nconst directoriesOf = (entries: readonly Listed[]): readonly string[] =>\n pipe(\n entries,\n Arr.map(({ name }) => directoryOf(name)),\n );\n\nconst cargoWorkspaces = Effect.fn(\"cargoWorkspaces\")(function* cargoWorkspaces(\n manifests: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n const roots = yield* pipe(\n manifests,\n Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))),\n );\n return directoriesOf(roots);\n});\n\nconst pnpmDirectoryOf = ({ name }: Listed): string =>\n pipe(\n name,\n Str.indexOf(PNPM_DIRECTORY),\n Option.getOrElse(() => START),\n (end) => Str.slice(START, end)(name),\n );\n\nconst pnpmOutputs = (present: readonly Listed[]): readonly Problem[] =>\n pipe(\n present,\n Arr.filter(isPnpmOutput),\n Arr.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)),\n Arr.map(pnpmOutput),\n );\n\nconst byDepth: Order.Order<Listed> = Order.mapInput(\n Order.Number,\n ({ name }: Listed) => Str.split(name, \"/\").length,\n);\n\nconst cargoProblems = (\n present: readonly Listed[],\n enabled: boolean,\n): Effect.Effect<readonly Problem[], never, RepositoryFiles> => {\n if (!enabled) {\n return Effect.succeed(\n pipe(\n present,\n Arr.filter(isCargoManifest),\n Arr.match({\n onEmpty: (): readonly Problem[] => [],\n onNonEmpty: (manifests) => [cargoOutsidePnpm(Arr.min(manifests, byDepth))],\n }),\n ),\n );\n }\n return Effect.gen(function* enabledCargoProblems() {\n const manifests = pipe(present, Arr.filter(isCargoManifest));\n const workspaces = yield* cargoWorkspaces(manifests);\n const reads = readsCargoLock(directoriesOf(manifests), workspaces);\n const setup = yield* scanText(pipe(present, Arr.filter(isScannedText)), setupProblems);\n return [\n ...pipe(\n present,\n Arr.filter((entry) => CARGO_LOCK_FILE.test(entry.name) && !reads(entry)),\n Arr.map(nestedCargoLock),\n ),\n ...pipe(present, Arr.filter(isLegacyCargoConfig), Arr.map(legacyCargoConfig)),\n ...pnpmOutputs(present),\n ...setup,\n ];\n });\n};\n\nconst unneededIn = Effect.fn(\"unneededIn\")(function* unneededIn(root: string, workspace: string) {\n const listed = yield* listedFiles(root);\n const present = yield* presentFiles(listed);\n const lockfiles = pipe(present, Arr.filter(isForeignLockfile), Arr.map(foreignLockfile));\n if (!pipe(present, Arr.some(isCargoManifest))) {\n return lockfiles;\n }\n const cargo = yield* cargoProblems(present, cargoEnabled(workspace));\n return [...lockfiles, ...cargo];\n});\n\n/** @internal */\nexport const checkUnneededFiles = Effect.fn(\"checkUnneededFiles\")(function* checkUnneededFiles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const workspace = yield* files.readFile(files.join(root, WORKSPACE_FILE));\n if (Option.isNone(workspace)) {\n return [];\n }\n return yield* unneededIn(root, workspace.value);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkComments } from \"#/features/comments/index.ts\";\nimport { checkHiddenUnicode } from \"#/features/invisible-characters/index.ts\";\nimport { checkPython } from \"#/features/python/index.ts\";\nimport { checkUnneededFiles } from \"#/features/unneeded-files/index.ts\";\n\n/** @internal */\nexport const checkTrackedText = Effect.fn(\"checkTrackedText\")(function* checkTrackedText(\n root: string,\n) {\n const found = yield* Effect.all(\n [checkHiddenUnicode(root), checkPython(root), checkUnneededFiles(root), checkComments(root)],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkPublishedPackages } from \"#/features/install-size/index.ts\";\nimport { checkOverrides } from \"#/features/overrides/index.ts\";\nimport { checkPlacement } from \"#/features/placement/index.ts\";\nimport { checkWorkspaces } from \"#/features/repository-layout/index.ts\";\nimport { checkScripts } from \"#/features/scripts/index.ts\";\nimport { checkRepository } from \"#/features/value-owners/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { checkTrackedText } from \"./tracked-text.ts\";\n\n/** @internal */\nexport const checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n | ReturnType<typeof checkWorkspaces>\n >,\n Effect.Services<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkRepository(root),\n checkOverrides(root),\n checkTrackedText(root),\n checkPlacement(root),\n checkScripts(root),\n checkPublishedPackages(root),\n checkWorkspaces(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const 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","import { runMain } from \"@effect/platform-node-shared/NodeRuntime\";\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 { nodeServicesLayer } from \"#/shared/lib/node-services.ts\";\nimport { nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.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\n/** @internal */\nexport const 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","#!/usr/bin/env node\nimport { Effect, Schema, Stdio, Array as Arr, pipe } from \"effect\";\n\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { checkAll } from \"./all-checks.ts\";\nimport { ProblemsFound, writeStdout } from \"./output.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":";;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CACpE;CACA,IAAI,OAAO,WAAW,MAAM,UAAU,OAAO,SAAS,kBACpD,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,KAAK,MAAM;AAC3B;AAEA,MAAa,kBAAkB,SAAgD;CAC7E,IAAI,CAAC,KAAK,YAAY,GACpB,OAAO,OAAO,KAAK;CAErB,OAAO,gBAAgB,KAAK,SAAS,CAAC;AACxC;AAEA,MAAM,iBAAiB,SAAkB,SAAoC;CAC3E,IAAI,CAAC,QAAQ,gBAAgB,IAAI,GAC/B,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,gBAAgB,QAAQ,mBAAmB,MAAM,UAAU,MAAM,CAAC;AAClF;AAEA,MAAa,gBACV,aACA,SACCA,MAAI,UAAU,yBAAyB,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I;CAChC;CACA,OAAO,OAAO,WAAW,MAAM,QAAQ;AACzC,CAEO,CAAI"}
1
+ {"version":3,"file":"cli.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","mentions","SEPARATOR","SCOPE_PREFIX","Arr","Str","closureOf","installedNames","START","FIRST_COLUMN","Str","Arr","WILDCARD","SEPARATOR","SCOPED_SEGMENTS","Str","Arr","Rec","EMPTY","decodeManifest","keysOf","Rec","Arr","childrenOf","Num","Str","START","Arr","Str","Num","Rec","problemsOf","keysOf","Arr","SCOPE_PREFIX","Arr","Rec","Str","packageOf","WORKSPACE_FILE","LOCKFILE","taggedError","textOf","Str","Arr","RULE","Arr","problemOf","READ_CONCURRENCY","FIRST","RULE","Str","problemFor","Arr","RULE","FIRST","READ_CONCURRENCY","SCRIPT","problemFor","groupsOf","Arr","Str","ownerOf","problemIn","RULE","CONFIG_FILE","SEPARATOR","FIRST","READ_CONCURRENCY","RootConfig","taggedError","Str","problemFor","problemIn","Arr","RULE","READ_CONCURRENCY","START","problemsIn","Arr","Str","Arr","RULE","CONFIG_FILE","SEPARATOR","FIRST","READ_CONCURRENCY","Arr","Str","problemFor","problemIn","RULE","CONFIG_FILE","FIRST","READ_CONCURRENCY","Arr","RULE","CONFIG_FILE","FIRST","NEXT","childrenOf","Arr","Str","problemsIn","RULE","READ_CONCURRENCY","commandText","Arr","Str","Rec","isText","Arr","SEPARATOR","QUOTED","Arr","Str","directoryOf","RULE","READ_CONCURRENCY","SEPARATOR","FIRST","Str","Arr","isIgnored","problemOf","problemsIn","Arr","READ_CONCURRENCY","RULE","MESSAGE","Arr","Str","READ_CONCURRENCY","Arr","RULE","START","MESSAGE","Str","Arr","problemsIn","Arr","Arr","Str","Arr","Arr","Str","Arr","Arr","Arr","childrenOf","Arr","Arr","Arr","Str","Arr","Rec","mentions","Arr","RULE","MESSAGE","Arr","taggedError","Str","NEXT","Arr","Rec","YamlParser","Str","parseSql","Num","START","NONE","Rec","Arr","Str","parseDocument","RULE","READ_CONCURRENCY","START","FIRST_LINE","FIRST_COLUMN","taggedError","Str","Arr","problemOf","START","READ_CONCURRENCY","Str","Arr","Arr","TOOL_PATTERNS","FIRST_LINE","FIRST_COLUMN","WHOLE_MATCH","FILE_RULE","Str","Arr","parse","Str","Arr","Arr","Arr","Arr"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/text-position.ts","../src/features/install-size/model/import-graph.ts","../src/features/install-size/model/installed-closure.ts","../src/features/install-size/model/install-size.ts","../src/features/overrides/model/override-findings.ts","../src/features/overrides/model/override-resolution.ts","../src/features/overrides/model/overrides.ts","../src/features/pass-through-wrappers/model/pass-through-wrappers.ts","../src/features/placement/model/agent-docs-length.ts","../src/features/placement/model/colocated-tests.ts","../src/features/placement/model/nested-docs.ts","../src/features/placement/model/root-readme.ts","../src/features/placement/model/placement-checks.ts","../src/features/repository-layout/model/crates.ts","../src/features/repository-layout/model/hidden-verify.ts","../src/features/repository-layout/model/root-workspace-paths.ts","../src/features/repository-layout/model/shared-uncached-tasks.ts","../src/features/repository-layout/model/workflow-nodes.ts","../src/features/repository-layout/model/workflow-references.ts","../src/features/repository-layout/model/workflow-paths.ts","../src/features/repository-layout/model/workspace-checks.ts","../src/features/scripts/model/shell-scripts.ts","../src/shared/lib/workflow-files.ts","../src/features/scripts/model/workflows.ts","../src/features/scripts/model/script-checks.ts","../src/features/value-owners/model/slots.ts","../src/features/value-owners/model/flows.ts","../src/features/value-owners/model/owners.ts","../src/features/value-owners/model/derivation.ts","../src/features/value-owners/model/shapes.ts","../src/features/value-owners/model/sites.ts","../src/features/value-owners/model/value-checks.ts","../src/features/value-owners/model/analysis.ts","../src/features/value-owners/model/cache.ts","../src/features/value-owners/model/duplicates.ts","../src/features/value-owners/model/check.ts","../src/features/workflow-concurrency/model/workflow-queue.ts","../src/features/comments/model/found-comment.ts","../src/features/comments/model/config-comments.ts","../src/features/comments/model/comment-readers.ts","../src/features/comments/model/comments.ts","../src/features/invisible-characters/model/hidden-unicode.ts","../src/shared/lib/scanned-files.ts","../src/features/python/model/python.ts","../src/features/unneeded-files/model/unneeded-files.ts","../src/app/tracked-text.ts","../src/app/all-checks.ts","../src/app/output.ts","../src/app/runtime.ts","../src/app/cli.ts"],"sourcesContent":["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\nexport type Value = string | number;\n\nexport interface 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface 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\nexport const 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\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const 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\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const 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\nexport const 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","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/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\nexport const 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","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface 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\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\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 CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const 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\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\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\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const 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\nexport const 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\nexport const 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","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (parent !== directory && !(yield* files.exists(files.join(directory, MANIFEST_FILE)))) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* pipe(\n names,\n Effect.forEach((name) => files.realPath(files.join(directory, NODE_MODULES, name))),\n );\n});\n\nconst workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(start: string) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n Effect.forEach(scopedNames(modules)),\n );\n return Arr.flatten(nested);\n});\n\nconst installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* pipe(\n names,\n Effect.forEach((name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n ),\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* pipe(\n Arr.dedupe([root, ...directories]),\n Effect.forEach((directory) => installedPackages(root, directory)),\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\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\nexport const 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","import {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Record as Rec,\n Result,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n SyntaxKind,\n isExportDeclaration,\n isImportDeclaration,\n isStringLiteral,\n} from \"#/shared/lib/compiler.ts\";\nimport type { API, Node } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RELATIVE = /^\\.\\.?(?:\\/|$)/u;\nconst SUBPATH_IMPORT = \"#\";\nconst WILDCARD = \"*\";\nconst SCOPE = \"@\";\nconst SEPARATOR = \"/\";\nconst SOURCE_SUFFIXES = [\"\", \".ts\", \".tsx\", \"/index.ts\"] as const;\nconst SCOPED_SEGMENTS = 2;\nconst PLAIN_SEGMENTS = 1;\n\nconst ImportsField = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\n\nconst decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));\n\ninterface Graph {\n readonly api: API;\n readonly directory: string;\n readonly imports: Readonly<Record<string, string>>;\n}\n\ninterface Walk {\n readonly pending: readonly string[];\n readonly visited: HashSet.HashSet<string>;\n readonly packages: HashSet.HashSet<string>;\n}\n\ntype Reference = Result.Result<string, string>;\n\nconst packageNameOf = (specifier: string): string => {\n const segments = Str.split(specifier, SEPARATOR);\n if (Str.startsWith(SCOPE)(specifier)) {\n return pipe(segments, Arr.take(SCOPED_SEGMENTS), Arr.join(SEPARATOR));\n }\n return pipe(segments, Arr.take(PLAIN_SEGMENTS), Arr.join(SEPARATOR));\n};\n\nconst literalText = (specifier: Node): Option.Option<string> =>\n pipe(\n Option.liftPredicate(specifier, isStringLiteral),\n Option.map((literal) => literal.text),\n );\n\nconst runtimeSpecifierOf = (statement: Node): Option.Option<string> => {\n if (isImportDeclaration(statement)) {\n const typeOnly = pipe(\n Option.fromUndefinedOr(statement.importClause),\n Option.exists((clause) => clause.phaseModifier === SyntaxKind.TypeKeyword),\n );\n return Option.filter(literalText(statement.moduleSpecifier), () => !typeOnly);\n }\n if (isExportDeclaration(statement) && !statement.isTypeOnly) {\n return Option.flatMap(Option.fromUndefinedOr(statement.moduleSpecifier), literalText);\n }\n return Option.none();\n};\n\nconst specifiersIn = (api: API, file: string, text: string): readonly string[] => {\n const retained = api.createSourceFile(file, text);\n const found = pipe(retained.sourceFile.statements, Arr.fromIterable, Arr.map(runtimeSpecifierOf));\n retained.dispose();\n return Arr.getSomes(found);\n};\n\nconst subpathTarget = (\n imports: Readonly<Record<string, string>>,\n specifier: string,\n): Option.Option<string> =>\n pipe(\n Rec.toEntries(imports),\n Arr.findFirst(([pattern, target]) => {\n if (!Str.endsWith(WILDCARD)(pattern)) {\n return Option.liftPredicate(target, () => pattern === specifier);\n }\n const prefix = Str.replace(WILDCARD, \"\")(pattern);\n return Option.liftPredicate(\n Str.replace(WILDCARD, Str.replace(prefix, \"\")(specifier))(target),\n () => Str.startsWith(prefix)(specifier),\n );\n }),\n );\n\nconst existingSource = Effect.fn(\"existingSource\")(function* existingSource(base: string) {\n const files = yield* RepositoryFiles;\n const found = yield* pipe(\n SOURCE_SUFFIXES,\n Effect.forEach((suffix) => {\n const candidate = `${base}${suffix}`;\n return files\n .isDirectory(candidate)\n .pipe(\n Effect.map((directory) =>\n Option.liftPredicate(candidate, () =>\n Option.exists(directory, (isDirectory) => !isDirectory),\n ),\n ),\n );\n }),\n );\n return Arr.head(Arr.getSomes(found));\n});\n\nconst localFile = Effect.fn(\"localFile\")(function* localFile(\n { directory, imports }: Graph,\n from: string,\n specifier: string,\n) {\n const files = yield* RepositoryFiles;\n if (RELATIVE.test(specifier)) {\n return yield* existingSource(files.resolve(files.dirname(from), specifier));\n }\n const target = subpathTarget(imports, specifier);\n if (Option.isNone(target)) {\n return Option.none<string>();\n }\n return yield* existingSource(files.resolve(directory, target.value));\n});\n\nconst referenceOf = (\n graph: Graph,\n from: string,\n specifier: string,\n): Effect.Effect<Option.Option<Reference>, never, RepositoryFiles> => {\n if (RELATIVE.test(specifier) || Str.startsWith(SUBPATH_IMPORT)(specifier)) {\n return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));\n }\n const name = packageNameOf(specifier);\n return Effect.succeedSome(Result.fail(name));\n};\n\nconst referencesIn = Effect.fn(\"referencesIn\")(function* referencesIn(graph: Graph, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const specifiers = Option.match(text, {\n onNone: (): readonly string[] => [],\n onSome: (source) => specifiersIn(graph.api, file, source),\n });\n const references = yield* pipe(\n specifiers,\n Effect.forEach((specifier) => referenceOf(graph, file, specifier)),\n );\n const found = Arr.getSomes(references);\n return { packages: Arr.getFailures(found), sources: Arr.getSuccesses(found) };\n});\n\nconst packagesFrom = (\n graph: Graph,\n walk: Walk,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(walk.pending, {\n onEmpty: () => Effect.succeed(walk.packages),\n onNonEmpty: ([next, ...rest]) => {\n if (HashSet.has(walk.visited, next)) {\n return packagesFrom(graph, { ...walk, pending: rest });\n }\n return referencesIn(graph, next).pipe(\n Effect.flatMap(({ packages, sources }) =>\n packagesFrom(graph, {\n pending: [...rest, ...sources],\n visited: HashSet.add(walk.visited, next),\n packages: HashSet.union(walk.packages, HashSet.fromIterable(packages)),\n }),\n ),\n );\n },\n });\n\n/** @internal */\nexport const packagesByEntry = Effect.fn(\"packagesByEntry\")(function* packagesByEntry(\n api: API,\n directory: string,\n entries: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const imports = pipe(\n manifest,\n Option.flatMap(decodeImports),\n Option.flatMap((field) => Option.fromUndefinedOr(field.imports)),\n Option.getOrElse((): Readonly<Record<string, string>> => ({})),\n );\n const graph: Graph = { api, directory, imports };\n return yield* pipe(\n entries,\n Effect.forEach((entry) =>\n packagesFrom(graph, {\n pending: [entry],\n visited: HashSet.empty(),\n packages: HashSet.empty(),\n }).pipe(Effect.map((packages) => [entry, packages] as const)),\n ),\n );\n});\n","import {\n Array as Arr,\n Effect,\n HashSet,\n Number as Num,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst EMPTY = 0;\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\nconst PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });\nconst PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));\nconst InstalledManifest = Schema.Struct({\n dependencies: DependencyMap,\n optionalDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n peerDependenciesMeta: PeerMeta,\n});\ntype Installed = typeof InstalledManifest.Type;\n\ntype Pending = readonly (readonly [string, string])[];\n\ninterface Collect {\n readonly pending: Pending;\n readonly seen: HashSet.HashSet<string>;\n}\n\nconst decodeManifest = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));\n\nexport const keysOf = (map: Readonly<Record<string, string>> | undefined): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(map),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst isOptionalPeer = (manifest: Installed, name: string): boolean =>\n pipe(\n Option.fromUndefinedOr(manifest.peerDependenciesMeta),\n Option.flatMap(Rec.get(name)),\n Option.exists((meta) => meta.optional === true),\n );\n\nconst installedNames = (manifest: Installed): readonly string[] => [\n ...keysOf(manifest.dependencies),\n ...keysOf(manifest.optionalDependencies),\n ...pipe(\n keysOf(manifest.peerDependencies),\n Arr.filter((name) => !isOptionalPeer(manifest, name)),\n ),\n];\n\nconst childrenOf = Effect.fn(\"childrenOf\")(function* childrenOf(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(installedNames),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((child) => [directory, child] as const),\n );\n});\n\nconst resolveFrom = (\n from: string,\n name: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* resolvePackage() {\n const files = yield* RepositoryFiles;\n const candidate = files.join(from, NODE_MODULES, name);\n const found = yield* files.exists(files.join(candidate, MANIFEST_FILE));\n if (found) {\n const real = yield* files.realPath(candidate);\n return Option.some(real);\n }\n const parent = files.dirname(from);\n if (parent === from) {\n return Option.none<string>();\n }\n return yield* resolveFrom(parent, name);\n });\n\nconst unseen = (\n from: string,\n name: string,\n seen: HashSet.HashSet<string>,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n resolveFrom(from, name).pipe(\n Effect.map(Option.filter((directory) => !HashSet.has(seen, directory))),\n );\n\nconst closureOf = (\n provided: HashSet.HashSet<string>,\n collect: Collect,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(collect.pending, {\n onEmpty: () => Effect.succeed(collect.seen),\n onNonEmpty: ([[from, name], ...rest]) => {\n if (HashSet.has(provided, name)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return unseen(from, name, collect.seen).pipe(\n Effect.flatMap((resolved) => {\n if (Option.isNone(resolved)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return childrenOf(resolved.value).pipe(\n Effect.flatMap((children) =>\n closureOf(provided, {\n pending: [...rest, ...children],\n seen: HashSet.add(collect.seen, resolved.value),\n }),\n ),\n );\n }),\n );\n },\n });\n\nconst directorySize = (directory: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* sizeOfDirectory() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const entries = pipe(\n names,\n Arr.filter((name) => name !== NODE_MODULES),\n Arr.map((name) => files.join(directory, name)),\n );\n const sizes = yield* pipe(\n entries,\n Effect.forEach((entry) =>\n files.isDirectory(entry).pipe(\n Effect.flatMap((kind) => {\n if (Option.isNone(kind)) {\n return Effect.succeed(EMPTY);\n }\n if (kind.value) {\n return directorySize(entry);\n }\n return files.fileSize(entry);\n }),\n ),\n ),\n );\n return Num.sumAll(sizes);\n });\n\nexport interface ClosureRoot {\n readonly provided: HashSet.HashSet<string>;\n readonly from: string;\n readonly name: string;\n}\n\nexport const installedClosure = ({\n provided,\n from,\n name,\n}: ClosureRoot): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n closureOf(provided, { pending: [[from, name]], seen: HashSet.empty() });\n\nexport const installedSize = (directory: string): Effect.Effect<number, never, RepositoryFiles> => {\n if (Str.includes(`/${NODE_MODULES}/`)(directory)) {\n return directorySize(directory);\n }\n return Effect.succeed(EMPTY);\n};\n","import {\n Array as Arr,\n Effect,\n HashMap,\n HashSet,\n Number as Num,\n Option,\n Order,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE, publicEntriesOf, publishedWorkspaces } from \"#/entities/package/index.ts\";\nimport type { PublicEntry, PublishedWorkspace } from \"#/entities/package/index.ts\";\nimport { typeScriptCompiler } from \"#/entities/project/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { packagesByEntry } from \"./import-graph.ts\";\nimport { installedClosure, installedSize, keysOf } from \"./installed-closure.ts\";\n\nconst INSTALL_SIZE: RuleName = \"install-size\";\nconst STACK_DEPENDENCY: RuleName = \"stack-dependency\";\nconst STACK_CATALOG = \"catalog:stack\";\nconst BUDGET_KEY = \"installSize\";\nconst DEPENDENCIES_KEY = '\"dependencies\"';\nconst LISTED_LARGEST = 5;\nconst SIZE_CONCURRENCY = 32;\nconst MEGABYTE = 1_000_000;\nconst MEGABYTE_DIGITS = 1;\nconst START = 0;\nconst SINGLE_ENTRY = 1;\n\ninterface DependencySize {\n readonly name: string;\n readonly size: number;\n readonly entries: readonly string[];\n}\n\ninterface Published {\n readonly workspace: PublishedWorkspace;\n readonly entries: readonly PublicEntry[];\n readonly provided: HashSet.HashSet<string>;\n}\n\ninterface Measured {\n readonly closures: readonly (readonly [string, HashSet.HashSet<string>])[];\n readonly sizeOf: (packages: HashSet.HashSet<string>) => number;\n readonly total: number;\n}\n\ninterface Overrun {\n readonly workspace: PublishedWorkspace;\n readonly total: number;\n readonly largest: readonly DependencySize[];\n readonly entryCount: number;\n}\n\nconst megabytes = (bytes: number): string => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;\n\nconst usageHint = (dependency: DependencySize, entryCount: number): string => {\n const partial =\n entryCount > SINGLE_ENTRY &&\n dependency.entries.length > START &&\n dependency.entries.length < entryCount;\n if (!partial) {\n return \"\";\n }\n return ` (imported only from ${Arr.join(dependency.entries, \", \")})`;\n};\n\nconst listed = ({ largest, entryCount }: Overrun): string =>\n pipe(\n largest,\n Arr.map(\n (dependency) =>\n `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`,\n ),\n Arr.join(\", \"),\n );\n\nconst budgetProblem = Effect.fn(\"budgetProblem\")(function* budgetProblem(overrun: Overrun) {\n const files = yield* RepositoryFiles;\n const { workspace, total } = overrun;\n const config = yield* files.readFile(workspace.configFile);\n const source = Option.getOrElse(config, () => \"\");\n const index = Option.getOrElse(Str.indexOf(BUDGET_KEY)(source), () => START);\n return {\n file: workspace.configFile,\n ...positionOf(source)(index),\n rule: INSTALL_SIZE,\n message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`,\n } satisfies Problem;\n});\n\nconst measure = Effect.fn(\"measure\")(function* measure(\n { workspace, provided }: Published,\n direct: readonly string[],\n) {\n const closures = yield* pipe(\n direct,\n Effect.forEach((name) =>\n installedClosure({ provided, from: workspace.directory, name }).pipe(\n Effect.map((packages) => [name, packages] as const),\n ),\n ),\n );\n const everything = pipe(\n closures,\n Arr.flatMap(([, packages]) => Arr.fromIterable(packages)),\n HashSet.fromIterable,\n );\n const measured = yield* Effect.forEach(\n everything,\n (found) => installedSize(found).pipe(Effect.map((size) => [found, size] as const)),\n { concurrency: SIZE_CONCURRENCY },\n );\n const sizes = HashMap.fromIterable(measured);\n const sizeOf = (packages: HashSet.HashSet<string>): number =>\n Num.sumAll(\n pipe(\n Arr.fromIterable(packages),\n Arr.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START)),\n ),\n );\n return { closures, sizeOf, total: sizeOf(everything) } satisfies Measured;\n});\n\nconst importersOf = Effect.fn(\"importersOf\")(function* importersOf({\n workspace,\n entries,\n}: Published) {\n const compiler = yield* typeScriptCompiler;\n const sources = pipe(\n entries,\n Arr.map((entry) => entry.source),\n Arr.dedupe,\n );\n const byEntry = yield* packagesByEntry(compiler.api, workspace.directory, sources);\n const reached = HashMap.fromIterable(byEntry);\n return (name: string): readonly string[] =>\n pipe(\n entries,\n Arr.filter((entry) =>\n pipe(HashMap.get(reached, entry.source), Option.exists(HashSet.has(name))),\n ),\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n );\n}, Effect.scoped);\n\nconst bySizeDescending = Order.mapInput(\n Order.flip(Order.Number),\n (dependency: DependencySize) => dependency.size,\n);\n\nconst sizeProblems = Effect.fn(\"sizeProblems\")(function* sizeProblems(\n published: Published,\n direct: readonly string[],\n) {\n const { closures, sizeOf, total } = yield* measure(published, direct);\n if (total <= published.workspace.installBudget) {\n return [];\n }\n const importers = yield* importersOf(published);\n const largest = pipe(\n closures,\n Arr.map(([name, packages]): DependencySize => ({\n name,\n size: sizeOf(packages),\n entries: importers(name),\n })),\n Arr.sortBy(bySizeDescending),\n Arr.take(LISTED_LARGEST),\n );\n const entryCount = pipe(\n published.entries,\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n ).length;\n const problem = yield* budgetProblem({\n workspace: published.workspace,\n total,\n largest,\n entryCount,\n });\n return [problem];\n});\n\nconst stackProblems = (\n file: string,\n source: string,\n dependencies: Readonly<Record<string, string>>,\n): readonly Problem[] => {\n const section = Option.getOrElse(Str.indexOf(DEPENDENCIES_KEY)(source), () => START);\n const rest = Str.slice(section)(source);\n return pipe(\n Rec.toEntries(dependencies),\n Arr.filter(([, specifier]) => specifier === STACK_CATALOG),\n Arr.map(([name]): Problem => ({\n file,\n ...positionOf(source)(\n section + Option.getOrElse(Str.indexOf(`\"${name}\"`)(rest), () => START),\n ),\n rule: STACK_DEPENDENCY,\n message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`,\n })),\n );\n};\n\nconst PublishedManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n peerDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nconst problemsOf = Effect.fn(\"problemsOf\")(function* problemsOf(\n workspace: PublishedWorkspace,\n file: string,\n source: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = Schema.decodeOption(Schema.fromJsonString(PublishedManifest))(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n const dependencies = Option.getOrElse(\n Option.fromUndefinedOr(manifest.value.dependencies),\n () => ({}),\n );\n const entries = publicEntriesOf({\n manifest: manifest.value,\n join: (target) => files.join(workspace.directory, target),\n packEntries: workspace.packEntries,\n });\n const provided = HashSet.fromIterable(keysOf(manifest.value.peerDependencies));\n const sized = yield* sizeProblems({ workspace, entries, provided }, Rec.keys(dependencies));\n return [...stackProblems(file, source, dependencies), ...sized];\n});\n\nconst workspaceProblems = Effect.fn(\"workspaceProblems\")(function* workspaceProblems(\n workspace: PublishedWorkspace,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(workspace.directory, MANIFEST_FILE);\n const source = yield* files.readFile(file);\n return yield* Option.match(source, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: (text) => problemsOf(workspace, file, text),\n });\n});\n\n/** @internal */\nexport const checkPublishedPackages = Effect.fn(\"checkPublishedPackages\")(\n function* checkPublishedPackages(root: string) {\n const workspaces = yield* publishedWorkspaces(root);\n const found = yield* pipe(workspaces, Effect.forEach(workspaceProblems));\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.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\nexport interface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nexport const 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","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\nexport type 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\nexport interface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\nexport interface 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\nexport const 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\nexport const 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\nexport const 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\nexport const 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\";\nexport const BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\n\nexport interface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nexport const 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\nexport const withoutOverride =\n (key: string) =>\n (manifest: string): string => {\n const document = parseDocument(manifest);\n document.deleteIn([OVERRIDES, key]);\n return document.toString();\n };\n\nexport const withBaselineProbe = (manifest: string): string => {\n const document = parseDocument(manifest);\n document.setIn([OVERRIDES, BASELINE_PROBE], REMOVED_DEPENDENCY);\n return document.toString();\n};\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 type { Problem } from \"#/shared/lib/problem.ts\";\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\";\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 */\nexport const 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","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport {\n SignatureKind,\n SyntaxKind,\n isArrowFunction,\n isBlock,\n isCallExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isIdentifier,\n isNewExpression,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isReturnStatement,\n isSpreadElement,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n ArrowFunction,\n CallExpression,\n Checker,\n Expression,\n FunctionDeclaration,\n FunctionExpression,\n Identifier,\n Node,\n ParameterDeclaration,\n SourceFile,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf } from \"#/shared/lib/syntax.ts\";\n\ntype Wrapper = FunctionDeclaration | ArrowFunction | FunctionExpression;\n\ninterface Forward {\n readonly node: Expression;\n readonly callee: Expression;\n readonly kind: SignatureKind;\n readonly arguments: readonly Expression[];\n readonly typed: boolean;\n readonly optional: boolean;\n}\n\ninterface Candidate {\n readonly name: Identifier;\n readonly wrapper: Wrapper;\n}\n\nconst RULE: RuleName = \"pass-through-wrapper\";\nconst SINGLE_STATEMENT = 1;\nconst SINGLE_DECLARATION = 1;\nconst THIS_PARAMETER = \"this\";\nconst NO_ARGUMENTS: readonly Expression[] = [];\n\nconst messageOf = (callee: string): string =>\n `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;\n\nconst unwrapped = (expression: Expression): Expression => {\n if (isParenthesizedExpression(expression)) {\n return unwrapped(expression.expression);\n }\n return expression;\n};\n\nconst isWrapperExpression = (\n expression: Expression,\n): expression is ArrowFunction | FunctionExpression =>\n isArrowFunction(expression) || isFunctionExpression(expression);\n\nconst candidateOf = (node: Node): Option.Option<Candidate> => {\n if (isFunctionDeclaration(node)) {\n return pipe(\n Option.fromUndefinedOr(node.name),\n Option.map((name) => ({ name, wrapper: node })),\n );\n }\n if (!isVariableDeclaration(node) || !isIdentifier(node.name)) {\n return Option.none();\n }\n const { name } = node;\n return pipe(\n Option.fromUndefinedOr(node.initializer),\n Option.map(unwrapped),\n Option.filter(isWrapperExpression),\n Option.map((wrapper) => ({ name, wrapper })),\n );\n};\n\nconst changesTheCall = (wrapper: Wrapper): boolean =>\n Predicate.isNotUndefined(wrapper.asteriskToken) ||\n Option.exists(\n Option.fromUndefinedOr(wrapper.type),\n (type) => type.kind === SyntaxKind.TypePredicate,\n ) ||\n pipe(\n wrapper.modifiers ?? [],\n Arr.some((modifier) => modifier.kind === SyntaxKind.AsyncKeyword),\n );\n\nconst returnedExpression = (wrapper: Wrapper): Option.Option<Expression> => {\n const { body } = wrapper;\n if (Predicate.isUndefined(body)) {\n return Option.none();\n }\n if (!isBlock(body)) {\n return Option.some(body);\n }\n if (body.statements.length !== SINGLE_STATEMENT) {\n return Option.none();\n }\n return pipe(\n Arr.head(body.statements),\n Option.filter((statement) => isReturnStatement(statement)),\n Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)),\n );\n};\n\nconst callForward = (call: CallExpression): Forward => ({\n node: call,\n callee: call.expression,\n kind: SignatureKind.Call,\n arguments: call.arguments,\n typed: Predicate.isNotUndefined(call.typeArguments),\n optional: Predicate.isNotUndefined(call.questionDotToken),\n});\n\nconst forwardOf = (expression: Expression): Option.Option<Forward> => {\n const inner = unwrapped(expression);\n if (isCallExpression(inner)) {\n return Option.some(callForward(inner));\n }\n if (isNewExpression(inner)) {\n return Option.some({\n node: inner,\n callee: inner.expression,\n kind: SignatureKind.Construct,\n arguments: inner.arguments ?? NO_ARGUMENTS,\n typed: Predicate.isNotUndefined(inner.typeArguments),\n optional: false,\n });\n }\n return Option.none();\n};\n\nconst rootOf = (callee: Expression): Option.Option<Identifier> => {\n if (isIdentifier(callee)) {\n return Option.some(callee);\n }\n if (\n isPropertyAccessExpression(callee) &&\n Predicate.isUndefined(callee.questionDotToken) &&\n isIdentifier(callee.name)\n ) {\n return rootOf(callee.expression);\n }\n return Option.none();\n};\n\nconst parameterName = (parameter: ParameterDeclaration): Option.Option<string> => {\n const { name } = parameter;\n if (\n !isIdentifier(name) ||\n Predicate.isNotUndefined(parameter.initializer) ||\n name.text === THIS_PARAMETER\n ) {\n return Option.none();\n }\n return Option.some(name.text);\n};\n\nconst isRest = (parameter: ParameterDeclaration): boolean =>\n Predicate.isNotUndefined(parameter.dotDotDotToken);\n\nconst forwardsParameter = ([parameter, name, argument]: readonly [\n ParameterDeclaration,\n string,\n Expression,\n]): boolean => {\n if (!isRest(parameter)) {\n return isIdentifier(argument) && argument.text === name;\n }\n return (\n isSpreadElement(argument) &&\n isIdentifier(argument.expression) &&\n argument.expression.text === name\n );\n};\n\nconst forwardedNames = (wrapper: Wrapper, forward: Forward): Option.Option<readonly string[]> => {\n const { parameters } = wrapper;\n const names = pipe(parameters, Arr.map(parameterName), Arr.getSomes);\n if (names.length !== parameters.length || forward.arguments.length !== parameters.length) {\n return Option.none();\n }\n const triples = Arr.zipWith(\n Arr.zip(parameters, names),\n forward.arguments,\n ([parameter, name], argument) => [parameter, name, argument] as const,\n );\n return pipe(\n Option.some(names),\n Option.filter(() => pipe(triples, Arr.every(forwardsParameter))),\n );\n};\n\nconst calleeTakesExactly =\n (checker: Checker) =>\n (forward: Forward, count: number): boolean => {\n const signatures = checker.getSignaturesOfType(\n checker.getTypeAtLocation(forward.callee),\n forward.kind,\n );\n return (\n Arr.isReadonlyArrayNonEmpty(signatures) &&\n pipe(\n signatures,\n Arr.every(\n (signature) =>\n !signature.hasRestParameter &&\n signature.parameters.length === count &&\n !Arr.isReadonlyArrayNonEmpty(signature.typeParameters ?? []),\n ),\n )\n );\n };\n\nconst keepsTheReturnType =\n (checker: Checker) =>\n (wrapper: Wrapper, forward: Forward): boolean =>\n Option.match(Option.fromUndefinedOr(wrapper.type), {\n onNone: () => true,\n onSome: (type) =>\n checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id,\n });\n\nconst isOverloaded =\n (checker: Checker) =>\n (name: Identifier): boolean =>\n Option.exists(\n Option.fromUndefinedOr(checker.getSymbolAtLocation(name)),\n (symbol) => symbol.declarations.length > SINGLE_DECLARATION,\n );\n\nconst callsAnotherFunction = (\n { name }: Candidate,\n forward: Forward,\n names: readonly string[],\n): boolean =>\n Option.exists(\n rootOf(forward.callee),\n (root) => root.text !== name.text && !names.includes(root.text),\n );\n\nconst isPassThrough =\n (checker: Checker) =>\n (candidate: Candidate) =>\n (forward: Forward): boolean => {\n const { wrapper, name } = candidate;\n if (forward.typed || forward.optional) {\n return false;\n }\n const restForwarded = pipe(wrapper.parameters, Arr.some(isRest));\n return (\n Option.exists(forwardedNames(wrapper, forward), (names) =>\n callsAnotherFunction(candidate, forward, names),\n ) &&\n (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) &&\n keepsTheReturnType(checker)(wrapper, forward) &&\n !isOverloaded(checker)(name)\n );\n };\n\nconst problemOf =\n (checker: Checker) =>\n (candidate: Candidate): Option.Option<Problem> => {\n if (changesTheCall(candidate.wrapper)) {\n return Option.none();\n }\n return pipe(\n returnedExpression(candidate.wrapper),\n Option.flatMap(forwardOf),\n Option.filter(isPassThrough(checker)(candidate)),\n Option.map((forward) =>\n problemAt({ rule: RULE, message: messageOf(forward.callee.getText()) })(candidate.name),\n ),\n );\n };\n\nexport const passThroughWrappersIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly Problem[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.map(candidateOf),\n Arr.getSomes,\n Arr.map(problemOf(checker)),\n Arr.getSomes,\n );\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst AGENT_DOC = /(?:^|\\/)(?:AGENTS|CLAUDE)\\.md$/u;\nconst RECOMMENDED_LINES = 200;\nconst READ_CONCURRENCY = 16;\nconst FIRST = 1;\nconst RULE: RuleName = \"agent-docs-length\";\n\nconst lineCount = (source: string): number => pipe(Str.trimEnd(source), Str.split(\"\\n\")).length;\n\nconst problemFor =\n (file: string) =>\n (lines: number): Option.Option<Problem> => {\n if (lines <= RECOMMENDED_LINES) {\n return Option.none();\n }\n return Option.some({\n file,\n line: RECOMMENDED_LINES + FIRST,\n column: FIRST,\n rule: RULE,\n message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`,\n });\n };\n\n/** @internal */\nexport const checkAgentDocsLength = Effect.fn(\"checkAgentDocsLength\")(\n function* checkAgentDocsLength(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const docs = pipe(\n listed,\n Arr.filter((name) => AGENT_DOC.test(name)),\n );\n const found = yield* Effect.forEach(\n docs,\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(Effect.map(Option.flatMap((source) => problemFor(file)(lineCount(source)))));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n },\n);\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, publicEntriesOf } from \"#/entities/package/index.ts\";\nimport type { EntryManifest } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"colocated-test\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst ROOT_SUBPATH = \".\";\nconst NAME_GROUP = \"name\";\nconst SPECIFIER_GROUP = \"specifier\";\nconst SCRIPT = /\\.[cm]?[jt]sx?$/u;\nconst TEST_FILE = /\\.test\\.[cm]?[jt]sx?$/u;\nconst MANIFEST_NAME = /package\\.json$/u;\nconst SEPARATE_TEST_DIRECTORY = /(?:^|\\/)(?:__tests__|__mocks__|tests?|specs?)\\//u;\nconst RELATIVE_REFERENCE = /[\"'`]\\.\\/(?<name>[^/\"'`]+)/gu;\nconst DIRNAME_REFERENCE = /import\\.meta\\.dirname\\s*,\\s*[\"'](?<name>[^/\"']+)[\"']/gu;\nconst MODULE_SPECIFIER =\n /(?:\\bfrom\\s+|\\bimport\\s*\\(\\s*|\\bimport\\s+|\\bvi\\.mock\\(\\s*)[\"'](?<specifier>[^\"'.#][^\"']*)[\"']/gu;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst DIRECTORY_MESSAGE =\n \"sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.\";\nconst SIBLING_MESSAGE =\n \"refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.\";\n\nconst Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface TestFile {\n readonly name: string;\n readonly base: string;\n readonly file: string;\n readonly directory: string;\n}\n\ninterface Context {\n readonly root: string;\n readonly packages: readonly string[];\n}\n\ninterface Beside {\n readonly join: (target: string) => string;\n readonly dirname: (file: string) => string;\n readonly directory: string;\n}\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nconst problemFor = (test: TestFile, message: string): Problem => ({\n file: test.file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${test.base} ${message}`,\n});\n\nconst groupsOf = (source: string, pattern: RegExp, group: string): readonly string[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((match) =>\n pipe(\n Option.fromUndefinedOr(match.groups),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])),\n ),\n ),\n Arr.getSomes,\n );\n\nconst namesSibling = (source: string): boolean =>\n pipe(\n [\n ...groupsOf(source, RELATIVE_REFERENCE, NAME_GROUP),\n ...groupsOf(source, DIRNAME_REFERENCE, NAME_GROUP),\n ],\n Arr.some((name) => !TEST_FILE.test(name)),\n );\n\nconst ownerOf = (packages: readonly string[], name: string): Option.Option<string> => {\n const owners = pipe(\n packages,\n Arr.filter((directory) => Str.startsWith(directory)(name)),\n );\n return Arr.last(Arr.sort(owners, byLength));\n};\n\nconst specifiersBeside =\n ({ join, dirname, directory }: Beside) =>\n (manifest: EntryManifest): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(manifest.name),\n Option.map((name) =>\n pipe(\n publicEntriesOf({ manifest, join, packEntries: [] }),\n Arr.filter(({ source }) => dirname(source) === directory),\n Arr.map(({ label }) => Str.replace(ROOT_SUBPATH, name)(label)),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst ownSpecifiers = Effect.fn(\"ownSpecifiers\")(function* ownSpecifiers(\n context: Context,\n test: TestFile,\n) {\n const files = yield* RepositoryFiles;\n const owner = ownerOf(context.packages, test.name);\n if (Option.isNone(owner)) {\n return [];\n }\n const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));\n const join = (target: string): string => files.join(context.root, owner.value, target);\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(specifiersBeside({ join, dirname: files.dirname, directory: test.directory })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst refersToOwnDirectory = Effect.fn(\"refersToOwnDirectory\")(function* refersToOwnDirectory(\n context: Context,\n test: TestFile,\n source: string,\n) {\n if (namesSibling(source)) {\n return true;\n }\n const specifiers = groupsOf(source, MODULE_SPECIFIER, SPECIFIER_GROUP);\n if (Arr.isReadonlyArrayEmpty(specifiers)) {\n return false;\n }\n const own = yield* ownSpecifiers(context, test);\n return pipe(\n specifiers,\n Arr.some((specifier) => pipe(own, Arr.contains(specifier))),\n );\n});\n\nconst refersIn = Effect.fn(\"refersIn\")(function* refersIn(context: Context, test: TestFile) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(test.file);\n if (Option.isNone(source)) {\n return true;\n }\n return yield* refersToOwnDirectory(context, test, source.value);\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(context: Context, test: TestFile) {\n if (SEPARATE_TEST_DIRECTORY.test(test.name)) {\n return Option.some(problemFor(test, DIRECTORY_MESSAGE));\n }\n if (!TEST_FILE.test(test.name)) {\n return Option.none<Problem>();\n }\n const refers = yield* refersIn(context, test);\n if (refers) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(test, SIBLING_MESSAGE));\n});\n\n/** @internal */\nexport const checkColocatedTests = Effect.fn(\"checkColocatedTests\")(function* checkColocatedTests(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n const names = pipe(listed, Arr.filter(Str.isNonEmpty));\n const context: Context = {\n root,\n packages: pipe(\n names,\n Arr.filter((name) => files.basename(name) === MANIFEST_FILE),\n Arr.map(Str.replace(MANIFEST_NAME, \"\")),\n ),\n };\n const tests = pipe(\n names,\n Arr.filter((name) => SCRIPT.test(name)),\n Arr.map((name): TestFile => {\n const file = files.join(root, name);\n return { name, base: files.basename(name), file, directory: files.dirname(file) };\n }),\n );\n const found = yield* Effect.forEach(tests, (test) => problemIn(context, test), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, HashSet, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst WORKSPACE_AGENT_DOC = \"AGENTS.md\";\nconst README = /^README(?:\\.[^/]+)?$/iu;\n\nconst RootConfig = Schema.Struct({\n msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }),\n});\n\nconst taggedError = Schema.TaggedError;\n\nclass RootConfigUnreadable extends taggedError<\n RootConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"RootConfigUnreadable\", { file: Schema.String }) {}\n\nconst isNested = (name: string): boolean => Str.includes(SEPARATOR)(name);\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 WORKSPACE_AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.\";\nconst README_MESSAGE =\n \"is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.\";\n\ninterface Allowed {\n readonly workspaces: HashSet.HashSet<string>;\n readonly workspaceAgentDocs: boolean;\n}\n\ninterface NestedDoc {\n readonly file: string;\n readonly base: string;\n readonly directory: string;\n}\n\nconst agentDocProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!allowed.workspaceAgentDocs) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));\n};\n\nconst readmeProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n};\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n allowed: Allowed,\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const doc: NestedDoc = { file, base: files.basename(name), directory: files.dirname(file) };\n if (AGENT_DOCS.test(doc.base)) {\n return agentDocProblem(doc, allowed);\n }\n return readmeProblem(doc, allowed);\n});\n\nconst allowsWorkspaceAgentDocs = Effect.fn(\"allowsWorkspaceAgentDocs\")(\n function* allowsWorkspaceAgentDocs(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return false;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => RootConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(RootConfig)), Option.isSome);\n },\n);\n\n/** @internal */\nexport const checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);\n const allowed: Allowed = {\n workspaces: pipe(\n nested,\n Arr.filter((name) => files.basename(name) === MANIFEST_FILE),\n Arr.map((name) => files.dirname(files.join(root, name))),\n HashSet.fromIterable,\n ),\n workspaceAgentDocs,\n };\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, allowed, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { namedWorkspaces } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-readme\";\nconst ROOT_DOC = /^(?:README(?:\\.[^/]+)?|AGENTS\\.md|CLAUDE\\.md)$/iu;\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst CHECK_POLICY = \"@r_masseater/msch\";\n\nconst isCheckPolicy = ({ packageName }: NamedWorkspace): boolean =>\n Option.contains(packageName, CHECK_POLICY);\n\nconst messageFor = (directory: string): string =>\n `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;\n\nconst problemsIn =\n (file: string, source: string) =>\n ({ directory, pattern }: NamedWorkspace): readonly Problem[] => {\n const message = messageFor(directory);\n const at = positionOf(source);\n return pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((found) => ({ file, ...at(found.index ?? START), rule: RULE, message })),\n );\n };\n\nconst problemsInReadme = Effect.fn(\"problemsInReadme\")(function* problemsInReadme(\n file: string,\n workspaces: readonly NamedWorkspace[],\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n return pipe(\n text,\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => pipe(workspaces, Arr.flatMap(problemsIn(file, source))),\n }),\n );\n});\n\n/** @internal */\nexport const checkRootReadme = Effect.fn(\"checkRootReadme\")(function* checkRootReadme(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const readmes = pipe(\n names,\n Arr.filter((name) => ROOT_DOC.test(name)),\n );\n const named = yield* namedWorkspaces(root);\n const workspaces = pipe(\n named,\n Arr.filter((workspace) => !isCheckPolicy(workspace)),\n );\n const found = yield* Effect.forEach(\n readmes,\n (name) => problemsInReadme(files.join(root, name), workspaces),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkAgentDocsLength } from \"./agent-docs-length.ts\";\nimport { checkColocatedTests } from \"./colocated-tests.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkRootReadme } from \"./root-readme.ts\";\n\n/** @internal */\nexport const checkPlacement = Effect.fn(\"checkPlacement\")(function* checkPlacement(root: string) {\n const found = yield* Effect.all(\n [\n checkNestedDocs(root),\n checkRootReadme(root),\n checkColocatedTests(root),\n checkAgentDocsLength(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Schema, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { workspaceDirectories, hasVerifyTask } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unverified-crate\";\nconst CARGO_FILE = \"Cargo.toml\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst CrateEntry = Schema.Struct({ name: Schema.String, manifest_path: Schema.String });\nconst CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));\nconst decodeCrateList = Schema.decodeUnknownEffect(CrateList);\n\ninterface Crate {\n readonly name: string;\n readonly manifest: string;\n}\n\nconst cratesIn = Effect.fn(\"cratesIn\")(function* cratesIn(root: string) {\n const handle = yield* ChildProcess.make(\n \"cargo\",\n [\"metadata\", \"--no-deps\", \"--format-version\", \"1\", \"--offline\"],\n { cwd: root, extendEnv: true, stdin: \"ignore\" },\n );\n const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const list = yield* decodeCrateList(output);\n return pipe(\n list.packages,\n Arr.map((crate): Crate => ({ name: crate.name, manifest: crate.manifest_path })),\n );\n}, Effect.scoped);\n\nconst owningWorkspace =\n (directories: readonly string[]) =>\n (directory: string): Option.Option<string> => {\n const owners = pipe(\n directories,\n Arr.filter(\n (workspace) =>\n directory === workspace || Str.startsWith(`${workspace}${SEPARATOR}`)(directory),\n ),\n );\n return Arr.last(Arr.sort(owners, Str.Order));\n };\n\nconst problemFor = (crate: Crate, message: string): Problem => ({\n file: crate.manifest,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `crate ${crate.name} ${message}, so vp run verify never checks it.`,\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n directories: readonly string[],\n crate: Crate,\n) {\n const files = yield* RepositoryFiles;\n const workspace = owningWorkspace(directories)(\n files.relative(root, files.dirname(crate.manifest)),\n );\n if (Option.isNone(workspace)) {\n return Option.some(problemFor(crate, \"is outside every workspace package\"));\n }\n const verified = yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE));\n if (verified) {\n return Option.none<Problem>();\n }\n return Option.some(\n problemFor(crate, `is in ${workspace.value}, whose ${CONFIG_FILE} has no verify task`),\n );\n});\n\n/** @internal */\nexport const checkCrates = Effect.fn(\"checkCrates\")(function* checkCrates(root: string) {\n const files = yield* RepositoryFiles;\n const cargo = yield* files.exists(files.join(root, CARGO_FILE));\n if (!cargo) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const crates = yield* cratesIn(root);\n const found = yield* Effect.forEach(crates, (crate) => problemIn(root, directories, crate), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option } from \"effect\";\n\nimport {\n workspaceConfigOf,\n workspaceDirectories,\n VERIFY_TASK,\n definesTask,\n hasVerifyTask,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nconst RULE: RuleName = \"hidden-verify\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, directory: string) {\n const config = yield* workspaceConfigOf(root, directory);\n if (Option.isNone(config)) {\n return Option.none<Problem>();\n }\n const { file, program } = config.value;\n if (definesTask(VERIFY_TASK)(program)) {\n return Option.none<Problem>();\n }\n const verified = yield* hasVerifyTask(file);\n return Option.some<Problem>({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${directory} gets its verify task from code outside ${CONFIG_FILE}. The root verify reads ${CONFIG_FILE} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE}.`,\n }).pipe(Option.filter(() => verified));\n});\n\n/** @internal */\nexport const checkHiddenVerify = Effect.fn(\"checkHiddenVerify\")(function* checkHiddenVerify(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(directories, (directory) => problemIn(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nimport { childrenOf, workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-workspace-path\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst PATH_CHARACTER = /[\\w.@/-]/u;\nconst NAME_CHARACTER = /[\\w.@-]/u;\nconst FIRST = 0;\nconst NEXT = 1;\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\ninterface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nconst stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n\nconst isBoundary = (character: string, allowed: RegExp): boolean =>\n character === \"\" || !allowed.test(character);\n\nconst mentions =\n (directory: string) =>\n (text: string): boolean => {\n const parts = Str.split(text, directory);\n return pipe(\n Arr.drop(parts, NEXT),\n Arr.some((after, index) => {\n const before = parts[index] ?? \"\";\n const previous = Str.slice(before.length - NEXT)(before);\n const following = Str.slice(FIRST, NEXT)(after);\n return (\n isBoundary(previous, PATH_CHARACTER) &&\n (following === \"/\" || isBoundary(following, NAME_CHARACTER))\n );\n }),\n );\n };\n\nconst problemsIn =\n (file: string, source: string, directories: readonly string[]) =>\n (found: FoundString): readonly Problem[] =>\n pipe(\n directories,\n Arr.filter((directory) => mentions(directory)(found.text)),\n Arr.map((directory): Problem => ({\n file,\n ...positionOf(source)(found.start),\n rule: RULE,\n message: `${directory} is a workspace. The root ${CONFIG_FILE} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE}: msch.lint, msch.devDependencies or its verify task.`,\n })),\n );\n\n/** @internal */\nexport const checkRootWorkspacePaths = Effect.fn(\"checkRootWorkspacePaths\")(\n function* checkRootWorkspacePaths(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: \"ts\" }));\n return pipe(\n stringsIn(parsed.program),\n Arr.flatMap(problemsIn(file, source.value, directories)),\n );\n },\n);\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n KeySchema,\n keyName,\n literalOf,\n nestedValues,\n workspaceConfigOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"shared-uncached-task\";\nconst TASKS_PATH = [\"run\", \"tasks\"] as const;\nconst READ_CONCURRENCY = 8;\nconst SHARED = 2;\nconst OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\\//u;\n\nconst TaskProperty = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n start: Schema.Finite,\n});\nconst TaskObject = Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n});\nconst UncachedTask = Schema.Struct({\n cache: Schema.Literal(false),\n command: Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]),\n});\n\nconst decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);\nconst decodeTaskObject = Schema.decodeUnknownOption(TaskObject);\nconst decodeUncachedTask = Schema.decodeUnknownOption(UncachedTask);\nconst encodeDefinition = Schema.encodeOption(Schema.fromJsonString(Schema.Unknown));\n\ninterface UncachedDefinition {\n readonly directory: string;\n readonly file: string;\n readonly position: Pick<Problem, \"line\" | \"column\">;\n readonly name: string;\n readonly command: string;\n readonly definition: string;\n}\n\nconst commandText = (command: typeof UncachedTask.Type.command): string =>\n Arr.join(Arr.ensure(command), \" && \");\n\nconst runsOwnProgram = (command: string): boolean =>\n pipe(\n Str.trim(command),\n Str.split(/\\s+/u),\n Arr.head,\n Option.exists((program) => OWN_PROGRAM.test(program)),\n );\n\ninterface ConfigFile {\n readonly directory: string;\n readonly file: string;\n readonly source: string;\n}\n\nconst definitionOf =\n ({ directory, file, source }: ConfigFile) =>\n (task: typeof TaskProperty.Type): Option.Option<UncachedDefinition> =>\n Option.gen(function* uncachedDefinition() {\n const literal = yield* literalOf(task.value);\n const { command } = yield* decodeUncachedTask(literal);\n const text = commandText(command);\n if (runsOwnProgram(text)) {\n return yield* Option.none();\n }\n const definition = yield* encodeDefinition(literal);\n return {\n directory,\n file,\n position: positionOf(source)(task.start),\n name: keyName(task.key),\n command: text,\n definition,\n };\n });\n\nconst definitionsIn = Effect.fn(\"definitionsIn\")(function* definitionsIn(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n if (Option.isNone(config)) {\n return [];\n }\n const { file, source, program } = config.value;\n return pipe(\n nestedValues(TASKS_PATH)(program),\n Arr.flatMap((tasks) =>\n pipe(\n decodeTaskObject(tasks),\n Option.map(({ properties }) => properties),\n Option.getOrElse((): readonly unknown[] => []),\n ),\n ),\n Arr.flatMap((property) =>\n pipe(\n decodeTaskProperty(property),\n Option.flatMap(definitionOf({ directory, file, source })),\n Option.toArray,\n ),\n ),\n );\n});\n\nconst problemsOf = (definitions: readonly UncachedDefinition[]): readonly Problem[] => {\n const directories = pipe(\n definitions,\n Arr.map(({ directory }) => directory),\n Arr.dedupe,\n );\n if (directories.length < SHARED) {\n return [];\n }\n return pipe(\n definitions,\n Arr.map(({ file, position, name, command }): Problem => ({\n file,\n ...position,\n rule: RULE,\n message: `The uncached task ${name} (${command}) is written the same way in ${Arr.join(directories, \", \")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`,\n })),\n );\n};\n\n/** @internal */\nexport const checkSharedUncachedTasks = Effect.fn(\"checkSharedUncachedTasks\")(\n function* checkSharedUncachedTasks(root: string) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(\n directories,\n (directory) => definitionsIn(root, directory),\n { concurrency: READ_CONCURRENCY },\n );\n return pipe(\n Arr.flatten(found),\n Arr.groupBy(({ name, definition }) => `${name}\\u0000${definition}`),\n Rec.values,\n Arr.flatMap(problemsOf),\n );\n },\n);\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, isSeq, parseDocument, visit } from \"yaml\";\nimport type { Pair, Scalar, YAMLMap, YAMLSeq } from \"yaml\";\n\nconst MISSING_OFFSET = 0;\n\n/** @internal */\nexport interface Located {\n readonly text: string;\n readonly offset: number;\n}\n\n/** @internal */\nexport type Entry = readonly [string, unknown];\n\ntype Ranged = Scalar | YAMLMap | YAMLSeq;\n\nconst isRanged = (node: unknown): node is Ranged => isScalar(node) || isMap(node) || isSeq(node);\n\n/** @internal */\nexport const isText = (node: unknown): node is Scalar<string> =>\n isScalar(node) && typeof node.value === \"string\";\n\nconst isTextPair = (pair: unknown): pair is Pair<Scalar<string>> =>\n isPair(pair) && isText(pair.key);\n\nconst offsetOf = (node: unknown): number =>\n pipe(\n Option.liftPredicate(node, isRanged),\n Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)),\n Option.map(([start]) => start),\n Option.getOrElse(() => MISSING_OFFSET),\n );\n\n/** @internal */\nexport const stringOf = (node: unknown): Option.Option<Located> =>\n pipe(\n Option.liftPredicate(node, isText),\n Option.map((scalar) => ({ text: scalar.value, offset: offsetOf(scalar) })),\n );\n\n/** @internal */\nexport const childOf =\n (key: string) =>\n (node: unknown): unknown =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): unknown => map.get(key, true)),\n Option.getOrUndefined,\n );\n\n/** @internal */\nexport const workingDirectoryOf = (owner: unknown): Option.Option<Located> => {\n const run = childOf(\"run\")(childOf(\"defaults\")(owner));\n return stringOf(childOf(\"working-directory\")(run));\n};\n\n/** @internal */\nexport const itemsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isSeq),\n Option.map((seq): readonly unknown[] => seq.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\nconst pairsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): readonly unknown[] => map.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\n/** @internal */\nexport const entriesOf = (node: unknown): readonly Entry[] =>\n pipe(\n pairsOf(node),\n Arr.filter(isTextPair),\n Arr.map((pair): Entry => [pair.key.value, pair.value]),\n );\n\n/** @internal */\nexport const scalarsIn = (source: string): readonly Located[] => {\n const found: Located[] = [];\n visit(parseDocument(source), {\n Scalar: (_key, node) => {\n found.push(...Option.toArray(stringOf(node)));\n },\n });\n return found;\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport { parseDocument } from \"yaml\";\n\nimport {\n childOf,\n entriesOf,\n itemsOf,\n scalarsIn,\n stringOf,\n workingDirectoryOf,\n} from \"./workflow-nodes.ts\";\nimport type { Entry, Located } from \"./workflow-nodes.ts\";\n\nconst ROOT = \".\";\nconst LOCAL = \"./\";\nconst NEGATION = \"!\";\nconst SEPARATOR = \"/\";\nconst LINE = \"\\n\";\nconst UNRESOLVED_MARKERS = [\"${{\", \"$\", \"{\"];\nconst ABSOLUTE_MARKERS = [\"/\", \"~\"];\nconst FILE_INPUT_SUFFIX = \"-file\";\nconst DEPENDENCY_PATH_INPUT = \"cache-dependency-path\";\nconst FILTER_KEYS = [\"paths\", \"paths-ignore\"];\nconst HASH_FILES = /hashFiles\\((?<arguments>[^)]*)\\)/gu;\nconst QUOTED = /'(?<path>[^']*)'/gu;\nconst SCRIPT = /^[\\w.@/-]+\\.(?:ts|mts|cts|sh)$/u;\nconst TOKEN_SEPARATOR = /[\\s;&|()<>\"'`=]+/u;\n\n/** @internal */\nexport const ACTION_DEFINITIONS: readonly string[] = [\"action.yml\", \"action.yaml\"];\n\n/** @internal */\nexport type ReferenceKind = \"glob\" | \"file\" | \"script\" | \"directory\" | \"action\";\n\n/** @internal */\nexport interface WorkflowReference {\n readonly kind: ReferenceKind;\n readonly field: string;\n readonly path: string;\n readonly offset: number;\n}\n\nconst containsAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.includes(marker)(path)),\n );\n\nconst startsWithAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.startsWith(marker)(path)),\n );\n\nconst isLiteralPath = (path: string): boolean =>\n Str.isNonEmpty(path) &&\n !containsAny(UNRESOLVED_MARKERS)(path) &&\n !startsWithAny(ABSOLUTE_MARKERS)(path);\n\nconst withoutLocal = (path: string): string => {\n if (Str.startsWith(LOCAL)(path)) {\n return Str.slice(LOCAL.length)(path);\n }\n return path;\n};\n\nconst joinPath = (base: string, path: string): string => {\n const relative = withoutLocal(Str.trim(path));\n if (base === ROOT) {\n return relative;\n }\n return `${base}${SEPARATOR}${relative}`;\n};\n\nconst reference =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n ({ text, offset }: Located): readonly WorkflowReference[] => {\n const path = Str.trim(text);\n if (!isLiteralPath(path) || !isLiteralPath(base)) {\n return [];\n }\n return [{ kind, field, path: joinPath(base, path), offset }];\n };\n\nconst isPositive = ({ text }: Located): boolean => !Str.startsWith(NEGATION)(Str.trim(text));\n\nconst globsIn = (field: string, node: unknown): readonly WorkflowReference[] =>\n pipe(\n itemsOf(node),\n Arr.flatMap((item) => Option.toArray(stringOf(item))),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", field)),\n );\n\nconst filtersOf = ([event, filters]: Entry): readonly WorkflowReference[] =>\n pipe(\n FILTER_KEYS,\n Arr.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))),\n );\n\nconst directoryOf = (located: Option.Option<Located>, base: string): string =>\n pipe(\n located,\n Option.map(({ text }) => joinPath(ROOT, text)),\n Option.getOrElse(() => base),\n );\n\nconst located =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n (found: Option.Option<Located>): readonly WorkflowReference[] =>\n pipe(found, Option.toArray, Arr.flatMap(reference(kind, field, base)));\n\nconst localUses = (node: unknown): Option.Option<Located> =>\n pipe(\n stringOf(childOf(\"uses\")(node)),\n Option.filter(({ text }) => Str.startsWith(LOCAL)(text)),\n );\n\nconst scriptsIn =\n (field: string, base: string) =>\n ({ text, offset }: Located): readonly WorkflowReference[] =>\n pipe(\n Str.split(text, TOKEN_SEPARATOR),\n Arr.filter((token) => SCRIPT.test(token)),\n Arr.dedupe,\n Arr.flatMap((token) => reference(\"script\", field, base)({ text: token, offset })),\n );\n\nconst isFileInput = ([key]: Entry): boolean =>\n Str.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;\n\nconst linesOf = ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Str.split(text, LINE),\n Arr.map((line) => ({ text: line, offset })),\n );\n\nconst fileInputOf =\n (field: string) =>\n ([key, value]: Entry): readonly WorkflowReference[] =>\n pipe(\n stringOf(value),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.flatMap(reference(\"glob\", `${field}.with.${key}`)),\n );\n\nconst fileInputsIn = (field: string, step: unknown): readonly WorkflowReference[] =>\n pipe(entriesOf(childOf(\"with\")(step)), Arr.filter(isFileInput), Arr.flatMap(fileInputOf(field)));\n\nconst stepReferences =\n (job: string, base: string) =>\n (step: unknown, index: number): readonly WorkflowReference[] => {\n const field = `jobs.${job}.steps[${index}]`;\n const own = stringOf(childOf(\"working-directory\")(step));\n const directory = directoryOf(own, base);\n return [\n ...located(\"action\", `${field}.uses`)(localUses(step)),\n ...located(\"directory\", `${field}.working-directory`)(own),\n ...pipe(\n stringOf(childOf(\"run\")(step)),\n Option.toArray,\n Arr.flatMap(scriptsIn(`${field}.run`, directory)),\n ),\n ...fileInputsIn(field, step),\n ];\n };\n\nconst jobReferences =\n (base: string) =>\n ([job, node]: Entry): readonly WorkflowReference[] => {\n const own = workingDirectoryOf(node);\n const steps = itemsOf(childOf(\"steps\")(node));\n const directory = directoryOf(own, base);\n return [\n ...located(\"file\", `jobs.${job}.uses`)(localUses(node)),\n ...located(\"directory\", `jobs.${job}.defaults.run.working-directory`)(own),\n ...pipe(steps, Arr.flatMap(stepReferences(job, directory))),\n ];\n };\n\nconst groupsOf =\n (pattern: RegExp, group: string) =>\n ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[group])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, offset })),\n );\n\nconst hashFilesIn = (source: string): readonly WorkflowReference[] =>\n pipe(\n scalarsIn(source),\n Arr.flatMap(groupsOf(HASH_FILES, \"arguments\")),\n Arr.flatMap(groupsOf(QUOTED, \"path\")),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", \"hashFiles\")),\n );\n\nconst jobsOf = (source: string): readonly Entry[] =>\n entriesOf(childOf(\"jobs\")(parseDocument(source).contents));\n\n/** @internal */\nexport const workflowReferences = (source: string): readonly WorkflowReference[] => {\n const root = parseDocument(source).contents;\n const workflowDefault = workingDirectoryOf(root);\n const base = directoryOf(workflowDefault, ROOT);\n return [\n ...pipe(entriesOf(childOf(\"on\")(root)), Arr.flatMap(filtersOf)),\n ...located(\"directory\", \"defaults.run.working-directory\")(workflowDefault),\n ...pipe(jobsOf(source), Arr.flatMap(jobReferences(base))),\n ...hashFilesIn(source),\n ];\n};\n\nconst pathInputOf = (step: unknown): unknown => childOf(\"path\")(childOf(\"with\")(step));\n\nconst outputPathsOf = (step: unknown): readonly string[] =>\n pipe(\n stringOf(pathInputOf(step)),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.map(({ text }) => joinPath(ROOT, text)),\n Arr.filter(isLiteralPath),\n );\n\n/** @internal */\nexport const producedPaths = (source: string): readonly string[] =>\n pipe(\n jobsOf(source),\n Arr.flatMap(([, job]) => itemsOf(childOf(\"steps\")(job))),\n Arr.flatMap(outputPathsOf),\n );\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { ACTION_DEFINITIONS, producedPaths, workflowReferences } from \"./workflow-references.ts\";\nimport type { ReferenceKind, WorkflowReference } from \"./workflow-references.ts\";\n\nconst RULE: RuleName = \"workflow-path\";\nconst WORKFLOW_DIRECTORY = \".github/workflows/\";\nconst WORKFLOW_EXTENSIONS = [\".yml\", \".yaml\"];\nconst READ_CONCURRENCY = 8;\nconst WILDCARD = /[*?[]/u;\nconst SEPARATOR = \"/\";\nconst FIRST = 0;\n\nconst EXPECTED: Readonly<Record<ReferenceKind, string>> = {\n action: \"a directory with action.yml\",\n directory: \"a directory\",\n file: \"a file\",\n glob: \"a pattern that matches a tracked file\",\n script: \"a file\",\n};\n\ntype Resolver = (root: string, path: string) => Effect.Effect<boolean, never, RepositoryFiles>;\n\nconst isWorkflow = (file: string): boolean =>\n Str.startsWith(WORKFLOW_DIRECTORY)(file) &&\n pipe(\n WORKFLOW_EXTENSIONS,\n Arr.some((extension) => Str.endsWith(extension)(file)),\n );\n\nconst matchesAny = Effect.fn(\"matchesAny\")(function* matchesAny(\n root: string,\n pathspecs: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const matched = yield* files.matchingFiles(root, pathspecs);\n return Arr.isReadonlyArrayNonEmpty(matched);\n});\n\nconst existsAt: Resolver = Effect.fn(\"existsAt\")(function* existsAt(root: string, path: string) {\n const files = yield* RepositoryFiles;\n return yield* files.exists(files.join(root, path));\n});\n\nconst matchesGlob: Resolver = (root, path) => matchesAny(root, [`:(glob)${path}`]);\n\nconst isDirectoryAt: Resolver = Effect.fn(\"isDirectoryAt\")(function* isDirectoryAt(\n root: string,\n path: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* files.isDirectory(files.join(root, path));\n return Option.getOrElse(directory, () => false);\n});\n\nconst hasAction: Resolver = Effect.fn(\"hasAction\")(function* hasAction(root: string, path: string) {\n const found = yield* pipe(\n ACTION_DEFINITIONS,\n Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR}${name}`)),\n );\n return pipe(found, Arr.some(Boolean));\n});\n\nconst suffixAt =\n (segments: readonly string[]) =>\n (index: number): string =>\n `:(glob)**/${pipe(segments, Arr.drop(index), Arr.join(SEPARATOR))}`;\n\nconst findsScript: Resolver = Effect.fn(\"findsScript\")(function* findsScript(\n root: string,\n path: string,\n) {\n if (yield* existsAt(root, path)) {\n return true;\n }\n const segments = Str.split(path, SEPARATOR);\n return yield* matchesAny(root, Arr.makeBy(segments.length, suffixAt(segments)));\n});\n\nconst RESOLVERS: Readonly<Record<ReferenceKind, Resolver>> = {\n action: hasAction,\n directory: isDirectoryAt,\n file: existsAt,\n glob: matchesGlob,\n script: findsScript,\n};\n\nconst staticPrefix = (path: string): string => {\n const prefix = Arr.headNonEmpty(Str.split(path, WILDCARD));\n if (Str.endsWith(SEPARATOR)(prefix)) {\n return Str.slice(FIRST, -SEPARATOR.length)(prefix);\n }\n return prefix;\n};\n\nconst isIgnored = Effect.fn(\"isIgnored\")(function* isIgnored(root: string, path: string) {\n const prefix = staticPrefix(path);\n if (Str.isEmpty(prefix)) {\n return false;\n }\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredPaths(root, [prefix]);\n return Arr.isReadonlyArrayNonEmpty(ignored);\n});\n\nconst overlaps =\n (path: string) =>\n (produced: string): boolean =>\n produced === path ||\n Str.startsWith(`${path}${SEPARATOR}`)(produced) ||\n Str.startsWith(`${produced}${SEPARATOR}`)(path);\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n produced: readonly string[],\n found: WorkflowReference,\n) {\n const prefix = staticPrefix(found.path);\n if (pipe(produced, Arr.some(overlaps(prefix)))) {\n return false;\n }\n if (yield* RESOLVERS[found.kind](root, found.path)) {\n return false;\n }\n return !(yield* isIgnored(root, found.path));\n});\n\nconst problemOf =\n (file: string, source: string) =>\n (found: WorkflowReference): Problem => ({\n file,\n ...positionOf(source)(found.offset),\n rule: RULE,\n message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`,\n });\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(root: string, workflow: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, workflow);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const produced = producedPaths(source.value);\n const missing = yield* Effect.filter(workflowReferences(source.value), (found) =>\n isMissing(root, produced, found),\n );\n return pipe(missing, Arr.map(problemOf(file, source.value)));\n});\n\n/** @internal */\nexport const checkWorkflowPaths = Effect.fn(\"checkWorkflowPaths\")(function* checkWorkflowPaths(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(listed, Arr.filter(isWorkflow)),\n (workflow) => problemsIn(root, workflow),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkCrates } from \"./crates.ts\";\nimport { checkHiddenVerify } from \"./hidden-verify.ts\";\nimport { checkRootWorkspacePaths } from \"./root-workspace-paths.ts\";\nimport { checkSharedUncachedTasks } from \"./shared-uncached-tasks.ts\";\nimport { checkWorkflowPaths } from \"./workflow-paths.ts\";\n\n/** @internal */\nexport const checkWorkspaces = Effect.fn(\"checkWorkspaces\")(function* checkWorkspaces(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkCrates(root),\n checkHiddenVerify(root),\n checkRootWorkspacePaths(root),\n checkSharedUncachedTasks(root),\n checkWorkflowPaths(root),\n ],\n {\n concurrency: \"unbounded\",\n },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst SHELL_FILE = /\\.(?:sh|bash|zsh|ksh|fish|command)$/u;\nconst SHELL_SHEBANG = /^#!\\S*(?:\\/|\\s)(?:env\\s+)?(?:-\\S+\\s+)*(?:ba|z|k|da)?sh\\b|^#!\\S*fish\\b/u;\nconst EXTENSION = /\\.[^./]+$/u;\nconst SETTINGS_FILE = \".claude/settings.json\";\nconst READ_CONCURRENCY = 64;\nconst FIRST = 1;\nconst RULE: RuleName = \"shell-script\";\nconst MESSAGE =\n \"is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.\";\n\nconst HookSchema = Schema.Struct({\n command: Schema.optional(Schema.String),\n args: Schema.optional(Schema.Array(Schema.String)),\n});\nconst MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });\nconst HooksSchema = Schema.Struct({ SessionStart: Schema.optional(Schema.Array(MatcherSchema)) });\nconst SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });\nconst decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));\n\ntype Hook = typeof HookSchema.Type;\ntype Matcher = typeof MatcherSchema.Type;\n\nconst NO_TEXT: readonly string[] = [];\n\nconst commandText = ({ command, args }: Hook): readonly string[] => [\n ...Option.toArray(Option.fromUndefinedOr(command)),\n ...pipe(\n Option.fromUndefinedOr(args),\n Option.getOrElse(() => NO_TEXT),\n ),\n];\n\nconst matcherText = ({ hooks }: Matcher): readonly string[] =>\n pipe(\n hooks,\n Arr.flatMap((hook) => commandText(hook)),\n );\n\nconst sessionStartCommands = (source: string): readonly string[] => {\n const matchers = pipe(\n decodeSettings(source),\n Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)),\n Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)),\n );\n return pipe(\n matchers,\n Option.map(Arr.flatMap((matcher) => matcherText(matcher))),\n Option.getOrElse(() => NO_TEXT),\n );\n};\n\nconst baseName = (name: string): string =>\n pipe(\n Str.split(\"/\")(name),\n Arr.last,\n Option.getOrElse(() => name),\n );\n\nconst hasExtension = (name: string): boolean => EXTENSION.test(baseName(name));\n\nconst problemFor = (file: string): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n});\n\n/** @internal */\nexport const checkShellScripts = Effect.fn(\"checkShellScripts\")(function* checkShellScripts(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));\n const commands = pipe(\n settings,\n Option.map(sessionStartCommands),\n Option.getOrElse(() => NO_TEXT),\n );\n const isSessionStartHook = (name: string): boolean =>\n pipe(commands, Arr.some(Str.includes(name)));\n const isShell = (name: string): Effect.Effect<boolean> => {\n const file = files.join(root, name);\n if (SHELL_FILE.test(name)) {\n return files.exists(file);\n }\n if (hasExtension(name)) {\n return Effect.succeed(false);\n }\n return files\n .readFile(file)\n .pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));\n };\n const candidates = pipe(\n names,\n Arr.filter((name) => !isSessionStartHook(name)),\n );\n const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY });\n return pipe(\n shell,\n Arr.map((name) => problemFor(files.join(root, name))),\n );\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst WORKFLOW_FILE = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/u;\nconst READ_CONCURRENCY = 16;\n\ninterface WorkflowFile {\n readonly file: string;\n readonly source: string;\n}\n\nexport const readWorkflows = Effect.fn(\"readWorkflows\")(function* readWorkflows(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n names,\n Arr.filter((name) => WORKFLOW_FILE.test(name)),\n ),\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(Effect.map(Option.map((source): WorkflowFile => ({ file, source }))));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport type { Range } from \"yaml\";\nimport { isPair, isScalar, parseDocument, visit } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { readWorkflows } from \"#/shared/lib/workflow-files.ts\";\n\nconst COMMAND_CHAIN = /&&|\\|\\||;|\\|/u;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst COMMENT = \"#\";\nconst RUN_KEY = \"run\";\nconst RULE: RuleName = \"workflow-script\";\nconst START = 0;\nconst ONE_COMMAND = 1;\nconst MESSAGE =\n \"runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.\";\n\ninterface RunScript {\n readonly text: string;\n readonly start: number;\n}\n\nconst startOf = (range: Readonly<Range> | null | undefined): number =>\n pipe(\n Option.fromNullishOr(range),\n Option.map(([start]) => start),\n Option.getOrElse(() => START),\n );\n\nconst runScriptsOf = (source: string): readonly RunScript[] => {\n const found: RunScript[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (\n isPair(pair) &&\n isScalar(pair.key) &&\n pair.key.value === RUN_KEY &&\n isScalar(pair.value) &&\n typeof pair.value.value === \"string\"\n ) {\n found.push({ text: pair.value.value, start: startOf(pair.value.range) });\n }\n },\n });\n return found;\n};\n\nconst isCommand = (line: string): boolean => Str.isNonEmpty(line) && !Str.startsWith(COMMENT)(line);\n\nconst chainsCommands = (line: string): boolean =>\n COMMAND_CHAIN.test(Str.replaceAll(QUOTED, \"\")(line));\n\nconst runsMoreThanOneCommand = ({ text }: RunScript): boolean => {\n const lines = pipe(Str.split(\"\\n\")(text), Arr.map(Str.trim), Arr.filter(isCommand));\n return lines.length > ONE_COMMAND || pipe(lines, Arr.some(chainsCommands));\n};\n\nconst problemsIn =\n (file: string) =>\n (source: string): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n runScriptsOf(source),\n Arr.filter(runsMoreThanOneCommand),\n Arr.map(({ start }) => ({ file, ...at(start), rule: RULE, message: MESSAGE })),\n );\n };\n\n/** @internal */\nexport const checkWorkflows = Effect.fn(\"checkWorkflows\")(function* checkWorkflows(root: string) {\n const workflows = yield* readWorkflows(root);\n return pipe(\n workflows,\n Arr.flatMap(({ file, source }) => problemsIn(file)(source)),\n );\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkShellScripts } from \"./shell-scripts.ts\";\nimport { checkWorkflows } from \"./workflows.ts\";\n\n/** @internal */\nexport const checkScripts = Effect.fn(\"checkScripts\")(function* checkScripts(root: string) {\n const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","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 \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/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\nexport const 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\nexport const 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\nexport const 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","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 \"#/shared/lib/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 \"#/shared/lib/compiler.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n NODE_MODULES_SEGMENT,\n symbolAt,\n} from \"#/shared/lib/syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\n\nexport interface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\nexport interface 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\nexport const 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","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface 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\nexport interface 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\nexport const OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nexport const 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\nexport const 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\nexport const 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","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { declarationKey, locationOf } from \"#/entities/project/index.ts\";\nimport { isSatisfiesExpression, isVariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node } from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/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\nexport const 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","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport { declarationKey, describeLibraryType, isObjectType } from \"#/entities/project/index.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"#/entities/project/index.ts\";\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"#/shared/lib/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 \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf, isGenericDeclaration, isTypeDeclaration } from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf } from \"#/shared/lib/values.ts\";\n\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\n\nexport interface 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\nexport const 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","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 \"#/shared/lib/compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n childrenOf,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n} from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface 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\nexport const 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","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { describeLibraryType } from \"#/entities/project/index.ts\";\nimport type { LibraryVocabulary } from \"#/entities/project/index.ts\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"#/shared/lib/syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { Flow } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\n\nexport interface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\nexport interface 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\nexport const 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\nexport const 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","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport type { Project, SourceCheck } from \"#/entities/project/index.ts\";\nimport { isVariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node, VariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { contains, descendantsOf } from \"#/shared/lib/syntax.ts\";\n\nimport { flowsIn } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesUnder } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\nexport interface 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\nexport interface ProjectChecks {\n readonly owners: readonly Owner[];\n readonly sourceChecks: readonly SourceCheck[];\n}\n\nexport const analyzeProject =\n ({ owners, sourceChecks }: ProjectChecks) =>\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 ...pipe(\n sourceChecks,\n Arr.flatMap((check) => check(checker)(sourceFile)),\n ),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n };\n };\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { nearestManifestDirectory } from \"#/entities/project/index.ts\";\nimport type { ProjectInputs } from \"#/entities/project/index.ts\";\nimport { ProblemList } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst CACHE_DIRECTORY = [NODE_MODULES, \".cache\", \"msch\", \"value-owners\"] as const;\nconst CACHE_SUFFIX = \".json\";\nconst MANIFEST_ENTRY = \"package.json\";\nconst FINGERPRINTED = [\"src\", \"dist\"] as const;\nconst EMPTY = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nconst ValueSchema = Schema.Union([Schema.String, Schema.Finite]);\n\nconst UnownedSiteSchema = Schema.Struct({\n scope: Schema.Struct({ name: Schema.String, dependencies: Schema.Array(Schema.String) }),\n file: Schema.String,\n start: Schema.Int,\n line: Schema.Int,\n column: Schema.Int,\n values: Schema.Array(ValueSchema),\n});\n\nconst AnalysisSchema = Schema.Struct({\n problems: ProblemList,\n unowned: Schema.Array(UnownedSiteSchema),\n});\n\nconst AnalysisJson = Schema.fromJsonString(AnalysisSchema);\n\nexport type Analysis = typeof AnalysisSchema.Type;\n\nexport type Hasher = (text: string) => Effect.Effect<string>;\n\nexport type FileDigest = (file: string) => Effect.Effect<string, never, RepositoryFiles>;\n\nexport interface AnalysisCache {\n readonly root: string;\n readonly directory: string;\n readonly salt: string;\n readonly digestFile: FileDigest;\n readonly hash: Hasher;\n}\n\nconst hasher = Effect.gen(function* currentHasher() {\n const files = yield* RepositoryFiles;\n const hash: Hasher = files.hash;\n return hash;\n});\n\nconst entryOf = (file: string, found: string): string => `${file}${FIELD_SEPARATOR}${found}`;\n\nconst fileDigest = (hash: Hasher): FileDigest => {\n const digests = new Map<string, string>();\n return (file) =>\n Option.match(Option.fromUndefinedOr(digests.get(file)), {\n onSome: Effect.succeed,\n onNone: () =>\n Effect.gen(function* readDigest() {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const found = yield* hash(Option.getOrElse(text, () => EMPTY));\n digests.set(file, found);\n return found;\n }),\n });\n};\n\nconst digestEntries =\n (digestFile: FileDigest) =>\n (\n named: readonly (readonly [string, string])[],\n ): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n pipe(\n named,\n Effect.forEach(([name, file]) =>\n digestFile(file).pipe(Effect.map((found) => entryOf(name, found))),\n ),\n );\n\nconst fingerprintedFiles = Effect.fn(\"fingerprintedFiles\")(function* fingerprintedFiles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const nested = yield* pipe(\n FINGERPRINTED,\n Effect.forEach((entry) => {\n const base = files.join(root, entry);\n return files.walkDirectory(base).pipe(Effect.map(Arr.map((file) => files.join(base, file))));\n }),\n );\n return Arr.sort([files.join(root, MANIFEST_ENTRY), ...Arr.flatten(nested)], Str.Order);\n});\n\nconst fingerprintOf = Effect.fn(\"fingerprintOf\")(function* fingerprintOf(hash: Hasher) {\n const root = yield* nearestManifestDirectory(import.meta.dirname);\n const listed = yield* fingerprintedFiles(root);\n const entries = yield* digestEntries(fileDigest(hash))(\n pipe(\n listed,\n Arr.map((file) => [file, file] as const),\n ),\n );\n return yield* hash(Arr.join(entries, LINE_SEPARATOR));\n});\n\nexport const analysisCache = Effect.fn(\"analysisCache\")(function* analysisCache(\n root: string,\n owners: string,\n) {\n const files = yield* RepositoryFiles;\n const hash = yield* hasher;\n const fingerprint = yield* fingerprintOf(hash);\n const salt = yield* hash(Arr.join([fingerprint, owners], FIELD_SEPARATOR));\n return {\n root,\n directory: files.join(root, ...CACHE_DIRECTORY),\n salt,\n digestFile: fileDigest(hash),\n hash,\n } satisfies AnalysisCache;\n});\n\nexport const keyOf =\n (cache: AnalysisCache) =>\n (configPath: string, inputs: ProjectInputs): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* deriveKey() {\n const files = yield* RepositoryFiles;\n const entries = yield* digestEntries(cache.digestFile)(\n pipe(\n inputs.files,\n Arr.map((file) => [file, files.join(cache.root, file)] as const),\n ),\n );\n const header = [cache.salt, files.relative(cache.root, configPath), inputs.options];\n return yield* cache.hash(\n Arr.join([...header, ...inputs.dependencies, ...entries], LINE_SEPARATOR),\n );\n });\n\nconst entryFile = (cache: AnalysisCache, key: string): string =>\n `${cache.directory}/${key}${CACHE_SUFFIX}`;\n\nexport const readAnalysis =\n (cache: AnalysisCache) =>\n (key: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* readCached() {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(entryFile(cache, key));\n return yield* Option.match(text, {\n onNone: () => Effect.succeedNone,\n onSome: (found) => Schema.decodeEffect(AnalysisJson)(found).pipe(Effect.option),\n });\n });\n\nexport const writeAnalysis =\n (cache: AnalysisCache) =>\n (key: string, analysis: Analysis): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* writeCached() {\n const files = yield* RepositoryFiles;\n const text = yield* Schema.encodeEffect(AnalysisJson)(analysis).pipe(Effect.option);\n yield* Option.match(text, {\n onNone: () => Effect.void,\n onSome: (found) => files.writeFile(entryFile(cache, key), found),\n });\n });\n\nexport const pruneAnalyses =\n (cache: AnalysisCache) =>\n (kept: readonly string[]): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* pruneCached() {\n const files = yield* RepositoryFiles;\n const keep = new Set(\n pipe(\n kept,\n Arr.map((key) => `${key}${CACHE_SUFFIX}`),\n ),\n );\n const present = yield* files.readDirectory(cache.directory);\n yield* pipe(\n present,\n Arr.filter((name) => !keep.has(name)),\n Effect.forEach((name) => files.removeFile(files.join(cache.directory, name))),\n Effect.asVoid,\n );\n });\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { formatValues, valueKey } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\n\nexport interface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\nexport interface 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\nexport const 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\nexport const 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","import { Effect, Option, Schema, Array as Arr, pipe } from \"effect\";\n\nimport {\n listConfigFiles,\n mentions,\n projectInputs,\n typeScriptCompiler,\n withProject,\n} from \"#/entities/project/index.ts\";\nimport type { Project, SourceCheck, Workspace } from \"#/entities/project/index.ts\";\nimport { sortProblems } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport type { ProjectChecks } from \"./analysis.ts\";\nimport { analysisCache, keyOf, pruneAnalyses, readAnalysis, writeAnalysis } from \"./cache.ts\";\nimport type { Analysis, AnalysisCache } from \"./cache.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.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 Context {\n readonly workspace: Workspace;\n readonly owners: readonly Owner[];\n readonly sourceChecks: readonly SourceCheck[];\n readonly cache: AnalysisCache;\n readonly listed: readonly string[];\n}\n\nconst freshAnalysis =\n ({ workspace, owners, sourceChecks }: Context) =>\n (configPath: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject({ owners, sourceChecks })(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\nconst keyedAnalysis =\n (context: Context) =>\n (\n configPath: string,\n key: string,\n ): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* lookupAnalysis() {\n const cached = yield* readAnalysis(context.cache)(key);\n if (Option.isSome(cached)) {\n return cached;\n }\n const fresh = yield* freshAnalysis(context)(configPath);\n yield* Option.match(fresh, {\n onNone: () => Effect.void,\n onSome: (analysis) => writeAnalysis(context.cache)(key, analysis),\n });\n return fresh;\n });\n\nconst analyzeConfig =\n (context: Context) =>\n (\n configPath: string,\n ): Effect.Effect<Option.Option<readonly [string, Analysis]>, never, RepositoryFiles> =>\n Effect.gen(function* analyzeOne() {\n const inputs = yield* projectInputs(context)(configPath);\n if (Option.isNone(inputs)) {\n return Option.none();\n }\n const key = yield* keyOf(context.cache)(configPath, inputs.value);\n const analysis = yield* keyedAnalysis(context)(configPath, key);\n return pipe(\n analysis,\n Option.map((found) => [key, found] as const),\n );\n });\n\nconst encodeOwners = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst cacheFor = Effect.fn(\"cacheFor\")(function* cacheFor(root: string, owners: readonly Owner[]) {\n const plain = pipe(\n owners,\n Arr.map((owner) => ({ ...owner, packageName: Option.getOrNull(owner.packageName) })),\n );\n const encoded = yield* encodeOwners(plain).pipe(Effect.orElseSucceed(() => \"\"));\n return yield* analysisCache(root, encoded);\n});\n\nconst analyzeProjects = Effect.fn(\"analyzeProjects\")(function* analyzeProjects(\n workspace: Workspace,\n { owners, sourceChecks }: ProjectChecks,\n configPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const cache = yield* cacheFor(workspace.root, owners);\n const listed = yield* files.listedFiles(workspace.root);\n const keyed = yield* pipe(\n configPaths,\n Effect.forEach(analyzeConfig({ workspace, owners, sourceChecks, cache, listed })),\n );\n const found = Arr.getSomes(keyed);\n yield* pruneAnalyses(cache)(\n pipe(\n found,\n Arr.map(([key]) => key),\n ),\n );\n return pipe(\n found,\n Arr.map(([, analysis]) => analysis),\n );\n});\n\nexport const checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(\n root: string,\n sourceChecks: readonly SourceCheck[] = [],\n) {\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(\n workspace,\n { owners: ownerScan.owners, sourceChecks },\n configPaths,\n );\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","import { Array as Arr, Effect, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, parseDocument, visit } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { readWorkflows } from \"#/shared/lib/workflow-files.ts\";\n\nconst CONCURRENCY_KEY = \"concurrency\";\nconst QUEUE_KEY = \"queue\";\nconst RULE: RuleName = \"workflow-queue\";\nconst MESSAGE =\n \"queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.\";\n\nconst queueKeyOf = (node: unknown): Option.Option<number> =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.flatMap((map) =>\n Arr.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === QUEUE_KEY),\n ),\n Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)),\n Option.flatMap((key) => Option.fromNullishOr(key.range)),\n Option.map(([start]) => start),\n );\n\nconst queueOffsetsOf = (source: string): readonly number[] => {\n const found: number[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (isPair(pair) && isScalar(pair.key) && pair.key.value === CONCURRENCY_KEY) {\n found.push(...Option.toArray(queueKeyOf(pair.value)));\n }\n },\n });\n return found;\n};\n\n/** @internal */\nexport const checkWorkflowQueues = Effect.fn(\"checkWorkflowQueues\")(function* checkWorkflowQueues(\n root: string,\n) {\n const workflows = yield* readWorkflows(root);\n return pipe(\n workflows,\n Arr.flatMap(({ file, source }): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n queueOffsetsOf(source),\n Arr.map((offset): Problem => {\n const { line, column } = at(offset);\n return { file, line, column, rule: RULE, message: MESSAGE };\n }),\n );\n }),\n );\n});\n","import { Schema, String as Str } from \"effect\";\nimport type { Effect } from \"effect\";\n\nexport interface FoundComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport type Found = Effect.Effect<readonly FoundComment[], CommentsUnreadable>;\n\nconst taggedError = Schema.TaggedError;\n\nexport class CommentsUnreadable extends taggedError<\n CommentsUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentsUnreadable\", { reader: Schema.String, message: Schema.String }) {}\n\nexport const unreadable =\n (reader: string) =>\n (cause: unknown): CommentsUnreadable =>\n CommentsUnreadable.make({ reader, message: String(cause) });\n\nexport const trimmed = ({ index, text }: FoundComment): FoundComment => ({\n index,\n text: Str.trimEnd(text),\n});\n","import { DockerfileParser } from \"dockerfile-ast\";\nimport { Array as Arr, Effect, Number as Num, Record as Rec, String as Str, pipe } from \"effect\";\nimport { parse as parseSql } from \"sql-parser-cst\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { Parser as YamlParser } from \"yaml\";\n\nimport { trimmed, unreadable } from \"./found-comment.ts\";\nimport type { Found } from \"./found-comment.ts\";\n\nconst NEXT = 1;\n\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null;\n\nconst childrenOf = (value: unknown): readonly unknown[] => {\n if (Arr.isArray(value)) {\n return value;\n }\n if (isRecord(value)) {\n return Rec.values(value);\n }\n return [];\n};\n\nconst collect =\n <Item>(isItem: (value: unknown) => value is Item) =>\n (value: unknown): readonly Item[] => {\n if (isItem(value)) {\n return [value];\n }\n return pipe(childrenOf(value), Arr.flatMap(collect(isItem)));\n };\n\ninterface YamlSourceToken {\n readonly offset: number;\n readonly source: string;\n}\n\nconst isYamlComment = (value: unknown): value is YamlSourceToken =>\n isRecord(value) &&\n value[\"type\"] === \"comment\" &&\n typeof value[\"offset\"] === \"number\" &&\n typeof value[\"source\"] === \"string\";\n\nexport const yamlComments = (source: string): Found =>\n Effect.try({\n try: () =>\n pipe(\n Arr.fromIterable(new YamlParser().parse(source)),\n Arr.flatMap(collect(isYamlComment)),\n Arr.map((token) => trimmed({ index: token.offset, text: token.source })),\n ),\n catch: unreadable(\"yaml\"),\n });\n\nexport const tomlComments = (source: string): Found =>\n Effect.try({\n try: () =>\n pipe(\n parseTOML(source).comments,\n Arr.map(({ range: [start, end] }) =>\n trimmed({ index: start, text: Str.slice(start, end)(source) }),\n ),\n ),\n catch: unreadable(\"toml\"),\n });\n\ninterface SqlComment {\n readonly text: string;\n readonly range: readonly [number, number];\n}\n\nconst isSqlComment = (value: unknown): value is SqlComment =>\n isRecord(value) &&\n (value[\"type\"] === \"line_comment\" || value[\"type\"] === \"block_comment\") &&\n typeof value[\"text\"] === \"string\" &&\n Arr.isArray(value[\"range\"]);\n\nexport const sqlComments = (source: string): Found =>\n Effect.try({\n try: () => {\n const program = parseSql(source, {\n dialect: \"sqlite\",\n includeComments: true,\n includeRange: true,\n paramTypes: [],\n });\n return pipe(\n collect(isSqlComment)(program),\n Arr.map(({ range: [start], text }) => trimmed({ index: start, text })),\n );\n },\n catch: unreadable(\"sql\"),\n });\n\nconst offsetAt =\n (lines: readonly string[]) =>\n ({ line, character }: Readonly<{ line: number; character: number }>): number =>\n character +\n pipe(\n lines,\n Arr.take(line),\n Arr.map((text) => text.length + NEXT),\n Num.sumAll,\n );\n\nexport const dockerfileComments = (source: string): Found =>\n Effect.try({\n try: () => {\n const lines = Str.split(source, \"\\n\");\n return pipe(\n DockerfileParser.parse(source).getComments(),\n Arr.map((comment) =>\n trimmed({\n index: offsetAt(lines)(comment.getRange().start),\n text: comment.toString(),\n }),\n ),\n );\n },\n catch: unreadable(\"dockerfile\"),\n });\n","import { fileURLToPath } from \"node:url\";\n\nimport treeSitter from \"@vscode/tree-sitter-wasm\";\nimport { isComment, isTag, isText } from \"domhandler\";\nimport type { AnyNode, Text } from \"domhandler\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport { DomUtils, parseDocument } from \"htmlparser2\";\n\nimport { dockerfileComments, sqlComments, tomlComments, yamlComments } from \"./config-comments.ts\";\nimport { trimmed, unreadable } from \"./found-comment.ts\";\nimport type { CommentsUnreadable, Found, FoundComment } from \"./found-comment.ts\";\n\nconst GRAMMARS = [\n \"bash\",\n \"c-sharp\",\n \"cpp\",\n \"css\",\n \"go\",\n \"java\",\n \"javascript\",\n \"php\",\n \"powershell\",\n \"ruby\",\n \"rust\",\n \"tsx\",\n \"typescript\",\n] as const;\n\nexport type Grammar = (typeof GRAMMARS)[number];\n\nexport type Markup = \"html\" | \"xml\";\n\nexport type Reader = Grammar | Markup | \"yaml\" | \"toml\" | \"sql\" | \"dockerfile\";\n\nexport type Grammars = (grammar: Grammar) => Option.Option<treeSitter.Language>;\n\nconst COMMENT_NODES = [\"comment\", \"line_comment\", \"block_comment\", \"multiline_comment\"];\nconst START = 0;\nconst NEXT = 1;\nconst NONE: readonly FoundComment[] = [];\n\nconst grammarFile = (grammar: Grammar): string =>\n fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));\n\nconst loadGrammar = (\n grammar: Grammar,\n): Effect.Effect<readonly [Grammar, treeSitter.Language], CommentsUnreadable> =>\n Effect.tryPromise({\n try: () => treeSitter.Language.load(grammarFile(grammar)),\n catch: unreadable(grammar),\n }).pipe(Effect.map((language) => [grammar, language] as const));\n\nexport const loadGrammars = Effect.fn(\"loadGrammars\")(function* loadGrammars() {\n yield* Effect.tryPromise({\n try: () => treeSitter.Parser.init(),\n catch: unreadable(\"javascript\"),\n });\n const loaded = yield* pipe(\n GRAMMARS,\n Effect.forEach((grammar) => loadGrammar(grammar)),\n );\n const languages = Rec.fromEntries(loaded);\n const grammars: Grammars = (grammar) => Rec.get(languages, grammar);\n return grammars;\n});\n\nconst commentNodesIn = (language: treeSitter.Language, source: string): readonly FoundComment[] => {\n const parser = new treeSitter.Parser();\n parser.setLanguage(language);\n const tree = parser.parse(source);\n parser.delete();\n if (tree === null) {\n return NONE;\n }\n const found = pipe(\n tree.rootNode.descendantsOfType(COMMENT_NODES),\n Arr.flatMap((node) => Option.toArray(Option.fromNullishOr(node))),\n Arr.map((node) => trimmed({ index: node.startIndex, text: node.text })),\n );\n tree.delete();\n return found;\n};\n\nconst syntaxComments =\n (grammars: Grammars, grammar: Grammar) =>\n (source: string): Found =>\n Option.match(grammars(grammar), {\n onNone: () => Effect.fail(unreadable(grammar)(\"the grammar is not loaded\")),\n onSome: (language) =>\n Effect.try({ try: () => commentNodesIn(language, source), catch: unreadable(grammar) }),\n });\n\nconst SCRIPT_TYPE = /^(?:|module|text\\/javascript|application\\/javascript)$/iu;\nconst SHADER_TYPE = /shader|glsl/iu;\n\ninterface EmbeddingTag {\n readonly name: string;\n readonly attribs: Readonly<Record<string, string>>;\n}\n\nconst scriptGrammar = (attribs: EmbeddingTag[\"attribs\"]): Option.Option<Grammar> => {\n const type = Str.trim(Option.getOrElse(Rec.get(attribs, \"type\"), () => \"\"));\n if (Rec.get(attribs, \"lang\").pipe(Option.contains(\"ts\"))) {\n return Option.some<Grammar>(\"typescript\");\n }\n if (SHADER_TYPE.test(type)) {\n return Option.some<Grammar>(\"cpp\");\n }\n return Option.liftPredicate<Grammar>(\"javascript\", () => SCRIPT_TYPE.test(type));\n};\n\nconst embeddedGrammar = ({ name, attribs }: EmbeddingTag): Option.Option<Grammar> => {\n if (name === \"style\") {\n return Option.some<Grammar>(\"css\");\n }\n if (name === \"script\") {\n return scriptGrammar(attribs);\n }\n return Option.none();\n};\n\nconst shifted =\n (offset: number) =>\n ({ index, text }: FoundComment): FoundComment => ({ index: index + offset, text });\n\nconst markupComment =\n (source: string) =>\n (node: AnyNode): readonly FoundComment[] => {\n if (!isComment(node) || node.startIndex === null || node.endIndex === null) {\n return NONE;\n }\n return [\n { index: node.startIndex, text: Str.slice(node.startIndex, node.endIndex + NEXT)(source) },\n ];\n };\n\nconst textComments =\n (grammars: Grammars, grammar: Grammar) =>\n (text: Text): Found => {\n const shift = shifted(text.startIndex ?? START);\n return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Arr.map(shift)));\n };\n\nconst embeddedComments =\n (grammars: Grammars) =>\n (node: AnyNode): Found => {\n if (!isTag(node)) {\n return Effect.succeed(NONE);\n }\n const texts = pipe(node.children, Arr.filter(isText));\n return Option.match(embeddedGrammar(node), {\n onNone: () => Effect.succeed(NONE),\n onSome: (grammar) =>\n pipe(texts, Effect.forEach(textComments(grammars, grammar)), Effect.map(Arr.flatten)),\n });\n };\n\nconst markupComments =\n (grammars: Grammars, markup: Markup) =>\n (source: string): Found =>\n Effect.gen(function* readMarkup() {\n const document = parseDocument(source, {\n xmlMode: markup === \"xml\",\n withStartIndices: true,\n withEndIndices: true,\n });\n const nodes = DomUtils.filter(() => true, document.children, true);\n const own = pipe(nodes, Arr.flatMap(markupComment(source)));\n if (markup === \"xml\") {\n return own;\n }\n const embedded = yield* pipe(nodes, Effect.forEach(embeddedComments(grammars)));\n return [...own, ...Arr.flatten(embedded)];\n });\n\nconst isGrammar = (reader: Reader): reader is Grammar => pipe(GRAMMARS, Arr.contains(reader));\n\nexport const commentsWith =\n (grammars: Grammars) =>\n (reader: Reader, source: string): Found => {\n if (isGrammar(reader)) {\n return syntaxComments(grammars, reader)(source);\n }\n const readers = {\n html: markupComments(grammars, \"html\"),\n xml: markupComments(grammars, \"xml\"),\n yaml: yamlComments,\n toml: tomlComments,\n sql: sqlComments,\n dockerfile: dockerfileComments,\n } satisfies Record<Exclude<Reader, Grammar>, (text: string) => Found>;\n return readers[reader](source);\n };\n","import path from \"node:path\";\n\nimport {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Predicate,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { COMMENT_DIRECTIVES } from \"#/shared/lib/comment-directives.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { commentsWith, loadGrammars } from \"./comment-readers.ts\";\nimport type { Reader } from \"./comment-readers.ts\";\nimport type { FoundComment } from \"./found-comment.ts\";\n\nconst RULE: RuleName = \"comment\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst VENDORED_PATHSPEC = \":(attr:linguist-vendored)\";\nconst READ_CONCURRENCY = 64;\nconst START = 0;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\n\nconst READERS: readonly (readonly [RegExp, Reader])[] = [\n [/\\.(?:[cm]?jsx?)$/u, \"javascript\"],\n [/\\.(?:[cm]?ts)$/u, \"typescript\"],\n [/\\.tsx$/u, \"tsx\"],\n [/\\.rs$/u, \"rust\"],\n [/\\.(?:cs|csx)$/u, \"c-sharp\"],\n [/\\.(?:sh|bash|zsh|ksh)$/u, \"bash\"],\n [/(?:^|\\/)\\.(?:vite-hooks|husky|githooks)\\/[^./][^/]*$/u, \"bash\"],\n [/\\.(?:ps1|psm1|psd1)$/u, \"powershell\"],\n [/\\.go$/u, \"go\"],\n [/\\.(?:java|kt|kts)$/u, \"java\"],\n [/\\.(?:rb|rake)$/u, \"ruby\"],\n [/\\.php$/u, \"php\"],\n [/\\.(?:c|h|cc|cpp|cxx|hpp|hh|m|mm|glsl|frag|vert|comp|wgsl|hlsl|metal)$/u, \"cpp\"],\n [/\\.(?:css|pcss)$/u, \"css\"],\n [/\\.(?:html?|vue|svelte|astro)$/u, \"html\"],\n [/\\.(?:xml|xaml|plist|resx|props|targets|[a-z]+proj|manifest|nuspec)$/u, \"xml\"],\n [/\\.ya?ml$/u, \"yaml\"],\n [/\\.toml$/u, \"toml\"],\n [/\\.sql$/u, \"sql\"],\n [/(?:^|\\/)(?:Dockerfile|Containerfile)(?:\\.[^/]+)?$|\\.dockerfile$/u, \"dockerfile\"],\n];\n\nconst SHEBANG_READERS: readonly (readonly [RegExp, Reader])[] = [\n [/^#!.*\\b(?:ba|z|k|da)?sh\\b/u, \"bash\"],\n [/^#!.*\\b(?:node|bun|deno|tsx)\\b/u, \"javascript\"],\n [/^#!.*\\bpwsh\\b/u, \"powershell\"],\n];\n\nconst SHEBANG = \"#!\";\nconst PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\\s*$/u;\nconst VERSION = /^\\s?v?\\d[\\w.+-]*$/u;\nconst DELIMITERS = /^(?:\\/\\/|\\/\\*|<!--|<#|#|--)|(?:\\*\\/|-->|#>)$/gu;\nconst MESSAGE =\n \"Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.\";\n\nconst Patterns = Schema.Array(Schema.String);\nconst CommentSettings = Schema.Struct({ allow: Patterns });\nconst MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });\nconst LintSettings = Schema.Struct({ ignorePatterns: Schema.optional(Patterns) });\n\nconst RootConfig = Schema.Struct({\n msch: Schema.optional(MschSettings),\n lint: Schema.optional(LintSettings),\n});\n\ntype RootConfigType = typeof RootConfig.Type;\n\ninterface RootSettings {\n readonly allow: readonly string[];\n readonly ignorePatterns: readonly string[];\n}\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst NO_SETTINGS: RootSettings = { allow: [], ignorePatterns: [] };\nconst NONE: readonly Problem[] = [];\n\nconst taggedError = Schema.TaggedError;\n\nclass CommentConfigUnreadable extends taggedError<\n CommentConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentConfigUnreadable\", { file: Schema.String }) {}\n\nconst shebangReader = (source: string): Option.Option<readonly [RegExp, Reader]> => {\n if (!Str.startsWith(SHEBANG)(source)) {\n return Option.none();\n }\n return pipe(\n SHEBANG_READERS,\n Arr.findFirst(([pattern]) => pattern.test(source)),\n );\n};\n\nconst readerOf = (name: string, source: string): Option.Option<Reader> =>\n pipe(\n READERS,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.orElse(() => shebangReader(source)),\n Option.map(([, reader]) => reader),\n );\n\nconst valueOf = (text: string): string => Str.replaceAll(DELIMITERS, \"\")(text);\n\nconst lineBefore = (source: string, index: number): string => {\n const lines = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return Option.getOrElse(Arr.last(lines), () => \"\");\n};\n\nconst isPinVersion = (source: string, { index, text }: FoundComment): boolean =>\n PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));\n\nconst isShebang = ({ index, text }: FoundComment): boolean =>\n index === START && Str.startsWith(SHEBANG)(text);\n\nconst isAllowed =\n (source: string, directives: RegExp) =>\n (comment: FoundComment): boolean =>\n isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);\n\nconst problemOf =\n (file: string, source: string) =>\n ({ index }: FoundComment): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: MESSAGE,\n });\n\nconst unreadableProblem = (file: string, message: string): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: RULE,\n message: `msch could not read the comments in this file: ${message}`,\n});\n\nconst settingsOf = ({ msch, lint }: RootConfigType): RootSettings => ({\n allow: pipe(\n Option.fromUndefinedOr(msch),\n Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)),\n Option.match({ onNone: () => NO_SETTINGS.allow, onSome: ({ allow }) => allow }),\n ),\n ignorePatterns: pipe(\n Option.fromUndefinedOr(lint),\n Option.flatMap(({ ignorePatterns }) => Option.fromUndefinedOr(ignorePatterns)),\n Option.getOrElse(() => NO_SETTINGS.ignorePatterns),\n ),\n});\n\nconst rootSettings = Effect.fn(\"rootSettings\")(function* rootSettings(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return NO_SETTINGS;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => CommentConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(\n config,\n Option.flatMap(Schema.decodeUnknownOption(RootConfig)),\n Option.match({ onNone: () => NO_SETTINGS, onSome: settingsOf }),\n );\n});\n\nconst directivePattern = (directives: readonly string[]): RegExp =>\n new RegExp(String.raw`^\\s?(?:${Arr.join(directives, \"|\")})`, \"u\");\n\nconst isIgnored =\n (patterns: readonly string[]) =>\n (name: string): boolean =>\n pipe(\n patterns,\n Arr.some((pattern) => path.matchesGlob(name, pattern)),\n );\n\nconst scannedFiles = Effect.fn(\"scannedFiles\")(function* scannedFiles(\n root: string,\n settings: RootSettings,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const generated = yield* files.generatedFiles(root);\n const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);\n const skipped = HashSet.fromIterable([\n ...generated,\n ...pipe(\n vendored,\n Arr.map((name) => files.join(root, name)),\n ),\n ]);\n return pipe(\n listed,\n Arr.filter((name) => !isIgnored(settings.ignorePatterns)(name)),\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n Arr.filter(({ file }) => !HashSet.has(skipped, file)),\n );\n});\n\n/** @internal */\nexport const checkComments = Effect.fn(\"checkComments\")(function* checkComments(root: string) {\n const files = yield* RepositoryFiles;\n const settings = yield* rootSettings(root);\n const scanned = yield* scannedFiles(root, settings);\n const directives = directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]);\n const grammars = yield* loadGrammars();\n const comments = commentsWith(grammars);\n const problemsIn = (\n { name, file }: Listed,\n source: string,\n ): Effect.Effect<readonly Problem[]> => {\n const kept = Predicate.not(isAllowed(source, directives));\n const toProblem = problemOf(file, source);\n return Option.match(readerOf(name, source), {\n onNone: () => Effect.succeed(NONE),\n onSome: (reader) =>\n comments(reader, source).pipe(\n Effect.map(Arr.filter(kept)),\n Effect.map(Arr.map(toProblem)),\n Effect.catchTag(\"CommentsUnreadable\", ({ message }) =>\n Effect.succeed([unreadableProblem(file, message)]),\n ),\n ),\n });\n };\n const found = yield* Effect.forEach(\n scanned,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.succeed(NONE),\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/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 */\nexport const 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","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\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 READ_CONCURRENCY = 64;\n\nexport interface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nexport const isScannedText = ({ name }: Listed): boolean =>\n SCANNED_FILE.test(name) && !LOCKFILE.test(name);\n\nexport const isToolVersions = ({ name }: Listed): boolean => TOOL_VERSIONS.test(name);\n\n/** @internal */\nexport const listedFiles = Effect.fn(\"listedFiles\")(function* listedFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n});\n\n/** @internal */\nexport const presentFiles = Effect.fn(\"presentFiles\")(function* presentFiles(\n listed: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n listed,\n Effect.filter(({ file }) => files.exists(file)),\n );\n});\n\n/** @internal */\nexport const scanText = Effect.fn(\"scanText\")(function* scanText(\n listed: readonly Listed[],\n problemsIn: (entry: Listed, source: string) => readonly Problem[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n listed,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/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 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 FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"python-file\";\nconst COMMAND_RULE: RuleName = \"python-command\";\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 = (entry: Listed): readonly RegExp[] => {\n if (isToolVersions(entry)) {\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),\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 => !isPython(entry) && isScannedText(entry);\n\n/** @internal */\nexport const checkPython = Effect.fn(\"checkPython\")(function* checkPython(root: string) {\n const listed = yield* listedFiles(root);\n const scanned = yield* scanText(pipe(listed, Arr.filter(isScanned)), commandProblems);\n const present = yield* presentFiles(pipe(listed, Arr.filter(isPython)));\n return [...pipe(present, Arr.map(fileProblem)), ...scanned];\n});\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst PNPM_DIRECTORY = \".pnpm/\";\nconst SEPARATOR = \"/\";\n\nconst FOREIGN_LOCKFILE =\n /(?:^|\\/)(?:package-lock\\.json|npm-shrinkwrap\\.json|yarn\\.lock|bun\\.lockb?)$/u;\nconst CARGO_MANIFEST_FILE = /(?:^|\\/)Cargo\\.toml$/u;\nconst CARGO_LOCK_FILE = /(?:^|\\/)Cargo\\.lock$/u;\nconst PNPM_OUTPUT = /(?:^|\\/)\\.pnpm\\//u;\nconst CARGO_WORKSPACE = /^\\[workspace\\]/mu;\nconst LEGACY_CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config$/u;\nconst CARGO_CONFIG_FILE = /(?:^|\\/)\\.cargo\\/config\\.toml$/u;\nconst PNPM_CARGO_START = /# >>> pnpm-managed cargo sources >>>/u;\nconst PNPM_CARGO_BLOCK =\n /# >>> pnpm-managed cargo sources >>>[\\s\\S]*?# <<< pnpm-managed cargo sources <<<\\n?/gu;\n\nconst SETUP_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])rustup[ \\t]+(?:toolchain[ \\t]+install|install|update|default|override[ \\t]+set|target[ \\t]+add|component[ \\t]+add)\\b/gu,\n /(?<![\\w./@-])cargo[ \\t]+(?:vendor|fetch)\\b/gu,\n /\\buses:\\s*[\"']?(?:dtolnay\\/rust-toolchain|actions-rust-lang\\/setup-rust-toolchain|actions-rs\\/toolchain|moonrepo\\/setup-rust)\\b/gu,\n];\n\nconst INSTALL_PATTERNS: readonly RegExp[] = [/(?<![\\w./@-])cargo[ \\t]+b?install\\b/gu];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:rust|rustup)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst START = 0;\nconst LAST_SEGMENT = 1;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"unneeded-file\";\nconst SETUP_RULE: RuleName = \"unneeded-setup\";\nconst CARGO_RULE: RuleName = \"cargo-outside-pnpm\";\n\nconst CargoSettings = Schema.Struct({ enabled: Schema.optionalKey(Schema.Boolean) });\nconst WorkspaceFile = Schema.Struct({ cargo: Schema.optionalKey(CargoSettings) });\nconst decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);\n\nconst cargoEnabled = (text: string): boolean =>\n pipe(\n decodeWorkspaceFile(parse(text)),\n Option.flatMap(({ cargo }) => Option.fromUndefinedOr(cargo)),\n Option.flatMap(({ enabled }) => Option.fromUndefinedOr(enabled)),\n Option.getOrElse(() => false),\n );\n\nconst problemAtStart =\n (rule: RuleName, message: string) =>\n ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule,\n message,\n });\n\nconst foreignLockfile = problemAtStart(\n FILE_RULE,\n \"pnpm-lock.yaml is this repository's lockfile, and pnpm never reads this one. Delete it.\",\n);\n\nconst nestedCargoLock = problemAtStart(\n FILE_RULE,\n \"Cargo reads only the Cargo.lock beside the workspace's Cargo.toml, and pnpm install writes that one. Delete this one.\",\n);\n\nconst legacyCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .cargo/config.toml, and Cargo warns when .cargo/config sits beside it. Move its settings into .cargo/config.toml and delete it.\",\n);\n\nconst pnpmOutput = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .pnpm/ from Cargo.lock and rust-toolchain.toml. Add this .pnpm directory to .gitignore and keep it out of the repository.\",\n);\n\nconst pnpmCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes this .cargo/config.toml, and it holds nothing else. Add /.cargo/config.toml to .gitignore and keep it out of the repository.\",\n);\n\nconst generatedCargoConfig = (entry: Listed, source: string): readonly Problem[] => {\n if (!CARGO_CONFIG_FILE.test(entry.name) || !PNPM_CARGO_START.test(source)) {\n return [];\n }\n if (Str.isNonEmpty(Str.trim(Str.replaceAll(PNPM_CARGO_BLOCK, \"\")(source)))) {\n return [];\n }\n return [pnpmCargoConfig(entry)];\n};\n\nconst cargoOutsidePnpm = problemAtStart(\n CARGO_RULE,\n `pnpm does not manage these crates. Set \\`cargo: { enabled: true }\\` in ${WORKSPACE_FILE} so pnpm install fetches the crates and the Rust toolchain.`,\n);\n\nconst setupProblem =\n ({ file }: Listed, source: string, advice: (command: string) => string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: SETUP_RULE,\n message: advice(Str.trim(found[WHOLE_MATCH])),\n });\n\nconst removeSetup = (command: string): string =>\n `pnpm install already installs the toolchain in rust-toolchain.toml and vendors the crates in Cargo.lock. Remove \\`${command}\\`.`;\n\nconst buildInstead = (command: string): string =>\n `\\`${command}\\` fetches crates that pnpm does not vendor. Add the tool as a dependency of a Cargo workspace that pnpm vendors, and build its binary there with \\`cargo build -p <crate> --bin <name>\\`.`;\n\nconst setupPatternsFor = (entry: Listed): readonly RegExp[] => {\n if (isToolVersions(entry)) {\n return [...SETUP_PATTERNS, ...TOOL_PATTERNS];\n }\n return SETUP_PATTERNS;\n};\n\nconst matchesOf =\n (source: string) =>\n (patterns: readonly RegExp[]): readonly RegExpMatchArray[] =>\n pipe(\n patterns,\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n );\n\nconst setupProblems = (entry: Listed, source: string): readonly Problem[] => {\n const found = matchesOf(source);\n const installs = pipe(\n found(INSTALL_PATTERNS),\n Arr.map(setupProblem(entry, source, buildInstead)),\n );\n return pipe(\n found(setupPatternsFor(entry)),\n Arr.map(setupProblem(entry, source, removeSetup)),\n Arr.appendAll(installs),\n Arr.appendAll(generatedCargoConfig(entry, source)),\n );\n};\n\nconst matches =\n (pattern: RegExp) =>\n ({ name }: Listed): boolean =>\n pattern.test(name);\n\nconst isCargoManifest = matches(CARGO_MANIFEST_FILE);\nconst isForeignLockfile = matches(FOREIGN_LOCKFILE);\nconst isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);\nconst isPnpmOutput = matches(PNPM_OUTPUT);\n\nconst directoryOf = (name: string): string =>\n pipe(Str.split(name, SEPARATOR), Arr.dropRight(LAST_SEGMENT), Arr.join(SEPARATOR));\n\nconst ancestorsOf = (directory: string): readonly string[] => {\n const parts = Str.split(directory, SEPARATOR);\n return pipe(\n Arr.makeBy(parts.length, (depth) => Arr.join(Arr.take(parts, depth), SEPARATOR)),\n Arr.filter((ancestor) => ancestor !== directory),\n );\n};\n\nconst readsCargoLock =\n (manifests: readonly string[], workspaces: readonly string[]) =>\n ({ name }: Listed): boolean => {\n const directory = directoryOf(name);\n const insideWorkspace = pipe(\n ancestorsOf(directory),\n Arr.some((ancestor) => Arr.contains(workspaces, ancestor)),\n );\n return (\n Arr.contains(manifests, directory) &&\n (Arr.contains(workspaces, directory) || !insideWorkspace)\n );\n };\n\nconst isWorkspaceManifest = (source: Option.Option<string>): boolean =>\n Option.exists(source, (text) => CARGO_WORKSPACE.test(text));\n\nconst directoriesOf = (entries: readonly Listed[]): readonly string[] =>\n pipe(\n entries,\n Arr.map(({ name }) => directoryOf(name)),\n );\n\nconst cargoWorkspaces = Effect.fn(\"cargoWorkspaces\")(function* cargoWorkspaces(\n manifests: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n const roots = yield* pipe(\n manifests,\n Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))),\n );\n return directoriesOf(roots);\n});\n\nconst pnpmDirectoryOf = ({ name }: Listed): string =>\n pipe(\n name,\n Str.indexOf(PNPM_DIRECTORY),\n Option.getOrElse(() => START),\n (end) => Str.slice(START, end)(name),\n );\n\nconst pnpmOutputs = (present: readonly Listed[]): readonly Problem[] =>\n pipe(\n present,\n Arr.filter(isPnpmOutput),\n Arr.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)),\n Arr.map(pnpmOutput),\n );\n\nconst byDepth: Order.Order<Listed> = Order.mapInput(\n Order.Number,\n ({ name }: Listed) => Str.split(name, \"/\").length,\n);\n\nconst cargoProblems = (\n present: readonly Listed[],\n enabled: boolean,\n): Effect.Effect<readonly Problem[], never, RepositoryFiles> => {\n if (!enabled) {\n return Effect.succeed(\n pipe(\n present,\n Arr.filter(isCargoManifest),\n Arr.match({\n onEmpty: (): readonly Problem[] => [],\n onNonEmpty: (manifests) => [cargoOutsidePnpm(Arr.min(manifests, byDepth))],\n }),\n ),\n );\n }\n return Effect.gen(function* enabledCargoProblems() {\n const manifests = pipe(present, Arr.filter(isCargoManifest));\n const workspaces = yield* cargoWorkspaces(manifests);\n const reads = readsCargoLock(directoriesOf(manifests), workspaces);\n const setup = yield* scanText(pipe(present, Arr.filter(isScannedText)), setupProblems);\n return [\n ...pipe(\n present,\n Arr.filter((entry) => CARGO_LOCK_FILE.test(entry.name) && !reads(entry)),\n Arr.map(nestedCargoLock),\n ),\n ...pipe(present, Arr.filter(isLegacyCargoConfig), Arr.map(legacyCargoConfig)),\n ...pnpmOutputs(present),\n ...setup,\n ];\n });\n};\n\nconst unneededIn = Effect.fn(\"unneededIn\")(function* unneededIn(root: string, workspace: string) {\n const listed = yield* listedFiles(root);\n const present = yield* presentFiles(listed);\n const lockfiles = pipe(present, Arr.filter(isForeignLockfile), Arr.map(foreignLockfile));\n if (!pipe(present, Arr.some(isCargoManifest))) {\n return lockfiles;\n }\n const cargo = yield* cargoProblems(present, cargoEnabled(workspace));\n return [...lockfiles, ...cargo];\n});\n\n/** @internal */\nexport const checkUnneededFiles = Effect.fn(\"checkUnneededFiles\")(function* checkUnneededFiles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const workspace = yield* files.readFile(files.join(root, WORKSPACE_FILE));\n if (Option.isNone(workspace)) {\n return [];\n }\n return yield* unneededIn(root, workspace.value);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkComments } from \"#/features/comments/index.ts\";\nimport { checkHiddenUnicode } from \"#/features/invisible-characters/index.ts\";\nimport { checkPython } from \"#/features/python/index.ts\";\nimport { checkUnneededFiles } from \"#/features/unneeded-files/index.ts\";\n\n/** @internal */\nexport const checkTrackedText = Effect.fn(\"checkTrackedText\")(function* checkTrackedText(\n root: string,\n) {\n const found = yield* Effect.all(\n [checkHiddenUnicode(root), checkPython(root), checkUnneededFiles(root), checkComments(root)],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkPublishedPackages } from \"#/features/install-size/index.ts\";\nimport { checkOverrides } from \"#/features/overrides/index.ts\";\nimport { passThroughWrappersIn } from \"#/features/pass-through-wrappers/index.ts\";\nimport { checkPlacement } from \"#/features/placement/index.ts\";\nimport { checkWorkspaces } from \"#/features/repository-layout/index.ts\";\nimport { checkScripts } from \"#/features/scripts/index.ts\";\nimport { checkRepository } from \"#/features/value-owners/index.ts\";\nimport { checkWorkflowQueues } from \"#/features/workflow-concurrency/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { checkTrackedText } from \"./tracked-text.ts\";\n\n/** @internal */\nexport const checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n | ReturnType<typeof checkWorkspaces>\n >,\n Effect.Services<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkRepository(root, [passThroughWrappersIn]),\n checkOverrides(root),\n checkTrackedText(root),\n checkPlacement(root),\n checkScripts(root),\n checkPublishedPackages(root),\n checkWorkspaces(root),\n checkWorkflowQueues(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const 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","import { runMain } from \"@effect/platform-node-shared/NodeRuntime\";\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 { nodeServicesLayer } from \"#/shared/lib/node-services.ts\";\nimport { nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.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\n/** @internal */\nexport const 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","#!/usr/bin/env node\nimport { Effect, Schema, Stdio, Array as Arr, pipe } from \"effect\";\n\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { checkAll } from \"./all-checks.ts\";\nimport { ProblemsFound, writeStdout } from \"./output.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":";;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CACpE;CACA,IAAI,OAAO,WAAW,MAAM,UAAU,OAAO,SAAS,kBACpD,OAAO,OAAO,KAAK;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