@r_masseater/msch 0.5.1 → 0.6.1

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","Arr","Fn","SCOPE_PREFIX","packageOf","Str","Arr","Arr","Str","Arr","Arr","Arr","Arr","Arr","Arr","Arr","Rec","Num","Str","Arr","CONFIG_FILE","Arr","Str","Fn","Arr","START","FIRST_COLUMN","Str","Arr","READ_CONCURRENCY","RULE","Str","Arr","READ_CONCURRENCY","taggedError","Str","Arr","Arr","Arr","Rec","Str","LOCKFILE","taggedError","Str","Arr","Str","Arr","Arr","nodeServicesLayer","Arr"],"sources":["../src/slots.ts","../src/values.ts","../src/flows.ts","../src/owners.ts","../src/library.ts","../src/derivation.ts","../src/shapes.ts","../src/sites.ts","../src/value-checks.ts","../src/analysis.ts","../src/duplicates.ts","../src/telemetry.ts","../src/project.ts","../src/check.ts","../src/text-position.ts","../src/hidden-unicode.ts","../src/nested-docs.ts","../src/override-findings.ts","../src/override-resolution.ts","../src/overrides.ts","../src/python.ts","../src/all-checks.ts","../src/output.ts","../src/runtime.ts","../src/cli.ts"],"sourcesContent":["import { Array as Arr, Option } from \"effect\";\n\nimport {\n isCallExpression,\n isNewExpression,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\ntype AnnotatedDeclaration =\n | ParameterDeclaration\n | VariableDeclaration\n | PropertySignatureDeclaration\n | PropertyDeclaration;\n\nconst ANNOTATED_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.Parameter,\n SyntaxKind.VariableDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotated = (declaration: Declaration): declaration is AnnotatedDeclaration =>\n ANNOTATED_KINDS.has(declaration.kind);\n\nconst annotationOf = (declaration: Declaration): Option.Option<TypeNode> =>\n Option.liftPredicate(declaration, isAnnotated).pipe(\n Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)),\n );\n\nconst argumentSlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const call = expression.parent;\n if (!isCallExpression(call) && !isNewExpression(call)) {\n return Option.none();\n }\n const { arguments: listed } = call;\n const callArguments: readonly Expression[] = listed ?? [];\n const index = callArguments.indexOf(expression);\n return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.filter(isSignatureDeclaration),\n Option.flatMap((declaration) => Arr.get(declaration.parameters, index)),\n );\n };\n\nconst propertySlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const assignment = expression.parent;\n if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(\n Option.flatMap((objectType) =>\n Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText())),\n ),\n Option.flatMap((property) => Arr.head(declarationsOf(property))),\n );\n };\n\nconst variableSlot = (expression: Expression): Option.Option<Declaration> => {\n const declaration = expression.parent;\n if (!isVariableDeclaration(declaration) || declaration.initializer !== expression) {\n return Option.none();\n }\n return Option.some(declaration);\n};\n\nconst slotOf =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> =>\n argumentSlot(checker)(expression).pipe(\n Option.orElse(() => propertySlot(checker)(expression)),\n Option.orElse(() => variableSlot(expression)),\n );\n\nconst contextSymbolsOf =\n (checker: Checker) =>\n (expression: Expression): readonly TypeSymbol[] => {\n const alias = Option.fromUndefinedOr(checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) => Option.fromUndefinedOr(contextual.getAliasSymbol())),\n );\n if (Option.isSome(alias)) {\n return [alias.value];\n }\n return slotOf(checker)(expression).pipe(\n Option.flatMap(annotationOf),\n Option.map((annotation) => referencedSymbols(checker)(annotation)),\n Option.getOrElse(() => []),\n );\n };\n\nexport { annotationOf, contextSymbolsOf, slotOf };\n","import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\ntype Value = string | number;\n\ninterface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nconst valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nconst literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nconst literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nconst schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nconst finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nconst vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nconst isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nconst sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nconst formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n\nexport {\n finiteValuesOf,\n formatValues,\n isSubsetOf,\n literalUnionOf,\n literalValuesOf,\n sameValues,\n schemaTypeOf,\n valueKey,\n vocabularyOf,\n};\nexport type { Value, Vocabulary };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getNameOfDeclaration,\n isClassDeclaration,\n isElementAccessExpression,\n isIdentifier,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isSignatureDeclaration,\n isTypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n ClassDeclaration,\n Declaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SignatureDeclaration,\n SourceFile,\n TypeSymbol,\n Type,\n} from \"./compiler.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n NODE_MODULES_SEGMENT,\n symbolAt,\n} from \"./syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\ninterface FlowContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly sites: readonly ValueSite[];\n}\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\nconst MODULE_PREFIX = /^\".*?\"\\./u;\n\nconst packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nconst externalDeclarationOf =\n (context: FlowContext) =>\n (symbol: TypeSymbol): Option.Option<Declaration> =>\n Arr.findFirst(declarationsOf(symbol), (declaration) =>\n isExternalDeclaration(context.program)(declaration),\n );\n\nconst aliasTarget =\n (context: FlowContext) =>\n (type: Type): Option.Option<string> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) =>\n externalDeclarationOf(context)(alias).pipe(\n Option.map(\n (declaration) =>\n `${Str.replace(MODULE_PREFIX, \"\")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`,\n ),\n ),\n ),\n );\n\nconst isNamedContainer = (\n node: Node,\n): node is SignatureDeclaration | InterfaceDeclaration | ClassDeclaration =>\n isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);\n\nconst slotTarget =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<string> =>\n slotOf(context.checker)(expression).pipe(\n Option.filter((slot) => isExternalDeclaration(context.program)(slot)),\n Option.filter((slot) =>\n Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot))),\n ),\n Option.map((slot) => {\n const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(\n Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))),\n Option.map((name) => ` of ${name.getText()}`),\n Option.getOrElse(() => \"\"),\n );\n const name = Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(\n Option.map((found) => found.getText()),\n Option.getOrElse(() => \"value\"),\n );\n return `${name}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;\n }),\n );\n\nconst libraryTargetOf =\n (context: FlowContext) =>\n (expression: Expression, contextual: Type): Option.Option<string> =>\n aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));\n\nconst siteWithin =\n (context: FlowContext) =>\n (node: Node): Option.Option<ValueSite> =>\n Arr.findFirst(context.sites, (site) => contains(node)(site.node));\n\nconst aliasSite =\n (context: FlowContext) =>\n (type: Type): Option.Option<ValueSite> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) => Arr.findFirst(declarationsOf(alias), isTypeAliasDeclaration)),\n Option.flatMap(siteWithin(context)),\n );\n\nconst annotationSite =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n symbolAt(context.checker)(expression).pipe(\n Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)),\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.flatMap(annotationOf),\n Option.flatMap((annotation) =>\n siteWithin(context)(annotation).pipe(\n Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))),\n ),\n ),\n );\n\nconst siteBehind =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(\n Option.orElse(() => annotationSite(context)(expression)),\n );\n\nconst isFlowSource = (node: Node): node is Expression =>\n isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst flowOf =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<Flow> =>\n Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) =>\n Option.all([\n vocabularyOf(context.checker)(contextual),\n libraryTargetOf(context)(expression, contextual),\n ]),\n ),\n Option.flatMap(([vocabulary, target]) =>\n siteBehind(context)(expression).pipe(\n Option.filter((site) => isSubsetOf(site.values, vocabulary.values)),\n Option.map((site) => ({ site, target })),\n ),\n ),\n );\n\nconst flowsIn =\n (context: FlowContext) =>\n (sourceFile: SourceFile): readonly Flow[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isFlowSource(node)),\n Arr.map((node) => flowOf(context)(node)),\n ),\n );\n\nexport { flowsIn };\nexport type { Flow, FlowContext };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"./compiler.ts\";\nimport { problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"./syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface Owner {\n readonly conceptId: string;\n readonly key: string;\n readonly name: string;\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly packageName: Option.Option<string>;\n readonly values: readonly Value[];\n}\n\ninterface OwnerScan {\n readonly owners: readonly Owner[];\n readonly problems: readonly Problem[];\n}\n\ninterface Annotated {\n readonly node: Node;\n readonly conceptId: string;\n}\n\nconst OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nconst ownerKeyOf = (declaration: Declaration): Option.Option<string> => {\n if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) {\n return Option.none();\n }\n return Option.some(`${declaration.getSourceFile().fileName}#${declaration.name.text}`);\n};\n\nconst annotationsOf = (node: Node): readonly Annotated[] =>\n pipe(\n getJSDocTags(node),\n Arr.filter((tag) => tag.tagName.text === OWNER_TAG),\n Arr.map((tag) => ({ node, conceptId: Str.trim(getTextOfJSDocComment(tag.comment) ?? \"\") })),\n );\n\nconst ANNOTATABLE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.VariableDeclaration,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyAssignment,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotatable = (node: Node): boolean => ANNOTATABLE_KINDS.has(node.kind);\n\nconst isConstList = (list: VariableDeclarationList): boolean =>\n Option.fromUndefinedOr(list.getFirstToken()).pipe(\n Option.exists((token) => token.kind === SyntaxKind.ConstKeyword),\n );\n\nconst isModuleStatementList = (list: VariableDeclarationList): boolean =>\n isVariableStatement(list.parent) && isSourceFile(list.parent.parent);\n\nconst isModuleConstList = (node: Node): node is VariableDeclarationList =>\n isVariableDeclarationList(node) && isModuleStatementList(node) && isConstList(node);\n\nconst isModuleConst = (node: Node): node is VariableDeclaration =>\n isVariableDeclaration(node) && isIdentifier(node.name) && isModuleConstList(node.parent);\n\nconst objectValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalValuesOf(\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => checker.getTypeOfSymbol(property)),\n ),\n );\n\nconst ownerValuesOf =\n (checker: Checker) =>\n (declaration: VariableDeclaration): Option.Option<readonly Value[]> => {\n const type = checker.getTypeAtLocation(declaration.name);\n return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));\n };\n\nconst annotationProblem = (message: string): ((node: Node) => Problem) =>\n problemAt({ rule: \"owner-annotation\", message });\n\nconst scanned = (owners: readonly Owner[], problems: readonly Problem[]): OwnerScan => ({\n owners,\n problems,\n});\n\nconst ownerOf =\n (project: Project) =>\n (annotated: Annotated): OwnerScan => {\n const { node, conceptId } = annotated;\n if (!isModuleConst(node)) {\n return scanned(\n [],\n [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)],\n );\n }\n if (conceptId === \"\") {\n return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);\n }\n const values = ownerValuesOf(project.checker)(node);\n return Option.match(Option.all([values, ownerKeyOf(node)]), {\n onNone: () =>\n scanned(\n [],\n [annotationProblem(`The owner of ${conceptId} holds no finite value set.`)(node)],\n ),\n onSome: ([ownedValues, key]) =>\n scanned(\n [\n {\n conceptId,\n key,\n name: node.name.getText(),\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n packageName: project.packageName,\n values: ownedValues,\n },\n ],\n [],\n ),\n });\n };\n\nconst annotatedIn = (sourceFile: SourceFile): readonly Annotated[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isAnnotatable(node)),\n Arr.flatMap((node) => annotationsOf(node)),\n );\n\nconst ownerProblem =\n (message: string) =>\n (owner: Owner): Problem => ({\n file: owner.file,\n line: owner.line,\n column: owner.column,\n rule: \"owner-annotation\",\n message,\n });\n\nconst conflictProblems = (owners: readonly Owner[]): readonly Problem[] =>\n pipe(\n owners,\n Arr.flatMap((owner, index) => {\n const earlier = Arr.take(owners, index);\n const sameConcept = pipe(\n earlier,\n Arr.filter((other) => other.conceptId === owner.conceptId),\n );\n const sameSet = pipe(\n earlier,\n Arr.filter(\n (other) => other.conceptId !== owner.conceptId && sameValues(other.values, owner.values),\n ),\n );\n return [\n ...pipe(\n Arr.take(sameConcept, FIRST_OWNER_COUNT),\n Arr.map(() =>\n ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner),\n ),\n ),\n ...pipe(\n Arr.take(sameSet, FIRST_OWNER_COUNT),\n Arr.map((other) =>\n ownerProblem(\n `The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`,\n )(owner),\n ),\n ),\n ];\n }),\n );\n\nconst ownersIn = (project: Project): OwnerScan => {\n const results = pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n annotatedIn(sourceFile),\n Arr.map((annotated) => ownerOf(project)(annotated)),\n ),\n ),\n );\n return scanned(\n pipe(\n results,\n Arr.flatMap((result) => result.owners),\n ),\n pipe(\n results,\n Arr.flatMap((result) => result.problems),\n ),\n );\n};\n\nconst combineOwnerScans = (scans: readonly OwnerScan[]): OwnerScan => {\n const owners = Arr.dedupeWith(\n pipe(\n scans,\n Arr.flatMap((scan) => scan.owners),\n ),\n (left, right) => left.key === right.key,\n );\n const problems = [\n ...pipe(\n scans,\n Arr.flatMap((scan) => scan.problems),\n ),\n ...conflictProblems(owners),\n ];\n return { owners, problems };\n};\n\nexport { OWNER_TAG, combineOwnerScans, ownerKeyOf, ownersIn };\nexport type { Owner, OwnerScan };\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { InternalSymbolName, isModuleDeclaration, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Declaration, Node, SyntaxKind, TypeSymbol, Type } from \"./compiler.ts\";\nimport type { DependencyEntry } from \"./dependencies.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"./syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"./values.ts\";\nimport type { Vocabulary } from \"./values.ts\";\n\ninterface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\ninterface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\ninterface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\ninterface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\ninterface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nconst isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nconst describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nconst locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nconst declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\ninterface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\ninterface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nconst libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nconst libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n Effect.forEach(indexEntry(cache)(checker)),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n\nexport {\n declarationKey,\n describeLibraryType,\n isObjectType,\n libraryCache,\n libraryIndex,\n locationOf,\n};\nexport type {\n CachedIndex,\n DeclarationLocation,\n LibraryCache,\n LibraryIndex,\n LibraryShape,\n LibraryType,\n LibraryVocabulary,\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { isSatisfiesExpression, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node } from \"./compiler.ts\";\nimport { declarationKey, locationOf } from \"./library.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\nconst contractOf = (node: Node): readonly Node[] => {\n const { parent } = node;\n if (isSatisfiesExpression(parent) && parent.expression === node) {\n return [parent.type];\n }\n if (isVariableDeclaration(parent) && parent.initializer === node) {\n return Option.toArray(Option.fromUndefinedOr(parent.type));\n }\n return [];\n};\n\nconst derivedDeclarationsOf =\n (checker: Checker) =>\n (node: Node): ReadonlySet<string> => {\n const scopes = Arr.prepend(contractOf(node), node);\n return new Set(\n pipe(\n scopes,\n Arr.flatMap((scope) => referencedSymbols(checker)(scope)),\n Arr.flatMap((symbol) => declarationsOf(symbol)),\n Arr.map((declaration) => declarationKey(locationOf(declaration))),\n ),\n );\n };\n\nexport { derivedDeclarationsOf };\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\nimport { declarationKey, describeLibraryType, isObjectType } from \"./library.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"./library.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { descendantsOf, isGenericDeclaration, isTypeDeclaration } from \"./syntax.ts\";\nimport { schemaTypeOf } from \"./values.ts\";\n\ninterface ShapeContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface ShapeSite {\n readonly node: Node;\n readonly type: Type;\n}\n\ninterface ShapeMatch {\n readonly shape: LibraryShape;\n readonly extra: number;\n}\n\nconst MINIMUM_SHAPE_PROPERTIES = 3;\nconst EXACT = 0;\n\nconst augmentsAModule = (node: Node): boolean => {\n const block = node.parent;\n return (\n isModuleBlock(block) && isModuleDeclaration(block.parent) && isStringLiteral(block.parent.name)\n );\n};\n\nconst isPlainInterface = (node: Node): node is InterfaceDeclaration =>\n isInterfaceDeclaration(node) && !isGenericDeclaration(node) && !augmentsAModule(node);\n\nconst isPlainTypeLiteral = (node: Node): node is TypeAliasDeclaration =>\n isTypeAliasDeclaration(node) && !isGenericDeclaration(node) && isTypeLiteralNode(node.type);\n\nconst isDeclaredShape = (node: Node): node is InterfaceDeclaration | TypeAliasDeclaration =>\n isPlainInterface(node) || isPlainTypeLiteral(node);\n\nconst declaredShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> =>\n Option.liftPredicate(node, isDeclaredShape).pipe(\n Option.map((declaration) => checker.getTypeAtLocation(declaration.name)),\n );\n\nconst schemaShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> => {\n if (!isCallExpression(node)) {\n return Option.none();\n }\n const { arguments: callArguments } = node;\n if (\n !pipe(\n callArguments,\n Arr.some((argument) => isObjectLiteralExpression(argument)),\n )\n ) {\n return Option.none();\n }\n return schemaTypeOf(checker)(checker.getTypeAtLocation(node)).pipe(\n Option.filter((type) => isObjectType(checker)(type)),\n );\n };\n\nconst shapeSitesIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly ShapeSite[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.map((node) =>\n declaredShapeOf(checker)(node).pipe(\n Option.orElse(() => schemaShapeOf(checker)(node)),\n Option.map((type) => ({ node, type })),\n ),\n ),\n ),\n );\n\ninterface LocalProperty {\n readonly name: string;\n readonly type: Type;\n}\n\ninterface OpenTypeIds {\n readonly any: number;\n readonly unknown: number;\n}\n\nconst openTypeIdsOf = (checker: Checker): OpenTypeIds => ({\n any: checker.getAnyType().id,\n unknown: checker.getUnknownType().id,\n});\n\ntype IndexedDeclaration =\n | TypeAliasDeclaration\n | InterfaceDeclaration\n | EnumDeclaration\n | VariableDeclaration;\n\nconst isIndexedDeclaration = (node: Node): node is IndexedDeclaration =>\n isTypeDeclaration(node) || isVariableDeclaration(node);\n\nconst declarationAt =\n (program: Program) =>\n (location: DeclarationLocation): Option.Option<IndexedDeclaration> =>\n Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(\n Option.flatMap((sourceFile) =>\n Arr.findFirst(\n descendantsOf(sourceFile),\n (node): node is IndexedDeclaration =>\n node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node),\n ),\n ),\n );\n\nconst symbolOfDeclaration =\n (checker: Checker) =>\n (declaration: IndexedDeclaration): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(declaration.name));\n\nconst shapeTypeOf =\n (context: ShapeContext) =>\n (shape: LibraryShape): Option.Option<Type> => {\n const { checker } = context;\n return declarationAt(context.program)(shape.declaration).pipe(\n Option.flatMap((declaration) =>\n symbolOfDeclaration(checker)(declaration).pipe(\n Option.flatMap((symbol) => {\n if (shape.form === \"declared\") {\n return Option.some(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return schemaTypeOf(checker)(checker.getTypeOfSymbolAtLocation(symbol, declaration));\n }),\n ),\n ),\n );\n };\n\nconst hasEveryName =\n (locals: readonly LocalProperty[]) =>\n (shape: LibraryShape): boolean => {\n const names: ReadonlySet<string> = new Set(shape.propertyNames);\n return pipe(\n locals,\n Arr.every((local) => names.has(local.name)),\n );\n };\n\nconst sameProperty =\n (checker: Checker, open: OpenTypeIds) =>\n (localType: Type, library: TypeSymbol): boolean => {\n const libraryType = checker.getTypeOfSymbol(library);\n return (\n libraryType.id !== open.any &&\n libraryType.id !== open.unknown &&\n checker.isTypeAssignableTo(localType, libraryType) &&\n checker.isTypeAssignableTo(libraryType, localType)\n );\n };\n\nconst matchOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (locals: readonly LocalProperty[], shape: LibraryShape): Option.Option<ShapeMatch> => {\n const { checker } = context;\n const matches = shapeTypeOf(context)(shape).pipe(\n Option.exists((shapeType) =>\n pipe(\n locals,\n Arr.every((local) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(\n Option.exists((library) => sameProperty(checker, open)(local.type, library)),\n ),\n ),\n ),\n ),\n );\n if (!matches) {\n return Option.none();\n }\n return Option.some({ shape, extra: shape.propertyNames.length - locals.length });\n };\n\nconst localPropertiesOf =\n (checker: Checker) =>\n (symbols: readonly TypeSymbol[]): readonly LocalProperty[] =>\n pipe(\n Arr.zip(symbols, checker.getTypeOfSymbol(symbols)),\n Arr.map(([symbol, type]) => ({ name: symbol.name, type })),\n );\n\nconst matchOrder = Order.mapInput(Order.Number, (match: ShapeMatch) => match.extra);\n\nconst shapeProblem = (site: ShapeSite, matches: readonly ShapeMatch[]): Problem => {\n const shown = pipe(\n Arr.take(matches, CANDIDATE_LIMIT),\n Arr.map((match) => describeLibraryType(match.shape)),\n Arr.join(\", \"),\n );\n const advice = Option.match(\n Arr.findFirst(matches, (match) => match.extra === EXACT),\n {\n onNone: () =>\n \"Derive it from the library type, for example with Pick, instead of copying its properties.\",\n onSome: () => \"Use the library type instead of copying it.\",\n },\n );\n return problemAt({ rule: \"library-shape\", message: `This shape copies ${shown}. ${advice}` })(\n site.node,\n );\n};\n\nconst candidatesOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite, locals: readonly LocalProperty[]): readonly ShapeMatch[] => {\n const derived = derivedDeclarationsOf(context.checker)(site.node);\n const named = pipe(context.shapes, Arr.filter(hasEveryName(locals)));\n if (\n pipe(\n named,\n Arr.some((shape) => derived.has(declarationKey(shape.declaration))),\n )\n ) {\n return [];\n }\n const candidates = pipe(\n named,\n Arr.map((shape) => matchOf(context, open)(locals, shape)),\n Arr.getSomes,\n );\n return Arr.sort(candidates, matchOrder);\n };\n\nconst shapeProblemOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite): Option.Option<Problem> => {\n const symbols = context.checker.getPropertiesOfType(site.type);\n if (symbols.length < MINIMUM_SHAPE_PROPERTIES) {\n return Option.none();\n }\n const locals = localPropertiesOf(context.checker)(symbols);\n return Option.liftPredicate(\n candidatesOf(context, open)(site, locals),\n Arr.isReadonlyArrayNonEmpty,\n ).pipe(Option.map((found) => shapeProblem(site, found)));\n };\n\nconst shapeProblemsIn =\n (context: ShapeContext) =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const sites = shapeSitesIn(context.checker)(sourceFile);\n if (!Arr.isReadonlyArrayNonEmpty(sites)) {\n return [];\n }\n const open = openTypeIdsOf(context.checker);\n return Arr.getSomes(\n pipe(\n sites,\n Arr.map((site) => shapeProblemOf(context, open)(site)),\n ),\n );\n };\n\nexport { shapeProblemsIn };\nexport type { ShapeContext };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isElementAccessExpression,\n isEnumDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n isSpreadElement,\n isTypeReferenceNode,\n isUnionTypeNode,\n} from \"./compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"./compiler.ts\";\nimport {\n childrenOf,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n} from \"./syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface ValueSite {\n readonly node: Node;\n readonly values: readonly Value[];\n readonly sources: readonly TypeSymbol[];\n}\n\nconst namedValuesOf =\n (checker: Checker) =>\n (symbol: TypeSymbol): Option.Option<readonly Value[]> => {\n if (\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isTypeDeclaration(declaration)),\n )\n ) {\n return finiteValuesOf(checker)(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));\n };\n\nconst hasFiniteContext =\n (checker: Checker) =>\n (node: Expression): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst isNamedValue = (element: Expression): boolean => {\n if (isSpreadElement(element)) {\n return isNamedValue(element.expression);\n }\n return (\n isIdentifier(element) ||\n isPropertyAccessExpression(element) ||\n isElementAccessExpression(element)\n );\n};\n\nconst namesEveryElement = (array: ArrayLiteralExpression): boolean =>\n pipe(\n array.elements,\n Arr.every((element) => isNamedValue(element)),\n );\n\nconst expressionValuesOf =\n (checker: Checker) =>\n (node: Expression): Option.Option<readonly Value[]> => {\n if (hasFiniteContext(checker)(node)) {\n return Option.none();\n }\n const type = checker.getTypeAtLocation(node);\n if (isArrayLiteralExpression(node)) {\n return Option.liftPredicate(node, (array) => !namesEveryElement(array)).pipe(\n Option.flatMap(() => finiteValuesOf(checker)(type)),\n );\n }\n return schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf));\n };\n\nconst selectsKeys =\n (checker: Checker) =>\n (node: UnionTypeNode, values: readonly Value[]): boolean => {\n const { parent } = node;\n if (!isTypeReferenceNode(parent)) {\n return false;\n }\n const typeArguments: readonly TypeNode[] = parent.typeArguments ?? [];\n return pipe(\n typeArguments,\n Arr.filter((argument) => argument !== node),\n Arr.some((argument) =>\n isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument))),\n ),\n );\n };\n\nconst unionValuesOf =\n (checker: Checker) =>\n (node: UnionTypeNode): Option.Option<readonly Value[]> =>\n literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(\n Option.filter((values) => !selectsKeys(checker)(node, values)),\n );\n\nconst isExpressionSite = (node: Node): node is ArrayLiteralExpression | CallExpression =>\n isArrayLiteralExpression(node) || isCallExpression(node);\n\nconst expressionSiteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> =>\n Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));\n\nconst siteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> => {\n if (isUnionTypeNode(node)) {\n return unionValuesOf(checker)(node);\n }\n if (isEnumDeclaration(node)) {\n return literalUnionOf(checker.getTypeAtLocation(node.name));\n }\n return expressionSiteValuesOf(checker)(node);\n };\n\nconst derivationScopeOf = (node: Node): Node => {\n if (isTypeReferenceNode(node.parent)) {\n return node.parent;\n }\n return node;\n};\n\nconst sourcesOf =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] =>\n pipe(\n referencedSymbols(checker)(derivationScopeOf(node)),\n Arr.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))),\n );\n\nconst sitesUnder =\n (checker: Checker) =>\n (node: Node): readonly ValueSite[] => {\n const nested = pipe(\n childrenOf(node),\n Arr.flatMap((child) => sitesUnder(checker)(child)),\n );\n if (Arr.isReadonlyArrayNonEmpty(nested)) {\n return nested;\n }\n return siteValuesOf(checker)(node).pipe(\n Option.map((values) => ({ node, values, sources: sourcesOf(checker)(node) })),\n Option.toArray,\n );\n };\n\nexport { sitesUnder };\nexport type { ValueSite };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"./compiler.ts\";\nimport type { Flow } from \"./flows.ts\";\nimport { describeLibraryType } from \"./library.ts\";\nimport type { LibraryVocabulary } from \"./library.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"./syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\ninterface SiteVerdict {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst OWNER_SEARCH_DEPTH = 4;\nconst NOTHING_HIDDEN = 0;\n\nconst directOwners =\n (context: ValueContext) =>\n (symbol: TypeSymbol): readonly Owner[] => {\n const keys = Arr.getSomes(\n pipe(\n declarationsOf(symbol),\n Arr.map((declaration) => ownerKeyOf(declaration)),\n ),\n );\n return pipe(\n context.owners,\n Arr.filter((owner) => keys.includes(owner.key)),\n );\n };\n\nconst isFollowable = (declaration: Declaration): boolean =>\n !declaration.getSourceFile().isDeclarationFile &&\n (isTypeAliasDeclaration(declaration) || isVariableDeclaration(declaration));\n\nconst ownersBehind =\n (context: ValueContext) =>\n (symbol: TypeSymbol, ancestors: readonly TypeSymbol[]): readonly Owner[] => {\n const direct = directOwners(context)(symbol);\n if (Arr.isReadonlyArrayNonEmpty(direct) || ancestors.length >= OWNER_SEARCH_DEPTH) {\n return direct;\n }\n const visited = [...ancestors, symbol];\n return uniqueByReference(\n pipe(\n declarationsOf(symbol),\n Arr.filter((declaration) => isFollowable(declaration)),\n Arr.flatMap((declaration) => referencedSymbols(context.checker)(declaration)),\n Arr.filter((referenced) => !visited.includes(referenced)),\n Arr.flatMap((referenced) => ownersBehind(context)(referenced, visited)),\n ),\n );\n };\n\nconst describeOwners = (owners: readonly Owner[]): string =>\n pipe(\n owners,\n Arr.map((owner) => `${owner.conceptId} (${owner.name})`),\n Arr.join(\", \"),\n );\n\nconst verdict = (problems: readonly Problem[], unowned: readonly ValueSite[]): SiteVerdict => ({\n problems,\n unowned,\n});\n\nconst derivedVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = uniqueByReference(\n pipe(\n site.sources,\n Arr.flatMap((source) => ownersBehind(context)(source, [])),\n ),\n );\n const held = pipe(\n owners,\n Arr.flatMap((owner) => owner.values),\n );\n const added = pipe(\n site.values,\n Arr.filter((value) => !isSubsetOf([value], held)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(owners) || !Arr.isReadonlyArrayNonEmpty(added)) {\n return verdict([], []);\n }\n const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;\n return verdict([problemAt({ rule: \"owner-extension\", message })(site.node)], []);\n };\n\nconst libraryCandidates =\n (context: ValueContext) =>\n (site: ValueSite): readonly string[] => {\n const flowing = Arr.dedupe(\n pipe(\n context.flows,\n Arr.filter((flow) => flow.site.node === site.node),\n Arr.map((flow) => flow.target),\n ),\n );\n if (Arr.isReadonlyArrayNonEmpty(flowing)) {\n return flowing;\n }\n if (\n !pipe(\n site.values,\n Arr.some((value) => typeof value === \"string\"),\n )\n ) {\n return [];\n }\n const imported = importedModulesOf(site.node.getSourceFile());\n return Arr.dedupe(\n pipe(\n context.vocabularies,\n Arr.filter((library) => imported.includes(library.specifier)),\n Arr.filter((library) => isSubsetOf(site.values, library.vocabulary.values)),\n Arr.map((library) => describeLibraryType(library)),\n ),\n );\n };\n\nconst listCandidates = (candidates: readonly string[]): string => {\n const shown = pipe(Arr.take(candidates, CANDIDATE_LIMIT), Arr.join(\", \"));\n const hidden = candidates.length - CANDIDATE_LIMIT;\n if (hidden > NOTHING_HIDDEN) {\n return `${shown} and ${String(hidden)} more`;\n }\n return shown;\n};\n\nconst originalVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = pipe(\n context.owners,\n Arr.filter((owner) => isSubsetOf(site.values, owner.values)),\n );\n if (Arr.isReadonlyArrayNonEmpty(owners)) {\n const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;\n return verdict([problemAt({ rule: \"owner-value-set\", message })(site.node)], []);\n }\n const candidates = libraryCandidates(context)(site);\n if (Arr.isReadonlyArrayNonEmpty(candidates)) {\n const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;\n return verdict([problemAt({ rule: \"library-value-set\", message })(site.node)], []);\n }\n return verdict([], [site]);\n };\n\nconst siteVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n if (Arr.isReadonlyArrayNonEmpty(site.sources)) {\n return derivedVerdict(context)(site);\n }\n return originalVerdict(context)(site);\n };\n\nconst VALUE_PARENT_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ReturnStatement,\n SyntaxKind.ArrayLiteralExpression,\n SyntaxKind.ConditionalExpression,\n SyntaxKind.ParenthesizedExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.JsxExpression,\n]);\n\nconst isCallArgument = (node: Node, parent: Node): boolean =>\n (isCallExpression(parent) || isNewExpression(parent)) && parent.expression !== node;\n\nconst isInitializer = (node: Node, parent: Node): boolean =>\n (isPropertyAssignment(parent) || isVariableDeclaration(parent)) && parent.initializer === node;\n\nconst isRightOperand = (node: Node, parent: Node): boolean =>\n isBinaryExpression(parent) && parent.right === node;\n\nconst VALUE_SLOTS = [isCallArgument, isInitializer, isRightOperand];\n\nconst isValuePosition = (node: Node): boolean => {\n const { parent } = node;\n return (\n VALUE_PARENT_KINDS.has(parent.kind) ||\n pipe(\n VALUE_SLOTS,\n Arr.some((isSlot) => isSlot(node, parent)),\n )\n );\n};\n\nconst ownedLiteralProblem =\n (context: ValueContext) =>\n (literal: StringLiteral | NumericLiteral): Option.Option<Problem> =>\n Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(\n Option.filter((contextual) =>\n vocabularyOf(context.checker)(contextual).pipe(\n Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues),\n ),\n ),\n Option.map(() =>\n pipe(\n contextSymbolsOf(context.checker)(literal),\n Arr.flatMap((symbol) => ownersBehind(context)(symbol, [])),\n uniqueByReference,\n Arr.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Arr.map(String)))),\n ),\n ),\n Option.filter((owners) => Arr.isReadonlyArrayNonEmpty(owners)),\n Option.map((owners) =>\n problemAt({\n rule: \"owned-literal\",\n message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`,\n })(literal),\n ),\n );\n\nconst ownedLiteralProblems =\n (context: ValueContext) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly Problem[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isStringLiteral(node) || isNumericLiteral(node)),\n Arr.filter((node) => isValuePosition(node)),\n Arr.filter(\n (node) =>\n !pipe(\n excluded,\n Arr.some((outer) => contains(outer)(node)),\n ),\n ),\n Arr.map((node) => ownedLiteralProblem(context)(node)),\n ),\n );\n\nexport { ownedLiteralProblems, siteVerdict };\nexport type { SiteVerdict, ValueContext };\n","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport { isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node, VariableDeclaration } from \"./compiler.ts\";\nimport { flowsIn } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesUnder } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contains, descendantsOf } from \"./syntax.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\ninterface ProjectAnalysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst isVisibleTo =\n (project: Project) =>\n (owner: Owner): boolean =>\n pipe(\n project.sourceFiles,\n Arr.some((sourceFile) => sourceFile.fileName === owner.file),\n ) ||\n Option.exists(\n owner.packageName,\n (name) =>\n Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name),\n );\n\nconst ownerDeclarationsIn = (\n project: Project,\n owners: readonly Owner[],\n): readonly VariableDeclaration[] => {\n const keys = new Set(\n pipe(\n owners,\n Arr.map((owner) => owner.key),\n ),\n );\n return pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isVariableDeclaration(node)),\n Arr.filter((declaration) => Option.exists(ownerKeyOf(declaration), (key) => keys.has(key))),\n ),\n ),\n );\n};\n\nconst isInside =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nconst sitesOutside =\n (checker: Checker) =>\n (project: Project, outers: readonly Node[]): readonly ValueSite[] =>\n pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)),\n Arr.filter((site) => !isInside(outers)(site.node)),\n );\n\nconst nodesOf = (sites: readonly ValueSite[]): readonly Node[] =>\n pipe(\n sites,\n Arr.map((site) => site.node),\n );\n\nconst analyzeProject =\n (owners: readonly Owner[]) =>\n (project: Project): ProjectAnalysis => {\n const { checker } = project;\n const ownerDeclarations = ownerDeclarationsIn(project, owners);\n const sites = sitesOutside(checker)(project, ownerDeclarations);\n const flowContext = { checker, program: project.program, sites };\n const context = {\n checker,\n owners: pipe(\n owners,\n Arr.filter((owner) => isVisibleTo(project)(owner)),\n ),\n vocabularies: project.library.vocabularies,\n flows: pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => flowsIn(flowContext)(sourceFile)),\n ),\n };\n const verdicts = pipe(\n sites,\n Arr.map((site) => siteVerdict(context)(site)),\n );\n const excluded = [...ownerDeclarations, ...nodesOf(sites)];\n const shapeContext = { checker, program: project.program, shapes: project.library.shapes };\n return {\n problems: [\n ...pipe(\n verdicts,\n Arr.flatMap((found) => found.problems),\n ),\n ...pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => [\n ...ownedLiteralProblems(context)(sourceFile, excluded),\n ...shapeProblemsIn(shapeContext)(sourceFile),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n };\n };\n\nexport { analyzeProject };\nexport type { ProjectAnalysis };\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\nimport { formatValues, valueKey } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\ninterface UnownedSite {\n readonly scope: PackageScope;\n readonly file: string;\n readonly start: number;\n readonly line: number;\n readonly column: number;\n readonly values: readonly Value[];\n}\n\nconst DUPLICATE_THRESHOLD = 1;\n\nconst unownedSiteOf =\n (scope: PackageScope) =>\n (site: ValueSite): UnownedSite => ({\n scope,\n file: site.node.getSourceFile().fileName,\n start: site.node.getStart(),\n line: lineOf(site.node),\n column: columnOf(site.node),\n values: site.values,\n });\n\nconst canDerive = (left: UnownedSite, right: UnownedSite): boolean =>\n left.scope.name === right.scope.name ||\n left.scope.dependencies.includes(right.scope.name) ||\n right.scope.dependencies.includes(left.scope.name);\n\nconst siteKey = (site: UnownedSite): string => `${site.file}#${String(site.start)}`;\n\nconst valueSetKey = (site: UnownedSite): string => {\n const keys = pipe(\n site.values,\n Arr.map((value) => valueKey(value)),\n );\n return pipe(Arr.sort(keys, Order.String), Arr.join(\"\\0\"));\n};\n\nconst duplicateProblems =\n (relative: (file: string) => string) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const unique = Arr.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));\n const groups = Rec.values(Arr.groupBy(unique, (site) => valueSetKey(site)));\n return pipe(\n groups,\n Arr.filter((group) => group.length > DUPLICATE_THRESHOLD),\n Arr.flatMap((group) =>\n pipe(\n group,\n Arr.flatMap((site): readonly Problem[] => {\n const related = pipe(\n group,\n Arr.filter((other) => other !== site && canDerive(site, other)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(related)) {\n return [];\n }\n const others = pipe(\n related,\n Arr.map((other) => `${relative(other.file)}:${String(other.line)}`),\n Arr.join(\", \"),\n );\n return [\n {\n file: site.file,\n line: site.line,\n column: site.column,\n rule: \"duplicate-value-set\",\n message: `The values ${formatValues(site.values)} are also declared at ${others}. Register one owner with /** @${OWNER_TAG} <concept> */ and derive the others from it.`,\n },\n ];\n }),\n ),\n ),\n );\n };\n\nexport { duplicateProblems, unownedSiteOf };\nexport type { PackageScope, UnownedSite };\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"./compiler.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* pipe(\n pids,\n Effect.forEach((pid) => residentBytesOf(pid)),\n );\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nconst annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n\nexport { annotateResources };\n","import { Array as Arr, Effect, Function as Fn, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { API, getLeadingCommentRanges } from \"./compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"./compiler.ts\";\nimport {\n MANIFEST_FILE,\n NODE_MODULES,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"./dependencies.ts\";\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\ninterface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst listConfigFiles = (\n directory: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const visible = pipe(\n names,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name) && !SKIPPED_DIRECTORIES.has(name)),\n Arr.map((name) => files.join(directory, name)),\n );\n const nested = yield* Fn.pipe(\n visible,\n Effect.forEach((entryPath) =>\n files.isDirectory(entryPath).pipe(\n Effect.flatMap(\n Option.match({\n onNone: (): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.succeed([]),\n onSome: (\n directoryEntry,\n ): Effect.Effect<readonly string[], never, RepositoryFiles> => {\n if (directoryEntry) {\n return listConfigFiles(entryPath);\n }\n return Effect.succeed(\n Arr.filter([entryPath], () => files.basename(entryPath) === CONFIG_FILE),\n );\n },\n }),\n ),\n ),\n ),\n );\n return Arr.sort(nested.flat(), Order.String);\n });\n\nconst parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\ninterface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\ninterface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nconst typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nconst withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nconst mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* pipe(\n fileNames,\n Effect.forEach((fileName) => files.readFile(fileName)),\n );\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n\nexport { listConfigFiles, mentions, typeScriptCompiler, withProject };\nexport type { Compiler, Project, Workspace };\n","import { Effect, Option, Array as Arr, pipe } from \"effect\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope, UnownedSite } from \"./duplicates.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.ts\";\nimport { sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { listConfigFiles, mentions, typeScriptCompiler, withProject } from \"./project.ts\";\nimport type { Project, Workspace } from \"./project.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst scanOwners = Effect.fn(\"scanOwners\")(function* scanOwners(\n workspace: Workspace,\n configPaths: readonly string[],\n) {\n const ownerConfigs = yield* pipe(\n configPaths,\n Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)),\n );\n const scans = yield* pipe(\n ownerConfigs,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))),\n ),\n );\n return combineOwnerScans(Arr.getSomes(scans));\n});\n\nconst scopeOf = (project: Project, configPath: string): PackageScope => ({\n name: Option.getOrElse(project.packageName, () => configPath),\n dependencies: project.workspaceDependencies,\n});\n\ninterface Analysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly UnownedSite[];\n}\n\nconst analyzeProjects =\n (workspace: Workspace, owners: readonly Owner[]) =>\n (configPaths: readonly string[]): Effect.Effect<readonly Analysis[], never, RepositoryFiles> =>\n pipe(\n configPaths,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject(owners)(project);\n const scope = scopeOf(project, configPath);\n return {\n problems: analysis.problems,\n unowned: pipe(analysis.unowned, Arr.map(unownedSiteOf(scope))),\n };\n }).pipe(Effect.withSpan(\"analyzeProject\")),\n ),\n ),\n Effect.map(Arr.getSomes),\n );\n\nconst checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(root: string) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const generated = yield* files.generatedFiles(root);\n const workspace: Workspace = { compiler, root, generated };\n const configPaths = yield* listConfigFiles(root);\n const ownerScan: OwnerScan = yield* scanOwners(workspace, configPaths);\n const analyses = yield* analyzeProjects(workspace, ownerScan.owners)(configPaths);\n const relative = (file: string): string => files.relative(root, file);\n const unowned = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.unowned),\n );\n return sortProblems([\n ...ownerScan.problems,\n ...pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.problems),\n ),\n ...duplicateProblems(relative)(unowned),\n ]);\n}, Effect.scoped);\n\nexport { checkRepository };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nconst positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n\nexport { positionOf };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst HIDDEN =\n /[\\u00AD\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u2069\\uFEFF]|[\\u{E0000}-\\u{E007F}]/gu;\n\nconst NUL = \"\\0\";\nconst START = 0;\nconst HEX = 16;\nconst CODE_POINT_WIDTH = 4;\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"hidden-unicode\";\n\nconst hexOf = (character: string): string =>\n pipe(\n Str.codePointAt(START)(character),\n Option.getOrElse(() => START),\n (code) => code.toString(HEX),\n Str.toUpperCase,\n Str.padStart(CODE_POINT_WIDTH, \"0\"),\n );\n\nconst problemOf =\n (file: string, source: string) =>\n (found: RegExpMatchArray): Problem => {\n const hex = hexOf(found[START]);\n return {\n file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\\\u${hex}.`,\n };\n };\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n if (Str.includes(NUL)(source)) {\n return [];\n }\n return pipe(Arr.fromIterable(Str.matchAll(HIDDEN)(source)), Arr.map(problemOf(file, source)));\n};\n\n/** @internal */\nconst checkHiddenUnicode = Effect.fn(\"checkHiddenUnicode\")(function* checkHiddenUnicode(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(file, source),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\nexport { checkHiddenUnicode };\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst SEPARATOR = \"/\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst README = /^README(?:\\.[^/]+)?$/iu;\n\nconst Published = Schema.Struct({ publish: Schema.Literal(true) });\nconst WorkspaceConfig = Schema.Struct({ msch: Published });\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nconst isNested = (name: string): boolean => Str.includes(SEPARATOR)(name);\n\nconst isPublished = Effect.fn(\"isPublished\")(function* isPublished(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n if (!(yield* files.exists(file))) {\n return false;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(WorkspaceConfig)), Option.isSome);\n});\n\nconst problemFor = (file: string, message: string): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message,\n});\n\nconst AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.\";\nconst README_MESSAGE =\n \"is allowed below the root only in a workspace published to npm, marked by msch: { publish: true } in its vite.config.ts. Set it there if the workspace is published, or move the content into the root README.md and delete this file.\";\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const base = files.basename(name);\n const file = files.join(root, name);\n if (AGENT_DOCS.test(base)) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (!README.test(base)) {\n return Option.none<Problem>();\n }\n if (yield* isPublished(root, files.dirname(name))) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n});\n\n/** @internal */\nconst checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\nexport { checkNestedDocs };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst describeVersions = (versions: readonly string[]): string =>\n Option.getOrElse(\n Option.liftPredicate(Arr.join(versions, \",\"), (joined) => joined !== \"\"),\n () => \"-\",\n );\n\nconst describeChanges = (report: OverrideReport): string => {\n const versions = pipe(\n report.changes,\n Arr.map(\n (change) =>\n `${change.name} ${describeVersions(change.before)} -> ${describeVersions(change.after)}`,\n ),\n );\n const contexts = Arr.filter([\"the peer contexts\"], () => report.peerContextsChanged);\n return Arr.join([...versions, ...contexts], \"; \");\n};\n\ninterface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nconst overrideProblem =\n (located: LocatedOverride) =>\n (report: OverrideReport): Option.Option<Problem> => {\n const at = { file: located.file, line: located.line, column: located.column };\n if (report.verdict === \"unused\") {\n return Option.some({\n ...at,\n rule: \"unused-override\",\n message: `Every package resolves the same way without the override ${report.key}. Remove it.`,\n });\n }\n if (report.verdict === \"verify\") {\n return Option.some({\n ...at,\n rule: \"removable-override\",\n message: `Removing the override ${report.key} changes ${describeChanges(report)} without new peer issues or advisories. Remove it and run verify.`,\n });\n }\n return Option.none();\n };\n\nexport { overrideProblem };\nexport type { LocatedOverride };\n","import { Array as Arr, Option, Order, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { LineCounter, isMap, isScalar, parseAllDocuments, parseDocument } from \"yaml\";\n\nconst VerdictSchema = Schema.Literals([\"unused\", \"keep\", \"verify\"]);\n\nconst PackageChangeSchema = Schema.Struct({\n name: Schema.String,\n before: Schema.Array(Schema.String),\n after: Schema.Array(Schema.String),\n});\n\nconst OverrideReportSchema = Schema.Struct({\n key: Schema.String,\n verdict: VerdictSchema,\n changes: Schema.Array(PackageChangeSchema),\n peerContextsChanged: Schema.Boolean,\n peerIssues: Schema.Array(Schema.String),\n advisories: Schema.Array(Schema.String),\n});\n\ntype OverrideReport = typeof OverrideReportSchema.Type;\ntype PackageChange = typeof PackageChangeSchema.Type;\n\nconst PeerParentSchema = Schema.Struct({ name: Schema.String, version: Schema.String });\n\nconst PeerIssueSchema = Schema.Struct({\n parents: Schema.Array(PeerParentSchema),\n wantedRange: Schema.String,\n foundVersion: Schema.optionalKey(Schema.String),\n});\n\ntype PeerIssue = typeof PeerIssueSchema.Type;\n\nconst ProjectPeerIssuesSchema = Schema.Struct({\n bad: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n missing: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n conflicts: Schema.Array(Schema.String),\n});\n\ntype ProjectPeerIssues = typeof ProjectPeerIssuesSchema.Type;\n\nconst PeerIssuesLog = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.Literal(\"pnpm:peer-dependency-issues\"),\n issuesByProjects: Schema.Record(Schema.String, ProjectPeerIssuesSchema),\n }),\n);\n\ninterface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\ninterface Resolution extends Findings {\n readonly versions: Readonly<Record<string, readonly string[]>>;\n readonly snapshots: readonly string[];\n}\n\nconst AdvisorySchema = Schema.Struct({\n module_name: Schema.String,\n github_advisory_id: Schema.String,\n});\n\nconst AuditReport = Schema.fromJsonString(\n Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }),\n);\n\nconst SCOPE_PREFIX = \"@\";\nconst NAME_START = 0;\nconst SEPARATOR_LENGTH = 1;\nconst PEER_CONTEXT_START = \"(\";\n\nconst sorted = (values: readonly string[]): readonly string[] =>\n Arr.sort(Arr.dedupe(values), Order.String);\n\nconst describeIssue =\n (project: string, kind: string) =>\n ([peer, issues]: readonly [string, readonly PeerIssue[]]): readonly string[] =>\n pipe(\n issues,\n Arr.map((issue) => {\n const dependent = Option.match(Arr.last(issue.parents), {\n onNone: () => project,\n onSome: (parent) => `${parent.name}@${parent.version}`,\n });\n const found = Option.getOrElse(Option.fromUndefinedOr(issue.foundVersion), () => \"none\");\n return `${project}: ${kind} peer ${peer}@${issue.wantedRange} of ${dependent}, found ${found}`;\n }),\n );\n\nconst issuesOfProject = ([project, issues]: readonly [\n string,\n ProjectPeerIssues,\n]): readonly string[] => [\n ...pipe(Rec.toEntries(issues.bad), Arr.flatMap(describeIssue(project, \"unmet\"))),\n ...pipe(Rec.toEntries(issues.missing), Arr.flatMap(describeIssue(project, \"missing\"))),\n ...pipe(\n issues.conflicts,\n Arr.map((peer) => `${project}: conflicting peer ${peer}`),\n ),\n];\n\nconst peerIssuesIn = (output: string): readonly string[] =>\n sorted(\n pipe(\n Str.split(output, \"\\n\"),\n Arr.map((line) => Schema.decodeOption(PeerIssuesLog)(line)),\n Arr.getSomes,\n Arr.flatMap((log) => pipe(Rec.toEntries(log.issuesByProjects), Arr.flatMap(issuesOfProject))),\n ),\n );\n\nconst advisoriesIn = (output: string): readonly string[] =>\n Option.match(Schema.decodeOption(AuditReport)(output), {\n onNone: () => [],\n onSome: (report) =>\n sorted(\n pipe(\n Rec.values(report.advisories),\n Arr.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`),\n ),\n ),\n });\n\nconst separatorOf = (key: string): Option.Option<number> => {\n if (!Str.startsWith(SCOPE_PREFIX)(key)) {\n return Str.indexOf(SCOPE_PREFIX)(key);\n }\n return pipe(\n Str.slice(SEPARATOR_LENGTH)(key),\n Str.indexOf(SCOPE_PREFIX),\n Option.map((index) => index + SEPARATOR_LENGTH),\n );\n};\n\nconst withoutPeerContext = (version: string): string =>\n Option.match(Str.indexOf(PEER_CONTEXT_START)(version), {\n onNone: () => version,\n onSome: (start) => Str.slice(NAME_START, start)(version),\n });\n\nconst packageOf = (key: string): Option.Option<readonly [string, string]> =>\n Option.map(separatorOf(key), (separator) => [\n Str.slice(NAME_START, separator)(key),\n withoutPeerContext(Str.slice(separator + SEPARATOR_LENGTH)(key)),\n ]);\n\nconst keysOf = (node: unknown): readonly string[] => {\n if (!isMap(node)) {\n return [];\n }\n return pipe(\n node.items,\n Arr.flatMap((pair): readonly string[] => {\n if (isScalar(pair.key)) {\n return [String(pair.key.value)];\n }\n return [];\n }),\n );\n};\n\nconst lockfileKeysOf = (lockfile: string, section: string): readonly string[] =>\n pipe(\n parseAllDocuments(lockfile),\n Arr.flatMap((document) => keysOf(document.get(section))),\n );\n\nconst resolutionOf =\n (findings: Findings) =>\n (lockfile: string): Resolution => {\n const snapshots = lockfileKeysOf(lockfile, \"snapshots\");\n const packages = Arr.getSomes(\n pipe(\n [...lockfileKeysOf(lockfile, \"packages\"), ...snapshots],\n Arr.map((key) => packageOf(key)),\n ),\n );\n const versions = Rec.map(\n Arr.groupBy(packages, ([name]) => name),\n (entries) =>\n sorted(\n pipe(\n entries,\n Arr.map(([, version]) => version),\n ),\n ),\n );\n return { ...findings, versions, snapshots: sorted(snapshots) };\n };\n\nconst changesBetween = (baseline: Resolution, candidate: Resolution): readonly PackageChange[] =>\n pipe(\n sorted([...Rec.keys(baseline.versions), ...Rec.keys(candidate.versions)]),\n Arr.map((name) => ({\n name,\n before: baseline.versions[name] ?? [],\n after: candidate.versions[name] ?? [],\n })),\n Arr.filter((change) => Arr.join(change.before, \" \") !== Arr.join(change.after, \" \")),\n );\n\nconst growsThePackageSet = (change: PackageChange): boolean =>\n change.after.length > change.before.length;\n\nconst needsTheOverride = (\n found: Pick<OverrideReport, \"changes\" | \"peerIssues\" | \"advisories\">,\n): boolean =>\n pipe(\n found.changes,\n Arr.some((change) => growsThePackageSet(change)),\n ) ||\n Arr.isReadonlyArrayNonEmpty(found.peerIssues) ||\n Arr.isReadonlyArrayNonEmpty(found.advisories);\n\nconst judge =\n (baseline: Resolution) =>\n (key: string, candidate: Resolution): OverrideReport => {\n const changes = changesBetween(baseline, candidate);\n const peerIssues = Arr.difference(candidate.peerIssues, baseline.peerIssues);\n const advisories = Arr.difference(candidate.advisories, baseline.advisories);\n const peerContextsChanged =\n Arr.join(baseline.snapshots, \" \") !== Arr.join(candidate.snapshots, \" \");\n const found = { key, changes, peerContextsChanged, peerIssues, advisories };\n if (!Arr.isReadonlyArrayNonEmpty(changes) && !peerContextsChanged) {\n return { ...found, verdict: \"unused\" };\n }\n if (needsTheOverride(found)) {\n return { ...found, verdict: \"keep\" };\n }\n return { ...found, verdict: \"verify\" };\n };\n\nconst OVERRIDES = \"overrides\";\nconst BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\n\ninterface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst overrideKeysOf = (manifest: string): readonly OverrideKey[] => {\n const lineCounter = new LineCounter();\n const overrides = parseDocument(manifest, { lineCounter }).get(OVERRIDES);\n if (!isMap(overrides)) {\n return [];\n }\n return pipe(\n overrides.items,\n Arr.flatMap((pair): readonly OverrideKey[] => {\n const { key } = pair;\n if (!isScalar(key)) {\n return [];\n }\n return pipe(\n Option.fromNullishOr(key.range),\n Option.map(([start]) => {\n const { line, col } = lineCounter.linePos(start);\n return { key: String(key.value), line, column: col };\n }),\n Option.toArray,\n );\n }),\n );\n};\n\nconst withoutOverride =\n (key: string) =>\n (manifest: string): string => {\n const document = parseDocument(manifest);\n document.deleteIn([OVERRIDES, key]);\n return document.toString();\n };\n\nconst withBaselineProbe = (manifest: string): string => {\n const document = parseDocument(manifest);\n document.setIn([OVERRIDES, BASELINE_PROBE], REMOVED_DEPENDENCY);\n return document.toString();\n};\n\nexport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n};\nexport type { Findings, OverrideKey, OverrideReport, Resolution };\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { overrideProblem } from \"./override-findings.ts\";\nimport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n} from \"./override-resolution.ts\";\nimport type { OverrideKey } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst RESOLUTION_FILES = [\"*package.json\", WORKSPACE_FILE, LOCKFILE, \".npmrc\", \"patches/*\"];\nconst RESOLUTION_CONCURRENCY = 4;\nconst SUCCEEDED = 0;\n\nconst taggedError = Schema.TaggedError;\n\nclass OverrideResolutionFailed extends taggedError<\n OverrideResolutionFailed,\n { readonly brand: unique symbol }\n>()(\"OverrideResolutionFailed\", { override: Schema.String, output: Schema.String }) {}\n\ntype CandidateFailure = OverrideResolutionFailed | PlatformError.PlatformError;\ntype CandidateServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\ninterface Workspace {\n readonly root: string;\n readonly files: readonly string[];\n readonly manifest: string;\n}\n\nconst textOf = <Failure>(\n stream: Stream.Stream<Uint8Array, Failure>,\n): Effect.Effect<string, Failure> => stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst resolveIn = Effect.fn(\"resolveIn\")(function* resolveIn(directory: string, override: string) {\n const handle = yield* ChildProcess.make(\n \"vp\",\n [\"install\", \"--lockfile-only\", \"--ignore-scripts\", \"--\", \"--reporter=ndjson\"],\n { cwd: directory, env: { CI: \"true\" }, extendEnv: true, stdin: \"ignore\" },\n );\n const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n if (Number(status) !== SUCCEEDED) {\n return yield* OverrideResolutionFailed.make({ override, output });\n }\n return output;\n});\n\nconst auditIn = Effect.fn(\"auditIn\")(function* auditIn(directory: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"pm\", \"audit\", \"--json\"], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n return advisoriesIn(report);\n}, Effect.scoped);\n\nconst trackedResolutionFiles = Effect.fn(\"trackedResolutionFiles\")(function* trackedFiles(\n root: string,\n) {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", \"--\", ...RESOLUTION_FILES], {\n cwd: root,\n });\n const listed = yield* textOf(handle.stdout);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n}, Effect.scoped);\n\nconst copyFiles = Effect.fn(\"copyFiles\")(function* copyFiles(\n workspace: Workspace,\n directory: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const copyOne = (file: string): Effect.Effect<void, PlatformError.PlatformError> => {\n const target = path.join(directory, file);\n const copy = fs.copyFile(path.join(workspace.root, file), target);\n return fs.makeDirectory(path.dirname(target), { recursive: true }).pipe(Effect.andThen(copy));\n };\n yield* Effect.forEach(workspace.files, copyOne, { discard: true });\n});\n\nconst resolutionWith = Effect.fn(\"resolutionWith\")(function* resolutionWith(\n workspace: Workspace,\n override: string,\n manifest: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-overrides-\" });\n yield* copyFiles(workspace, directory);\n yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE), manifest);\n const output = yield* resolveIn(directory, override);\n const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE));\n yield* Effect.annotateCurrentSpan({ \"msch.override\": override });\n const advisories = yield* auditIn(directory);\n return resolutionOf({ peerIssues: peerIssuesIn(output), advisories })(lockfile);\n}, Effect.scoped);\n\nconst problemsFor = Effect.fn(\"problemsFor\")(function* problemsFor(\n root: string,\n manifest: string,\n keys: readonly OverrideKey[],\n) {\n const path = yield* Path.Path;\n const files = yield* trackedResolutionFiles(root);\n const workspace: Workspace = { root, files, manifest };\n const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));\n const judgeAgainstBaseline = judge(baseline);\n const file = path.join(root, WORKSPACE_FILE);\n const problemOf = (\n located: OverrideKey,\n ): Effect.Effect<Option.Option<Problem>, CandidateFailure, CandidateServices> =>\n resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(\n Effect.map((candidate) =>\n overrideProblem({ ...located, file })(judgeAgainstBaseline(located.key, candidate)),\n ),\n );\n const problems = yield* Effect.forEach(keys, problemOf, {\n concurrency: RESOLUTION_CONCURRENCY,\n });\n return Arr.getSomes(problems);\n});\n\n/** @internal */\nconst checkOverrides = Effect.fn(\"checkOverrides\")(function* checkOverrides(root: string) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE)).pipe(Effect.option);\n const keys = Option.match(manifest, { onNone: () => [], onSome: overrideKeysOf });\n if (Option.isNone(manifest) || !Arr.isReadonlyArrayNonEmpty(keys)) {\n return [];\n }\n return yield* problemsFor(root, manifest.value, keys);\n});\n\nexport { checkOverrides };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst PYTHON_FILE =\n /(?:\\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\\/)(?:pyproject\\.toml|uv\\.lock|uv\\.toml|poetry\\.lock|Pipfile|Pipfile\\.lock|setup\\.cfg|tox\\.ini|pytest\\.ini|\\.python-version|requirements[^/]*\\.txt))$/u;\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:Dockerfile[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])python[\\d.]*[ \\t]+(?:[-\"'$./]|\\S+\\.py\\b)/gu,\n /(?<![\\w./@-])pip3?[ \\t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\\b/gu,\n /(?<![\\w./@-])pipx[ \\t]+(?:run|install|inject|upgrade)\\b/gu,\n /(?<![\\w./@-])uvx[ \\t]+[^\\s=:,;)|&]/gu,\n /(?<![\\w./@-])uv[ \\t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\\b/gu,\n /(?<![\\w./@-])poetry[ \\t]+(?:run|install|add|lock|build|publish|shell|export)\\b/gu,\n /(?:\\bcommand[\"']?\\s*[:=]\\s*|(?:\\bspawn\\w*|\\bexec\\w*|\\bexeca|Command::new|ChildProcess\\.make|\\$)\\(\\s*)[\"'`](?:python[\\d.]*|pip3?|pipx|uvx?|poetry)[\"'`]/gu,\n /\\buses:\\s*[\"']?(?:actions\\/setup-python|astral-sh\\/setup-uv|astral-sh\\/ruff-action|pypa\\/[\\w.-]+|snok\\/install-poetry|abatilo\\/actions-poetry|conda-incubator\\/setup-miniconda|mamba-org\\/setup-micromamba|pdm-project\\/setup-pdm)\\b/gu,\n];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^\"'\\s=]+)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst READ_CONCURRENCY = 64;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"python-file\";\nconst COMMAND_RULE: RuleName = \"python-command\";\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst fileProblem = ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: FILE_RULE,\n message: \"Python is not used in this repository. Replace this file with TypeScript or Rust.\",\n});\n\nconst patternsFor = (name: string): readonly RegExp[] => {\n if (TOOL_VERSIONS.test(name)) {\n return [...COMMAND_PATTERNS, ...TOOL_PATTERNS];\n }\n return COMMAND_PATTERNS;\n};\n\nconst commandProblem =\n ({ file }: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: COMMAND_RULE,\n message: `Python is not used in this repository. Remove \\`${Str.trim(found[WHOLE_MATCH])}\\` and do the work in TypeScript or Rust.`,\n });\n\nconst commandProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n patternsFor(entry.name),\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map(commandProblem(entry, source)),\n );\n\nconst isPython = ({ name }: Listed): boolean => PYTHON_FILE.test(name);\n\nconst isScanned = (entry: Listed): boolean =>\n !isPython(entry) && SCANNED_FILE.test(entry.name) && !LOCKFILE.test(entry.name);\n\n/** @internal */\nconst checkPython = Effect.fn(\"checkPython\")(function* checkPython(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const listed = pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n const problemsIn = (entry: Listed): Effect.Effect<readonly Problem[]> =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => commandProblems(entry, source),\n }),\n ),\n );\n const scanned = yield* Effect.forEach(pipe(listed, Arr.filter(isScanned)), problemsIn, {\n concurrency: READ_CONCURRENCY,\n });\n const present = yield* Effect.filter(pipe(listed, Arr.filter(isPython)), ({ file }) =>\n files.exists(file),\n );\n return [...pipe(present, Arr.map(fileProblem)), ...Arr.flatten(scanned)];\n});\n\nexport { checkPython };\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkRepository } from \"./check.ts\";\nimport { checkHiddenUnicode } from \"./hidden-unicode.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkOverrides } from \"./overrides.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { checkPython } from \"./python.ts\";\n\n/** @internal */\nconst checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkHiddenUnicode>\n >,\n Effect.Services<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkHiddenUnicode>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkRepository(root),\n checkOverrides(root),\n checkHiddenUnicode(root),\n checkPython(root),\n checkNestedDocs(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n\nexport { checkAll };\n","import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nclass ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nconst writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n\nexport { ProblemsFound, writeStdout };\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServicesLayer } from \"@effect/platform-node/NodeServices\";\nimport { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { ProblemsFound } from \"./output.ts\";\nimport { nodeRepositoryFiles } from \"./repository-files.ts\";\nimport type { RepositoryFiles } from \"./repository-files.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\nconst tracing = Otlp.layerFromConfig({ resource: { serviceName: \"msch\" } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n);\n\nconst runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n >,\n): void => {\n const services = Layer.mergeAll(nodeRepositoryFiles, tracing).pipe(\n Layer.provideMerge(nodeServicesLayer),\n );\n const main = Layer.build(services).pipe(\n Effect.flatMap((context) =>\n Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context),\n ),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n\n/** @internal */\nexport { runCli };\n","#!/usr/bin/env node\nimport { Effect, Schema, Stdio, Array as Arr, pipe } from \"effect\";\n\nimport { checkAll } from \"./all-checks.ts\";\nimport { JSON_FLAG } from \"./cli-contract.ts\";\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { runCli } from \"./runtime.ts\";\n\nconst NO_PROBLEMS = 0;\n\nconst reportText = (\n root: string,\n problems: readonly Problem[],\n): Effect.Effect<void, ProblemsFound, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n if (problems.length > NO_PROBLEMS) {\n return yield* ProblemsFound.make({ count: problems.length });\n }\n return yield* Effect.void;\n });\n\nconst msch = Effect.gen(function* msch() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const root = files.resolve(\".\");\n const found = yield* checkAll(root);\n const problems = sortProblems(found);\n if (args.includes(JSON_FLAG)) {\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);\n return yield* writeStdout(text);\n }\n return yield* reportText(root, problems);\n});\n\nrunCli(msch);\n"],"mappings":";;;;;;;;;;;AA8BA,MAAM,kCAA2C,IAAI,IAAI;CACvD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,eAAe,gBACnB,gBAAgB,IAAI,YAAY,IAAI;AAEtC,MAAM,gBAAgB,gBACpB,OAAO,cAAc,aAAa,WAAW,CAAC,CAAC,KAC7C,OAAO,SAAS,cAAc,OAAO,gBAAgB,UAAU,IAAI,CAAC,CACtE;AAEF,MAAM,gBACH,aACA,eAAuD;CACtD,MAAM,OAAO,WAAW;CACxB,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,gBAAgB,IAAI,GAClD,OAAO,OAAO,KAAK;CAErB,MAAM,EAAE,WAAW,WAAW;CAE9B,MAAM,SADuC,UAAU,CAAC,EAAA,CAC5B,QAAQ,UAAU;CAC9C,OAAO,OAAO,gBAAgB,QAAQ,qBAAqB,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,KAC5E,OAAO,SAAS,WAAW,OAAO,gBAAgB,OAAO,QAAQ,CAAC,CAAC,GACnE,OAAO,OAAO,sBAAsB,GACp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OAAO,OAAO,OAAO;AACvB,CAAC;AAgBH,OAda,OAAO,IAAI,UAAU,OAAO;CACvC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,OAAO,MAAM,QAAQ,GAAG;CAC9B,MAAM,QAAQ,OAAO,SAAS,IAAI;CAClC,MAAM,WAAW,aAAa,KAAK;CACnC,IAAI,KAAK,SAAA,QAAkB,GAAG;EAC5B,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ;EACpF,OAAO,OAAO,YAAY,IAAI;CAChC;CACA,OAAO,OAAO,WAAW,MAAM,QAAQ;AACzC,CAEO,CAAI"}
1
+ {"version":3,"file":"cli.mjs","names":["Arr","Arr","Fn","SCOPE_PREFIX","SCOPED_SEGMENTS","packageOf","Str","Arr","Arr","Str","Arr","Arr","Arr","Arr","childrenOf","Arr","Arr","Arr","Rec","Num","Str","Arr","CONFIG_FILE","Arr","Str","Fn","Arr","START","FIRST_COLUMN","Str","Arr","START","READ_CONCURRENCY","RULE","Str","Arr","SEPARATOR","Str","Arr","Rec","keysOf","Rec","Arr","Num","Str","SEPARATOR","Rec","Arr","Str","SEPARATOR","READ_CONCURRENCY","taggedError","Arr","Str","Rec","Arr","Str","Num","Rec","keysOf","READ_CONCURRENCY","Str","Arr","Arr","Arr","Rec","Str","LOCKFILE","taggedError","Str","Arr","Str","Arr","Arr","Arr"],"sources":["../src/slots.ts","../src/values.ts","../src/flows.ts","../src/owners.ts","../src/library.ts","../src/derivation.ts","../src/shapes.ts","../src/sites.ts","../src/value-checks.ts","../src/analysis.ts","../src/duplicates.ts","../src/telemetry.ts","../src/project.ts","../src/check.ts","../src/text-position.ts","../src/hidden-unicode.ts","../src/import-graph.ts","../src/installed-closure.ts","../src/public-entries.ts","../src/published.ts","../src/install-size.ts","../src/nested-docs.ts","../src/override-findings.ts","../src/override-resolution.ts","../src/overrides.ts","../src/python.ts","../src/all-checks.ts","../src/output.ts","../src/runtime.ts","../src/cli.ts"],"sourcesContent":["import { Array as Arr, Option } from \"effect\";\n\nimport {\n isCallExpression,\n isNewExpression,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\ntype AnnotatedDeclaration =\n | ParameterDeclaration\n | VariableDeclaration\n | PropertySignatureDeclaration\n | PropertyDeclaration;\n\nconst ANNOTATED_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.Parameter,\n SyntaxKind.VariableDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotated = (declaration: Declaration): declaration is AnnotatedDeclaration =>\n ANNOTATED_KINDS.has(declaration.kind);\n\nconst annotationOf = (declaration: Declaration): Option.Option<TypeNode> =>\n Option.liftPredicate(declaration, isAnnotated).pipe(\n Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)),\n );\n\nconst argumentSlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const call = expression.parent;\n if (!isCallExpression(call) && !isNewExpression(call)) {\n return Option.none();\n }\n const { arguments: listed } = call;\n const callArguments: readonly Expression[] = listed ?? [];\n const index = callArguments.indexOf(expression);\n return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.filter(isSignatureDeclaration),\n Option.flatMap((declaration) => Arr.get(declaration.parameters, index)),\n );\n };\n\nconst propertySlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const assignment = expression.parent;\n if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(\n Option.flatMap((objectType) =>\n Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText())),\n ),\n Option.flatMap((property) => Arr.head(declarationsOf(property))),\n );\n };\n\nconst variableSlot = (expression: Expression): Option.Option<Declaration> => {\n const declaration = expression.parent;\n if (!isVariableDeclaration(declaration) || declaration.initializer !== expression) {\n return Option.none();\n }\n return Option.some(declaration);\n};\n\nconst slotOf =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> =>\n argumentSlot(checker)(expression).pipe(\n Option.orElse(() => propertySlot(checker)(expression)),\n Option.orElse(() => variableSlot(expression)),\n );\n\nconst contextSymbolsOf =\n (checker: Checker) =>\n (expression: Expression): readonly TypeSymbol[] => {\n const alias = Option.fromUndefinedOr(checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) => Option.fromUndefinedOr(contextual.getAliasSymbol())),\n );\n if (Option.isSome(alias)) {\n return [alias.value];\n }\n return slotOf(checker)(expression).pipe(\n Option.flatMap(annotationOf),\n Option.map((annotation) => referencedSymbols(checker)(annotation)),\n Option.getOrElse(() => []),\n );\n };\n\nexport { annotationOf, contextSymbolsOf, slotOf };\n","import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\ntype Value = string | number;\n\ninterface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nconst valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nconst literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nconst literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nconst schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nconst finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nconst vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nconst isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nconst sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nconst formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n\nexport {\n finiteValuesOf,\n formatValues,\n isSubsetOf,\n literalUnionOf,\n literalValuesOf,\n sameValues,\n schemaTypeOf,\n valueKey,\n vocabularyOf,\n};\nexport type { Value, Vocabulary };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getNameOfDeclaration,\n isClassDeclaration,\n isElementAccessExpression,\n isIdentifier,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isSignatureDeclaration,\n isTypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n ClassDeclaration,\n Declaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SignatureDeclaration,\n SourceFile,\n TypeSymbol,\n Type,\n} from \"./compiler.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n NODE_MODULES_SEGMENT,\n symbolAt,\n} from \"./syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\ninterface FlowContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly sites: readonly ValueSite[];\n}\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\nconst MODULE_PREFIX = /^\".*?\"\\./u;\n\nconst packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nconst externalDeclarationOf =\n (context: FlowContext) =>\n (symbol: TypeSymbol): Option.Option<Declaration> =>\n Arr.findFirst(declarationsOf(symbol), (declaration) =>\n isExternalDeclaration(context.program)(declaration),\n );\n\nconst aliasTarget =\n (context: FlowContext) =>\n (type: Type): Option.Option<string> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) =>\n externalDeclarationOf(context)(alias).pipe(\n Option.map(\n (declaration) =>\n `${Str.replace(MODULE_PREFIX, \"\")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`,\n ),\n ),\n ),\n );\n\nconst isNamedContainer = (\n node: Node,\n): node is SignatureDeclaration | InterfaceDeclaration | ClassDeclaration =>\n isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);\n\nconst slotTarget =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<string> =>\n slotOf(context.checker)(expression).pipe(\n Option.filter((slot) => isExternalDeclaration(context.program)(slot)),\n Option.filter((slot) =>\n Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot))),\n ),\n Option.map((slot) => {\n const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(\n Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))),\n Option.map((name) => ` of ${name.getText()}`),\n Option.getOrElse(() => \"\"),\n );\n const name = Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(\n Option.map((found) => found.getText()),\n Option.getOrElse(() => \"value\"),\n );\n return `${name}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;\n }),\n );\n\nconst libraryTargetOf =\n (context: FlowContext) =>\n (expression: Expression, contextual: Type): Option.Option<string> =>\n aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));\n\nconst siteWithin =\n (context: FlowContext) =>\n (node: Node): Option.Option<ValueSite> =>\n Arr.findFirst(context.sites, (site) => contains(node)(site.node));\n\nconst aliasSite =\n (context: FlowContext) =>\n (type: Type): Option.Option<ValueSite> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) => Arr.findFirst(declarationsOf(alias), isTypeAliasDeclaration)),\n Option.flatMap(siteWithin(context)),\n );\n\nconst annotationSite =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n symbolAt(context.checker)(expression).pipe(\n Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)),\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.flatMap(annotationOf),\n Option.flatMap((annotation) =>\n siteWithin(context)(annotation).pipe(\n Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))),\n ),\n ),\n );\n\nconst siteBehind =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(\n Option.orElse(() => annotationSite(context)(expression)),\n );\n\nconst isFlowSource = (node: Node): node is Expression =>\n isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst flowOf =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<Flow> =>\n Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) =>\n Option.all([\n vocabularyOf(context.checker)(contextual),\n libraryTargetOf(context)(expression, contextual),\n ]),\n ),\n Option.flatMap(([vocabulary, target]) =>\n siteBehind(context)(expression).pipe(\n Option.filter((site) => isSubsetOf(site.values, vocabulary.values)),\n Option.map((site) => ({ site, target })),\n ),\n ),\n );\n\nconst flowsIn =\n (context: FlowContext) =>\n (sourceFile: SourceFile): readonly Flow[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isFlowSource(node)),\n Arr.map((node) => flowOf(context)(node)),\n ),\n );\n\nexport { flowsIn };\nexport type { Flow, FlowContext };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"./compiler.ts\";\nimport { problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"./syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface Owner {\n readonly conceptId: string;\n readonly key: string;\n readonly name: string;\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly packageName: Option.Option<string>;\n readonly values: readonly Value[];\n}\n\ninterface OwnerScan {\n readonly owners: readonly Owner[];\n readonly problems: readonly Problem[];\n}\n\ninterface Annotated {\n readonly node: Node;\n readonly conceptId: string;\n}\n\nconst OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nconst ownerKeyOf = (declaration: Declaration): Option.Option<string> => {\n if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) {\n return Option.none();\n }\n return Option.some(`${declaration.getSourceFile().fileName}#${declaration.name.text}`);\n};\n\nconst annotationsOf = (node: Node): readonly Annotated[] =>\n pipe(\n getJSDocTags(node),\n Arr.filter((tag) => tag.tagName.text === OWNER_TAG),\n Arr.map((tag) => ({ node, conceptId: Str.trim(getTextOfJSDocComment(tag.comment) ?? \"\") })),\n );\n\nconst ANNOTATABLE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.VariableDeclaration,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyAssignment,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotatable = (node: Node): boolean => ANNOTATABLE_KINDS.has(node.kind);\n\nconst isConstList = (list: VariableDeclarationList): boolean =>\n Option.fromUndefinedOr(list.getFirstToken()).pipe(\n Option.exists((token) => token.kind === SyntaxKind.ConstKeyword),\n );\n\nconst isModuleStatementList = (list: VariableDeclarationList): boolean =>\n isVariableStatement(list.parent) && isSourceFile(list.parent.parent);\n\nconst isModuleConstList = (node: Node): node is VariableDeclarationList =>\n isVariableDeclarationList(node) && isModuleStatementList(node) && isConstList(node);\n\nconst isModuleConst = (node: Node): node is VariableDeclaration =>\n isVariableDeclaration(node) && isIdentifier(node.name) && isModuleConstList(node.parent);\n\nconst objectValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalValuesOf(\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => checker.getTypeOfSymbol(property)),\n ),\n );\n\nconst ownerValuesOf =\n (checker: Checker) =>\n (declaration: VariableDeclaration): Option.Option<readonly Value[]> => {\n const type = checker.getTypeAtLocation(declaration.name);\n return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));\n };\n\nconst annotationProblem = (message: string): ((node: Node) => Problem) =>\n problemAt({ rule: \"owner-annotation\", message });\n\nconst scanned = (owners: readonly Owner[], problems: readonly Problem[]): OwnerScan => ({\n owners,\n problems,\n});\n\nconst ownerOf =\n (project: Project) =>\n (annotated: Annotated): OwnerScan => {\n const { node, conceptId } = annotated;\n if (!isModuleConst(node)) {\n return scanned(\n [],\n [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)],\n );\n }\n if (conceptId === \"\") {\n return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);\n }\n const values = ownerValuesOf(project.checker)(node);\n return Option.match(Option.all([values, ownerKeyOf(node)]), {\n onNone: () =>\n scanned(\n [],\n [annotationProblem(`The owner of ${conceptId} holds no finite value set.`)(node)],\n ),\n onSome: ([ownedValues, key]) =>\n scanned(\n [\n {\n conceptId,\n key,\n name: node.name.getText(),\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n packageName: project.packageName,\n values: ownedValues,\n },\n ],\n [],\n ),\n });\n };\n\nconst annotatedIn = (sourceFile: SourceFile): readonly Annotated[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isAnnotatable(node)),\n Arr.flatMap((node) => annotationsOf(node)),\n );\n\nconst ownerProblem =\n (message: string) =>\n (owner: Owner): Problem => ({\n file: owner.file,\n line: owner.line,\n column: owner.column,\n rule: \"owner-annotation\",\n message,\n });\n\nconst conflictProblems = (owners: readonly Owner[]): readonly Problem[] =>\n pipe(\n owners,\n Arr.flatMap((owner, index) => {\n const earlier = Arr.take(owners, index);\n const sameConcept = pipe(\n earlier,\n Arr.filter((other) => other.conceptId === owner.conceptId),\n );\n const sameSet = pipe(\n earlier,\n Arr.filter(\n (other) => other.conceptId !== owner.conceptId && sameValues(other.values, owner.values),\n ),\n );\n return [\n ...pipe(\n Arr.take(sameConcept, FIRST_OWNER_COUNT),\n Arr.map(() =>\n ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner),\n ),\n ),\n ...pipe(\n Arr.take(sameSet, FIRST_OWNER_COUNT),\n Arr.map((other) =>\n ownerProblem(\n `The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`,\n )(owner),\n ),\n ),\n ];\n }),\n );\n\nconst ownersIn = (project: Project): OwnerScan => {\n const results = pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n annotatedIn(sourceFile),\n Arr.map((annotated) => ownerOf(project)(annotated)),\n ),\n ),\n );\n return scanned(\n pipe(\n results,\n Arr.flatMap((result) => result.owners),\n ),\n pipe(\n results,\n Arr.flatMap((result) => result.problems),\n ),\n );\n};\n\nconst combineOwnerScans = (scans: readonly OwnerScan[]): OwnerScan => {\n const owners = Arr.dedupeWith(\n pipe(\n scans,\n Arr.flatMap((scan) => scan.owners),\n ),\n (left, right) => left.key === right.key,\n );\n const problems = [\n ...pipe(\n scans,\n Arr.flatMap((scan) => scan.problems),\n ),\n ...conflictProblems(owners),\n ];\n return { owners, problems };\n};\n\nexport { OWNER_TAG, combineOwnerScans, ownerKeyOf, ownersIn };\nexport type { Owner, OwnerScan };\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { InternalSymbolName, isModuleDeclaration, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Declaration, Node, SyntaxKind, TypeSymbol, Type } from \"./compiler.ts\";\nimport type { DependencyEntry } from \"./dependencies.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"./syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"./values.ts\";\nimport type { Vocabulary } from \"./values.ts\";\n\ninterface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\ninterface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\ninterface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\ninterface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\ninterface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nconst isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nconst describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nconst locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nconst declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\ninterface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\ninterface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nconst libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nconst libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n Effect.forEach(indexEntry(cache)(checker)),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n\nexport {\n declarationKey,\n describeLibraryType,\n isObjectType,\n libraryCache,\n libraryIndex,\n locationOf,\n};\nexport type {\n CachedIndex,\n DeclarationLocation,\n LibraryCache,\n LibraryIndex,\n LibraryShape,\n LibraryType,\n LibraryVocabulary,\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { isSatisfiesExpression, isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node } from \"./compiler.ts\";\nimport { declarationKey, locationOf } from \"./library.ts\";\nimport { declarationsOf, referencedSymbols } from \"./syntax.ts\";\n\nconst contractOf = (node: Node): readonly Node[] => {\n const { parent } = node;\n if (isSatisfiesExpression(parent) && parent.expression === node) {\n return [parent.type];\n }\n if (isVariableDeclaration(parent) && parent.initializer === node) {\n return Option.toArray(Option.fromUndefinedOr(parent.type));\n }\n return [];\n};\n\nconst derivedDeclarationsOf =\n (checker: Checker) =>\n (node: Node): ReadonlySet<string> => {\n const scopes = Arr.prepend(contractOf(node), node);\n return new Set(\n pipe(\n scopes,\n Arr.flatMap((scope) => referencedSymbols(checker)(scope)),\n Arr.flatMap((symbol) => declarationsOf(symbol)),\n Arr.map((declaration) => declarationKey(locationOf(declaration))),\n ),\n );\n };\n\nexport { derivedDeclarationsOf };\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n VariableDeclaration,\n} from \"./compiler.ts\";\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\nimport { declarationKey, describeLibraryType, isObjectType } from \"./library.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"./library.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { descendantsOf, isGenericDeclaration, isTypeDeclaration } from \"./syntax.ts\";\nimport { schemaTypeOf } from \"./values.ts\";\n\ninterface ShapeContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface ShapeSite {\n readonly node: Node;\n readonly type: Type;\n}\n\ninterface ShapeMatch {\n readonly shape: LibraryShape;\n readonly extra: number;\n}\n\nconst MINIMUM_SHAPE_PROPERTIES = 3;\nconst EXACT = 0;\n\nconst augmentsAModule = (node: Node): boolean => {\n const block = node.parent;\n return (\n isModuleBlock(block) && isModuleDeclaration(block.parent) && isStringLiteral(block.parent.name)\n );\n};\n\nconst isPlainInterface = (node: Node): node is InterfaceDeclaration =>\n isInterfaceDeclaration(node) && !isGenericDeclaration(node) && !augmentsAModule(node);\n\nconst isPlainTypeLiteral = (node: Node): node is TypeAliasDeclaration =>\n isTypeAliasDeclaration(node) && !isGenericDeclaration(node) && isTypeLiteralNode(node.type);\n\nconst isDeclaredShape = (node: Node): node is InterfaceDeclaration | TypeAliasDeclaration =>\n isPlainInterface(node) || isPlainTypeLiteral(node);\n\nconst declaredShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> =>\n Option.liftPredicate(node, isDeclaredShape).pipe(\n Option.map((declaration) => checker.getTypeAtLocation(declaration.name)),\n );\n\nconst schemaShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> => {\n if (!isCallExpression(node)) {\n return Option.none();\n }\n const { arguments: callArguments } = node;\n if (\n !pipe(\n callArguments,\n Arr.some((argument) => isObjectLiteralExpression(argument)),\n )\n ) {\n return Option.none();\n }\n return schemaTypeOf(checker)(checker.getTypeAtLocation(node)).pipe(\n Option.filter((type) => isObjectType(checker)(type)),\n );\n };\n\nconst shapeSitesIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly ShapeSite[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.map((node) =>\n declaredShapeOf(checker)(node).pipe(\n Option.orElse(() => schemaShapeOf(checker)(node)),\n Option.map((type) => ({ node, type })),\n ),\n ),\n ),\n );\n\ninterface LocalProperty {\n readonly name: string;\n readonly type: Type;\n}\n\ninterface OpenTypeIds {\n readonly any: number;\n readonly unknown: number;\n}\n\nconst openTypeIdsOf = (checker: Checker): OpenTypeIds => ({\n any: checker.getAnyType().id,\n unknown: checker.getUnknownType().id,\n});\n\ntype IndexedDeclaration =\n | TypeAliasDeclaration\n | InterfaceDeclaration\n | EnumDeclaration\n | VariableDeclaration;\n\nconst isIndexedDeclaration = (node: Node): node is IndexedDeclaration =>\n isTypeDeclaration(node) || isVariableDeclaration(node);\n\nconst declarationAt =\n (program: Program) =>\n (location: DeclarationLocation): Option.Option<IndexedDeclaration> =>\n Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(\n Option.flatMap((sourceFile) =>\n Arr.findFirst(\n descendantsOf(sourceFile),\n (node): node is IndexedDeclaration =>\n node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node),\n ),\n ),\n );\n\nconst symbolOfDeclaration =\n (checker: Checker) =>\n (declaration: IndexedDeclaration): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(declaration.name));\n\nconst shapeTypeOf =\n (context: ShapeContext) =>\n (shape: LibraryShape): Option.Option<Type> => {\n const { checker } = context;\n return declarationAt(context.program)(shape.declaration).pipe(\n Option.flatMap((declaration) =>\n symbolOfDeclaration(checker)(declaration).pipe(\n Option.flatMap((symbol) => {\n if (shape.form === \"declared\") {\n return Option.some(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return schemaTypeOf(checker)(checker.getTypeOfSymbolAtLocation(symbol, declaration));\n }),\n ),\n ),\n );\n };\n\nconst hasEveryName =\n (locals: readonly LocalProperty[]) =>\n (shape: LibraryShape): boolean => {\n const names: ReadonlySet<string> = new Set(shape.propertyNames);\n return pipe(\n locals,\n Arr.every((local) => names.has(local.name)),\n );\n };\n\nconst sameProperty =\n (checker: Checker, open: OpenTypeIds) =>\n (localType: Type, library: TypeSymbol): boolean => {\n const libraryType = checker.getTypeOfSymbol(library);\n return (\n libraryType.id !== open.any &&\n libraryType.id !== open.unknown &&\n checker.isTypeAssignableTo(localType, libraryType) &&\n checker.isTypeAssignableTo(libraryType, localType)\n );\n };\n\nconst matchOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (locals: readonly LocalProperty[], shape: LibraryShape): Option.Option<ShapeMatch> => {\n const { checker } = context;\n const matches = shapeTypeOf(context)(shape).pipe(\n Option.exists((shapeType) =>\n pipe(\n locals,\n Arr.every((local) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(\n Option.exists((library) => sameProperty(checker, open)(local.type, library)),\n ),\n ),\n ),\n ),\n );\n if (!matches) {\n return Option.none();\n }\n return Option.some({ shape, extra: shape.propertyNames.length - locals.length });\n };\n\nconst localPropertiesOf =\n (checker: Checker) =>\n (symbols: readonly TypeSymbol[]): readonly LocalProperty[] =>\n pipe(\n Arr.zip(symbols, checker.getTypeOfSymbol(symbols)),\n Arr.map(([symbol, type]) => ({ name: symbol.name, type })),\n );\n\nconst matchOrder = Order.mapInput(Order.Number, (match: ShapeMatch) => match.extra);\n\nconst shapeProblem = (site: ShapeSite, matches: readonly ShapeMatch[]): Problem => {\n const shown = pipe(\n Arr.take(matches, CANDIDATE_LIMIT),\n Arr.map((match) => describeLibraryType(match.shape)),\n Arr.join(\", \"),\n );\n const advice = Option.match(\n Arr.findFirst(matches, (match) => match.extra === EXACT),\n {\n onNone: () =>\n \"Derive it from the library type, for example with Pick, instead of copying its properties.\",\n onSome: () => \"Use the library type instead of copying it.\",\n },\n );\n return problemAt({ rule: \"library-shape\", message: `This shape copies ${shown}. ${advice}` })(\n site.node,\n );\n};\n\nconst candidatesOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite, locals: readonly LocalProperty[]): readonly ShapeMatch[] => {\n const derived = derivedDeclarationsOf(context.checker)(site.node);\n const named = pipe(context.shapes, Arr.filter(hasEveryName(locals)));\n if (\n pipe(\n named,\n Arr.some((shape) => derived.has(declarationKey(shape.declaration))),\n )\n ) {\n return [];\n }\n const candidates = pipe(\n named,\n Arr.map((shape) => matchOf(context, open)(locals, shape)),\n Arr.getSomes,\n );\n return Arr.sort(candidates, matchOrder);\n };\n\nconst shapeProblemOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite): Option.Option<Problem> => {\n const symbols = context.checker.getPropertiesOfType(site.type);\n if (symbols.length < MINIMUM_SHAPE_PROPERTIES) {\n return Option.none();\n }\n const locals = localPropertiesOf(context.checker)(symbols);\n return Option.liftPredicate(\n candidatesOf(context, open)(site, locals),\n Arr.isReadonlyArrayNonEmpty,\n ).pipe(Option.map((found) => shapeProblem(site, found)));\n };\n\nconst shapeProblemsIn =\n (context: ShapeContext) =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const sites = shapeSitesIn(context.checker)(sourceFile);\n if (!Arr.isReadonlyArrayNonEmpty(sites)) {\n return [];\n }\n const open = openTypeIdsOf(context.checker);\n return Arr.getSomes(\n pipe(\n sites,\n Arr.map((site) => shapeProblemOf(context, open)(site)),\n ),\n );\n };\n\nexport { shapeProblemsIn };\nexport type { ShapeContext };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isElementAccessExpression,\n isEnumDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n isSpreadElement,\n isTypeReferenceNode,\n isUnionTypeNode,\n} from \"./compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"./compiler.ts\";\nimport {\n childrenOf,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n} from \"./syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface ValueSite {\n readonly node: Node;\n readonly values: readonly Value[];\n readonly sources: readonly TypeSymbol[];\n}\n\nconst namedValuesOf =\n (checker: Checker) =>\n (symbol: TypeSymbol): Option.Option<readonly Value[]> => {\n if (\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isTypeDeclaration(declaration)),\n )\n ) {\n return finiteValuesOf(checker)(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));\n };\n\nconst hasFiniteContext =\n (checker: Checker) =>\n (node: Expression): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst isNamedValue = (element: Expression): boolean => {\n if (isSpreadElement(element)) {\n return isNamedValue(element.expression);\n }\n return (\n isIdentifier(element) ||\n isPropertyAccessExpression(element) ||\n isElementAccessExpression(element)\n );\n};\n\nconst namesEveryElement = (array: ArrayLiteralExpression): boolean =>\n pipe(\n array.elements,\n Arr.every((element) => isNamedValue(element)),\n );\n\nconst expressionValuesOf =\n (checker: Checker) =>\n (node: Expression): Option.Option<readonly Value[]> => {\n if (hasFiniteContext(checker)(node)) {\n return Option.none();\n }\n const type = checker.getTypeAtLocation(node);\n if (isArrayLiteralExpression(node)) {\n return Option.liftPredicate(node, (array) => !namesEveryElement(array)).pipe(\n Option.flatMap(() => finiteValuesOf(checker)(type)),\n );\n }\n return schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf));\n };\n\nconst selectsKeys =\n (checker: Checker) =>\n (node: UnionTypeNode, values: readonly Value[]): boolean => {\n const { parent } = node;\n if (!isTypeReferenceNode(parent)) {\n return false;\n }\n const typeArguments: readonly TypeNode[] = parent.typeArguments ?? [];\n return pipe(\n typeArguments,\n Arr.filter((argument) => argument !== node),\n Arr.some((argument) =>\n isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument))),\n ),\n );\n };\n\nconst unionValuesOf =\n (checker: Checker) =>\n (node: UnionTypeNode): Option.Option<readonly Value[]> =>\n literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(\n Option.filter((values) => !selectsKeys(checker)(node, values)),\n );\n\nconst isExpressionSite = (node: Node): node is ArrayLiteralExpression | CallExpression =>\n isArrayLiteralExpression(node) || isCallExpression(node);\n\nconst expressionSiteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> =>\n Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));\n\nconst siteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> => {\n if (isUnionTypeNode(node)) {\n return unionValuesOf(checker)(node);\n }\n if (isEnumDeclaration(node)) {\n return literalUnionOf(checker.getTypeAtLocation(node.name));\n }\n return expressionSiteValuesOf(checker)(node);\n };\n\nconst derivationScopeOf = (node: Node): Node => {\n if (isTypeReferenceNode(node.parent)) {\n return node.parent;\n }\n return node;\n};\n\nconst sourcesOf =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] =>\n pipe(\n referencedSymbols(checker)(derivationScopeOf(node)),\n Arr.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))),\n );\n\nconst sitesUnder =\n (checker: Checker) =>\n (node: Node): readonly ValueSite[] => {\n const nested = pipe(\n childrenOf(node),\n Arr.flatMap((child) => sitesUnder(checker)(child)),\n );\n if (Arr.isReadonlyArrayNonEmpty(nested)) {\n return nested;\n }\n return siteValuesOf(checker)(node).pipe(\n Option.map((values) => ({ node, values, sources: sourcesOf(checker)(node) })),\n Option.toArray,\n );\n };\n\nexport { sitesUnder };\nexport type { ValueSite };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"./compiler.ts\";\nimport type { Flow } from \"./flows.ts\";\nimport { describeLibraryType } from \"./library.ts\";\nimport type { LibraryVocabulary } from \"./library.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"./syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"./values.ts\";\n\ninterface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\ninterface SiteVerdict {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst OWNER_SEARCH_DEPTH = 4;\nconst NOTHING_HIDDEN = 0;\n\nconst directOwners =\n (context: ValueContext) =>\n (symbol: TypeSymbol): readonly Owner[] => {\n const keys = Arr.getSomes(\n pipe(\n declarationsOf(symbol),\n Arr.map((declaration) => ownerKeyOf(declaration)),\n ),\n );\n return pipe(\n context.owners,\n Arr.filter((owner) => keys.includes(owner.key)),\n );\n };\n\nconst isFollowable = (declaration: Declaration): boolean =>\n !declaration.getSourceFile().isDeclarationFile &&\n (isTypeAliasDeclaration(declaration) || isVariableDeclaration(declaration));\n\nconst ownersBehind =\n (context: ValueContext) =>\n (symbol: TypeSymbol, ancestors: readonly TypeSymbol[]): readonly Owner[] => {\n const direct = directOwners(context)(symbol);\n if (Arr.isReadonlyArrayNonEmpty(direct) || ancestors.length >= OWNER_SEARCH_DEPTH) {\n return direct;\n }\n const visited = [...ancestors, symbol];\n return uniqueByReference(\n pipe(\n declarationsOf(symbol),\n Arr.filter((declaration) => isFollowable(declaration)),\n Arr.flatMap((declaration) => referencedSymbols(context.checker)(declaration)),\n Arr.filter((referenced) => !visited.includes(referenced)),\n Arr.flatMap((referenced) => ownersBehind(context)(referenced, visited)),\n ),\n );\n };\n\nconst describeOwners = (owners: readonly Owner[]): string =>\n pipe(\n owners,\n Arr.map((owner) => `${owner.conceptId} (${owner.name})`),\n Arr.join(\", \"),\n );\n\nconst verdict = (problems: readonly Problem[], unowned: readonly ValueSite[]): SiteVerdict => ({\n problems,\n unowned,\n});\n\nconst derivedVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = uniqueByReference(\n pipe(\n site.sources,\n Arr.flatMap((source) => ownersBehind(context)(source, [])),\n ),\n );\n const held = pipe(\n owners,\n Arr.flatMap((owner) => owner.values),\n );\n const added = pipe(\n site.values,\n Arr.filter((value) => !isSubsetOf([value], held)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(owners) || !Arr.isReadonlyArrayNonEmpty(added)) {\n return verdict([], []);\n }\n const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;\n return verdict([problemAt({ rule: \"owner-extension\", message })(site.node)], []);\n };\n\nconst libraryCandidates =\n (context: ValueContext) =>\n (site: ValueSite): readonly string[] => {\n const flowing = Arr.dedupe(\n pipe(\n context.flows,\n Arr.filter((flow) => flow.site.node === site.node),\n Arr.map((flow) => flow.target),\n ),\n );\n if (Arr.isReadonlyArrayNonEmpty(flowing)) {\n return flowing;\n }\n if (\n !pipe(\n site.values,\n Arr.some((value) => typeof value === \"string\"),\n )\n ) {\n return [];\n }\n const imported = importedModulesOf(site.node.getSourceFile());\n return Arr.dedupe(\n pipe(\n context.vocabularies,\n Arr.filter((library) => imported.includes(library.specifier)),\n Arr.filter((library) => isSubsetOf(site.values, library.vocabulary.values)),\n Arr.map((library) => describeLibraryType(library)),\n ),\n );\n };\n\nconst listCandidates = (candidates: readonly string[]): string => {\n const shown = pipe(Arr.take(candidates, CANDIDATE_LIMIT), Arr.join(\", \"));\n const hidden = candidates.length - CANDIDATE_LIMIT;\n if (hidden > NOTHING_HIDDEN) {\n return `${shown} and ${String(hidden)} more`;\n }\n return shown;\n};\n\nconst originalVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = pipe(\n context.owners,\n Arr.filter((owner) => isSubsetOf(site.values, owner.values)),\n );\n if (Arr.isReadonlyArrayNonEmpty(owners)) {\n const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;\n return verdict([problemAt({ rule: \"owner-value-set\", message })(site.node)], []);\n }\n const candidates = libraryCandidates(context)(site);\n if (Arr.isReadonlyArrayNonEmpty(candidates)) {\n const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;\n return verdict([problemAt({ rule: \"library-value-set\", message })(site.node)], []);\n }\n return verdict([], [site]);\n };\n\nconst siteVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n if (Arr.isReadonlyArrayNonEmpty(site.sources)) {\n return derivedVerdict(context)(site);\n }\n return originalVerdict(context)(site);\n };\n\nconst VALUE_PARENT_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ReturnStatement,\n SyntaxKind.ArrayLiteralExpression,\n SyntaxKind.ConditionalExpression,\n SyntaxKind.ParenthesizedExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.JsxExpression,\n]);\n\nconst isCallArgument = (node: Node, parent: Node): boolean =>\n (isCallExpression(parent) || isNewExpression(parent)) && parent.expression !== node;\n\nconst isInitializer = (node: Node, parent: Node): boolean =>\n (isPropertyAssignment(parent) || isVariableDeclaration(parent)) && parent.initializer === node;\n\nconst isRightOperand = (node: Node, parent: Node): boolean =>\n isBinaryExpression(parent) && parent.right === node;\n\nconst VALUE_SLOTS = [isCallArgument, isInitializer, isRightOperand];\n\nconst isValuePosition = (node: Node): boolean => {\n const { parent } = node;\n return (\n VALUE_PARENT_KINDS.has(parent.kind) ||\n pipe(\n VALUE_SLOTS,\n Arr.some((isSlot) => isSlot(node, parent)),\n )\n );\n};\n\nconst ownedLiteralProblem =\n (context: ValueContext) =>\n (literal: StringLiteral | NumericLiteral): Option.Option<Problem> =>\n Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(\n Option.filter((contextual) =>\n vocabularyOf(context.checker)(contextual).pipe(\n Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues),\n ),\n ),\n Option.map(() =>\n pipe(\n contextSymbolsOf(context.checker)(literal),\n Arr.flatMap((symbol) => ownersBehind(context)(symbol, [])),\n uniqueByReference,\n Arr.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Arr.map(String)))),\n ),\n ),\n Option.filter((owners) => Arr.isReadonlyArrayNonEmpty(owners)),\n Option.map((owners) =>\n problemAt({\n rule: \"owned-literal\",\n message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`,\n })(literal),\n ),\n );\n\nconst ownedLiteralProblems =\n (context: ValueContext) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly Problem[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isStringLiteral(node) || isNumericLiteral(node)),\n Arr.filter((node) => isValuePosition(node)),\n Arr.filter(\n (node) =>\n !pipe(\n excluded,\n Arr.some((outer) => contains(outer)(node)),\n ),\n ),\n Arr.map((node) => ownedLiteralProblem(context)(node)),\n ),\n );\n\nexport { ownedLiteralProblems, siteVerdict };\nexport type { SiteVerdict, ValueContext };\n","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport { isVariableDeclaration } from \"./compiler.ts\";\nimport type { Checker, Node, VariableDeclaration } from \"./compiler.ts\";\nimport { flowsIn } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Project } from \"./project.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesUnder } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contains, descendantsOf } from \"./syntax.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\ninterface ProjectAnalysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst isVisibleTo =\n (project: Project) =>\n (owner: Owner): boolean =>\n pipe(\n project.sourceFiles,\n Arr.some((sourceFile) => sourceFile.fileName === owner.file),\n ) ||\n Option.exists(\n owner.packageName,\n (name) =>\n Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name),\n );\n\nconst ownerDeclarationsIn = (\n project: Project,\n owners: readonly Owner[],\n): readonly VariableDeclaration[] => {\n const keys = new Set(\n pipe(\n owners,\n Arr.map((owner) => owner.key),\n ),\n );\n return pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isVariableDeclaration(node)),\n Arr.filter((declaration) => Option.exists(ownerKeyOf(declaration), (key) => keys.has(key))),\n ),\n ),\n );\n};\n\nconst isInside =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nconst sitesOutside =\n (checker: Checker) =>\n (project: Project, outers: readonly Node[]): readonly ValueSite[] =>\n pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)),\n Arr.filter((site) => !isInside(outers)(site.node)),\n );\n\nconst nodesOf = (sites: readonly ValueSite[]): readonly Node[] =>\n pipe(\n sites,\n Arr.map((site) => site.node),\n );\n\nconst analyzeProject =\n (owners: readonly Owner[]) =>\n (project: Project): ProjectAnalysis => {\n const { checker } = project;\n const ownerDeclarations = ownerDeclarationsIn(project, owners);\n const sites = sitesOutside(checker)(project, ownerDeclarations);\n const flowContext = { checker, program: project.program, sites };\n const context = {\n checker,\n owners: pipe(\n owners,\n Arr.filter((owner) => isVisibleTo(project)(owner)),\n ),\n vocabularies: project.library.vocabularies,\n flows: pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => flowsIn(flowContext)(sourceFile)),\n ),\n };\n const verdicts = pipe(\n sites,\n Arr.map((site) => siteVerdict(context)(site)),\n );\n const excluded = [...ownerDeclarations, ...nodesOf(sites)];\n const shapeContext = { checker, program: project.program, shapes: project.library.shapes };\n return {\n problems: [\n ...pipe(\n verdicts,\n Arr.flatMap((found) => found.problems),\n ),\n ...pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => [\n ...ownedLiteralProblems(context)(sourceFile, excluded),\n ...shapeProblemsIn(shapeContext)(sourceFile),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n };\n };\n\nexport { analyzeProject };\nexport type { ProjectAnalysis };\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\nimport { formatValues, valueKey } from \"./values.ts\";\nimport type { Value } from \"./values.ts\";\n\ninterface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\ninterface UnownedSite {\n readonly scope: PackageScope;\n readonly file: string;\n readonly start: number;\n readonly line: number;\n readonly column: number;\n readonly values: readonly Value[];\n}\n\nconst DUPLICATE_THRESHOLD = 1;\n\nconst unownedSiteOf =\n (scope: PackageScope) =>\n (site: ValueSite): UnownedSite => ({\n scope,\n file: site.node.getSourceFile().fileName,\n start: site.node.getStart(),\n line: lineOf(site.node),\n column: columnOf(site.node),\n values: site.values,\n });\n\nconst canDerive = (left: UnownedSite, right: UnownedSite): boolean =>\n left.scope.name === right.scope.name ||\n left.scope.dependencies.includes(right.scope.name) ||\n right.scope.dependencies.includes(left.scope.name);\n\nconst siteKey = (site: UnownedSite): string => `${site.file}#${String(site.start)}`;\n\nconst valueSetKey = (site: UnownedSite): string => {\n const keys = pipe(\n site.values,\n Arr.map((value) => valueKey(value)),\n );\n return pipe(Arr.sort(keys, Order.String), Arr.join(\"\\0\"));\n};\n\nconst duplicateProblems =\n (relative: (file: string) => string) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const unique = Arr.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));\n const groups = Rec.values(Arr.groupBy(unique, (site) => valueSetKey(site)));\n return pipe(\n groups,\n Arr.filter((group) => group.length > DUPLICATE_THRESHOLD),\n Arr.flatMap((group) =>\n pipe(\n group,\n Arr.flatMap((site): readonly Problem[] => {\n const related = pipe(\n group,\n Arr.filter((other) => other !== site && canDerive(site, other)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(related)) {\n return [];\n }\n const others = pipe(\n related,\n Arr.map((other) => `${relative(other.file)}:${String(other.line)}`),\n Arr.join(\", \"),\n );\n return [\n {\n file: site.file,\n line: site.line,\n column: site.column,\n rule: \"duplicate-value-set\",\n message: `The values ${formatValues(site.values)} are also declared at ${others}. Register one owner with /** @${OWNER_TAG} <concept> */ and derive the others from it.`,\n },\n ];\n }),\n ),\n ),\n );\n };\n\nexport { duplicateProblems, unownedSiteOf };\nexport type { PackageScope, UnownedSite };\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"./compiler.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* pipe(\n pids,\n Effect.forEach((pid) => residentBytesOf(pid)),\n );\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nconst annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n\nexport { annotateResources };\n","import { Array as Arr, Effect, Function as Fn, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { API, getLeadingCommentRanges } from \"./compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"./compiler.ts\";\nimport {\n MANIFEST_FILE,\n NODE_MODULES,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"./dependencies.ts\";\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\ninterface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst listConfigFiles = (\n directory: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const visible = pipe(\n names,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name) && !SKIPPED_DIRECTORIES.has(name)),\n Arr.map((name) => files.join(directory, name)),\n );\n const nested = yield* Fn.pipe(\n visible,\n Effect.forEach((entryPath) =>\n files.isDirectory(entryPath).pipe(\n Effect.flatMap(\n Option.match({\n onNone: (): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.succeed([]),\n onSome: (\n directoryEntry,\n ): Effect.Effect<readonly string[], never, RepositoryFiles> => {\n if (directoryEntry) {\n return listConfigFiles(entryPath);\n }\n return Effect.succeed(\n Arr.filter([entryPath], () => files.basename(entryPath) === CONFIG_FILE),\n );\n },\n }),\n ),\n ),\n ),\n );\n return Arr.sort(nested.flat(), Order.String);\n });\n\nconst parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\ninterface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\ninterface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nconst typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nconst withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nconst mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* pipe(\n fileNames,\n Effect.forEach((fileName) => files.readFile(fileName)),\n );\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n\nexport { listConfigFiles, mentions, typeScriptCompiler, withProject };\nexport type { Compiler, Project, Workspace };\n","import { Effect, Option, Array as Arr, pipe } from \"effect\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope, UnownedSite } from \"./duplicates.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.ts\";\nimport { sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { listConfigFiles, mentions, typeScriptCompiler, withProject } from \"./project.ts\";\nimport type { Project, Workspace } from \"./project.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst scanOwners = Effect.fn(\"scanOwners\")(function* scanOwners(\n workspace: Workspace,\n configPaths: readonly string[],\n) {\n const ownerConfigs = yield* pipe(\n configPaths,\n Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)),\n );\n const scans = yield* pipe(\n ownerConfigs,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))),\n ),\n );\n return combineOwnerScans(Arr.getSomes(scans));\n});\n\nconst scopeOf = (project: Project, configPath: string): PackageScope => ({\n name: Option.getOrElse(project.packageName, () => configPath),\n dependencies: project.workspaceDependencies,\n});\n\ninterface Analysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly UnownedSite[];\n}\n\nconst analyzeProjects =\n (workspace: Workspace, owners: readonly Owner[]) =>\n (configPaths: readonly string[]): Effect.Effect<readonly Analysis[], never, RepositoryFiles> =>\n pipe(\n configPaths,\n Effect.forEach((configPath) =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject(owners)(project);\n const scope = scopeOf(project, configPath);\n return {\n problems: analysis.problems,\n unowned: pipe(analysis.unowned, Arr.map(unownedSiteOf(scope))),\n };\n }).pipe(Effect.withSpan(\"analyzeProject\")),\n ),\n ),\n Effect.map(Arr.getSomes),\n );\n\nconst checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(root: string) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const generated = yield* files.generatedFiles(root);\n const workspace: Workspace = { compiler, root, generated };\n const configPaths = yield* listConfigFiles(root);\n const ownerScan: OwnerScan = yield* scanOwners(workspace, configPaths);\n const analyses = yield* analyzeProjects(workspace, ownerScan.owners)(configPaths);\n const relative = (file: string): string => files.relative(root, file);\n const unowned = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.unowned),\n );\n return sortProblems([\n ...ownerScan.problems,\n ...pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.problems),\n ),\n ...duplicateProblems(relative)(unowned),\n ]);\n}, Effect.scoped);\n\nexport { checkRepository };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nconst positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n\nexport { positionOf };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst HIDDEN =\n /[\\u00AD\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u2069\\uFEFF]|[\\u{E0000}-\\u{E007F}]/gu;\n\nconst NUL = \"\\0\";\nconst START = 0;\nconst HEX = 16;\nconst CODE_POINT_WIDTH = 4;\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"hidden-unicode\";\n\nconst hexOf = (character: string): string =>\n pipe(\n Str.codePointAt(START)(character),\n Option.getOrElse(() => START),\n (code) => code.toString(HEX),\n Str.toUpperCase,\n Str.padStart(CODE_POINT_WIDTH, \"0\"),\n );\n\nconst problemOf =\n (file: string, source: string) =>\n (found: RegExpMatchArray): Problem => {\n const hex = hexOf(found[START]);\n return {\n file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\\\u${hex}.`,\n };\n };\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n if (Str.includes(NUL)(source)) {\n return [];\n }\n return pipe(Arr.fromIterable(Str.matchAll(HIDDEN)(source)), Arr.map(problemOf(file, source)));\n};\n\n/** @internal */\nconst checkHiddenUnicode = Effect.fn(\"checkHiddenUnicode\")(function* checkHiddenUnicode(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(file, source),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\nexport { checkHiddenUnicode };\n","import {\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 {\n SyntaxKind,\n isExportDeclaration,\n isImportDeclaration,\n isStringLiteral,\n} from \"./compiler.ts\";\nimport type { API, Node } from \"./compiler.ts\";\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\nimport { RepositoryFiles } from \"./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 */\nconst 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\nexport { packagesByEntry };\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, NODE_MODULES } from \"./dependencies.ts\";\nimport { RepositoryFiles } from \"./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\nconst 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\ninterface ClosureRoot {\n readonly provided: HashSet.HashSet<string>;\n readonly from: string;\n readonly name: string;\n}\n\nconst 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\nconst 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\nexport { installedClosure, installedSize, keysOf };\nexport type { ClosureRoot };\n","import { Array as Arr, Option, Predicate, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst SEPARATOR = \"/\";\nconst ROOT_SUBPATH = \".\";\nconst BIN_LABEL = \"bin\";\n\ninterface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\ninterface EntryManifest {\n readonly name?: string | undefined;\n readonly exports?: unknown;\n readonly bin?: unknown;\n}\n\ninterface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst targetsIn = (held: unknown): readonly string[] => {\n if (Predicate.isString(held)) {\n return [held];\n }\n if (!Predicate.isObject(held)) {\n return [];\n }\n return pipe(Rec.values(held), Arr.flatMap(targetsIn));\n};\n\nconst subpathsOf = (exportsField: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(exportsField)) {\n return [[ROOT_SUBPATH, exportsField]];\n }\n const entries = Rec.toEntries(exportsField);\n if (\n pipe(\n entries,\n Arr.some(([key]) => Str.startsWith(ROOT_SUBPATH)(key)),\n )\n ) {\n return entries;\n }\n return [[ROOT_SUBPATH, exportsField]];\n};\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] => {\n if (Predicate.isString(manifest.bin)) {\n const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => \"\");\n return [[`${BIN_LABEL} ${name}`, manifest.bin]];\n }\n if (!Predicate.isObject(manifest.bin)) {\n return [];\n }\n return pipe(\n Rec.toEntries(manifest.bin),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n};\n\nconst baseNameOf = (target: string): string =>\n pipe(\n Str.split(target, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => target),\n Str.replace(BUILT, \"\"),\n );\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = baseNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nconst publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...subpathsOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n\nexport { publicEntriesOf };\nexport type { EntryLookup, EntryManifest, PublicEntry };\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nconst PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst PackSettings = Schema.Struct({ entry: Schema.optional(PackEntry) });\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst WorkspaceConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n pack: Schema.optional(PackList),\n});\nconst PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(false)) });\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\ninterface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\ninterface PublishedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly installSize: string;\n readonly installBudget: number;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nconst entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packEntriesOf = (pack: typeof WorkspaceConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(WorkspaceConfig)));\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return Option.exists(text, (found) =>\n Option.isSome(Schema.decodeOption(Schema.fromJsonString(PublicManifest))(found)),\n );\n});\n\nconst workspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ msch, pack }: typeof WorkspaceConfig.Type): PublishedWorkspace => {\n const [amount, , unit] = msch.publish.installSize;\n return {\n directory,\n configFile,\n installSize: `${amount} ${unit}`,\n installBudget: amount * bytesPer(unit),\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n };\n };\n\nconst publishedIn = Effect.fn(\"publishedIn\")(function* publishedIn(\n root: string,\n configName: string,\n) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<PublishedWorkspace>();\n }\n const settings = yield* settingsIn(configFile);\n return pipe(\n settings,\n Option.map(workspaceOf(directory, configFile, (source) => files.join(directory, source))),\n );\n});\n\n/** @internal */\nconst publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const configs = pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n const found = yield* Effect.forEach(configs, (name) => publishedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\nexport { publishedWorkspaces };\nexport type { PackEntrySource, PublishedWorkspace };\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 } from \"./dependencies.ts\";\nimport { packagesByEntry } from \"./import-graph.ts\";\nimport { installedClosure, installedSize, keysOf } from \"./installed-closure.ts\";\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { typeScriptCompiler } from \"./project.ts\";\nimport { publicEntriesOf } from \"./public-entries.ts\";\nimport type { PublicEntry } from \"./public-entries.ts\";\nimport { publishedWorkspaces } from \"./published.ts\";\nimport type { PublishedWorkspace } from \"./published.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.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 */\nconst checkPublishedPackages = Effect.fn(\"checkPublishedPackages\")(function* checkPublishedPackages(\n root: string,\n) {\n const workspaces = yield* publishedWorkspaces(root);\n const found = yield* pipe(workspaces, Effect.forEach(workspaceProblems));\n return Arr.flatten(found);\n});\n\nexport { checkPublishedPackages };\n","import { Array as Arr, Effect, HashSet, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { publishedWorkspaces } from \"./published.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst README = /^README(?:\\.[^/]+)?$/iu;\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 README_MESSAGE =\n \"is allowed below the root only in a workspace published to npm, marked by msch: { publish: { installSize } } in its vite.config.ts. Set it there if the workspace is published, or move the content into the root README.md and delete this file.\";\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n published: HashSet.HashSet<string>,\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const base = files.basename(name);\n const file = files.join(root, name);\n if (AGENT_DOCS.test(base)) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (!README.test(base)) {\n return Option.none<Problem>();\n }\n if (HashSet.has(published, files.dirname(file))) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n});\n\n/** @internal */\nconst checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const workspaces = yield* publishedWorkspaces(root);\n const published = pipe(\n workspaces,\n Arr.map((workspace) => workspace.directory),\n HashSet.fromIterable,\n );\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, published, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\nexport { checkNestedDocs };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst describeVersions = (versions: readonly string[]): string =>\n Option.getOrElse(\n Option.liftPredicate(Arr.join(versions, \",\"), (joined) => joined !== \"\"),\n () => \"-\",\n );\n\nconst describeChanges = (report: OverrideReport): string => {\n const versions = pipe(\n report.changes,\n Arr.map(\n (change) =>\n `${change.name} ${describeVersions(change.before)} -> ${describeVersions(change.after)}`,\n ),\n );\n const contexts = Arr.filter([\"the peer contexts\"], () => report.peerContextsChanged);\n return Arr.join([...versions, ...contexts], \"; \");\n};\n\ninterface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nconst overrideProblem =\n (located: LocatedOverride) =>\n (report: OverrideReport): Option.Option<Problem> => {\n const at = { file: located.file, line: located.line, column: located.column };\n if (report.verdict === \"unused\") {\n return Option.some({\n ...at,\n rule: \"unused-override\",\n message: `Every package resolves the same way without the override ${report.key}. Remove it.`,\n });\n }\n if (report.verdict === \"verify\") {\n return Option.some({\n ...at,\n rule: \"removable-override\",\n message: `Removing the override ${report.key} changes ${describeChanges(report)} without new peer issues or advisories. Remove it and run verify.`,\n });\n }\n return Option.none();\n };\n\nexport { overrideProblem };\nexport type { LocatedOverride };\n","import { Array as Arr, Option, Order, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { LineCounter, isMap, isScalar, parseAllDocuments, parseDocument } from \"yaml\";\n\nconst VerdictSchema = Schema.Literals([\"unused\", \"keep\", \"verify\"]);\n\nconst PackageChangeSchema = Schema.Struct({\n name: Schema.String,\n before: Schema.Array(Schema.String),\n after: Schema.Array(Schema.String),\n});\n\nconst OverrideReportSchema = Schema.Struct({\n key: Schema.String,\n verdict: VerdictSchema,\n changes: Schema.Array(PackageChangeSchema),\n peerContextsChanged: Schema.Boolean,\n peerIssues: Schema.Array(Schema.String),\n advisories: Schema.Array(Schema.String),\n});\n\ntype OverrideReport = typeof OverrideReportSchema.Type;\ntype PackageChange = typeof PackageChangeSchema.Type;\n\nconst PeerParentSchema = Schema.Struct({ name: Schema.String, version: Schema.String });\n\nconst PeerIssueSchema = Schema.Struct({\n parents: Schema.Array(PeerParentSchema),\n wantedRange: Schema.String,\n foundVersion: Schema.optionalKey(Schema.String),\n});\n\ntype PeerIssue = typeof PeerIssueSchema.Type;\n\nconst ProjectPeerIssuesSchema = Schema.Struct({\n bad: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n missing: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n conflicts: Schema.Array(Schema.String),\n});\n\ntype ProjectPeerIssues = typeof ProjectPeerIssuesSchema.Type;\n\nconst PeerIssuesLog = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.Literal(\"pnpm:peer-dependency-issues\"),\n issuesByProjects: Schema.Record(Schema.String, ProjectPeerIssuesSchema),\n }),\n);\n\ninterface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\ninterface Resolution extends Findings {\n readonly versions: Readonly<Record<string, readonly string[]>>;\n readonly snapshots: readonly string[];\n}\n\nconst AdvisorySchema = Schema.Struct({\n module_name: Schema.String,\n github_advisory_id: Schema.String,\n});\n\nconst AuditReport = Schema.fromJsonString(\n Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }),\n);\n\nconst SCOPE_PREFIX = \"@\";\nconst NAME_START = 0;\nconst SEPARATOR_LENGTH = 1;\nconst PEER_CONTEXT_START = \"(\";\n\nconst sorted = (values: readonly string[]): readonly string[] =>\n Arr.sort(Arr.dedupe(values), Order.String);\n\nconst describeIssue =\n (project: string, kind: string) =>\n ([peer, issues]: readonly [string, readonly PeerIssue[]]): readonly string[] =>\n pipe(\n issues,\n Arr.map((issue) => {\n const dependent = Option.match(Arr.last(issue.parents), {\n onNone: () => project,\n onSome: (parent) => `${parent.name}@${parent.version}`,\n });\n const found = Option.getOrElse(Option.fromUndefinedOr(issue.foundVersion), () => \"none\");\n return `${project}: ${kind} peer ${peer}@${issue.wantedRange} of ${dependent}, found ${found}`;\n }),\n );\n\nconst issuesOfProject = ([project, issues]: readonly [\n string,\n ProjectPeerIssues,\n]): readonly string[] => [\n ...pipe(Rec.toEntries(issues.bad), Arr.flatMap(describeIssue(project, \"unmet\"))),\n ...pipe(Rec.toEntries(issues.missing), Arr.flatMap(describeIssue(project, \"missing\"))),\n ...pipe(\n issues.conflicts,\n Arr.map((peer) => `${project}: conflicting peer ${peer}`),\n ),\n];\n\nconst peerIssuesIn = (output: string): readonly string[] =>\n sorted(\n pipe(\n Str.split(output, \"\\n\"),\n Arr.map((line) => Schema.decodeOption(PeerIssuesLog)(line)),\n Arr.getSomes,\n Arr.flatMap((log) => pipe(Rec.toEntries(log.issuesByProjects), Arr.flatMap(issuesOfProject))),\n ),\n );\n\nconst advisoriesIn = (output: string): readonly string[] =>\n Option.match(Schema.decodeOption(AuditReport)(output), {\n onNone: () => [],\n onSome: (report) =>\n sorted(\n pipe(\n Rec.values(report.advisories),\n Arr.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`),\n ),\n ),\n });\n\nconst separatorOf = (key: string): Option.Option<number> => {\n if (!Str.startsWith(SCOPE_PREFIX)(key)) {\n return Str.indexOf(SCOPE_PREFIX)(key);\n }\n return pipe(\n Str.slice(SEPARATOR_LENGTH)(key),\n Str.indexOf(SCOPE_PREFIX),\n Option.map((index) => index + SEPARATOR_LENGTH),\n );\n};\n\nconst withoutPeerContext = (version: string): string =>\n Option.match(Str.indexOf(PEER_CONTEXT_START)(version), {\n onNone: () => version,\n onSome: (start) => Str.slice(NAME_START, start)(version),\n });\n\nconst packageOf = (key: string): Option.Option<readonly [string, string]> =>\n Option.map(separatorOf(key), (separator) => [\n Str.slice(NAME_START, separator)(key),\n withoutPeerContext(Str.slice(separator + SEPARATOR_LENGTH)(key)),\n ]);\n\nconst keysOf = (node: unknown): readonly string[] => {\n if (!isMap(node)) {\n return [];\n }\n return pipe(\n node.items,\n Arr.flatMap((pair): readonly string[] => {\n if (isScalar(pair.key)) {\n return [String(pair.key.value)];\n }\n return [];\n }),\n );\n};\n\nconst lockfileKeysOf = (lockfile: string, section: string): readonly string[] =>\n pipe(\n parseAllDocuments(lockfile),\n Arr.flatMap((document) => keysOf(document.get(section))),\n );\n\nconst resolutionOf =\n (findings: Findings) =>\n (lockfile: string): Resolution => {\n const snapshots = lockfileKeysOf(lockfile, \"snapshots\");\n const packages = Arr.getSomes(\n pipe(\n [...lockfileKeysOf(lockfile, \"packages\"), ...snapshots],\n Arr.map((key) => packageOf(key)),\n ),\n );\n const versions = Rec.map(\n Arr.groupBy(packages, ([name]) => name),\n (entries) =>\n sorted(\n pipe(\n entries,\n Arr.map(([, version]) => version),\n ),\n ),\n );\n return { ...findings, versions, snapshots: sorted(snapshots) };\n };\n\nconst changesBetween = (baseline: Resolution, candidate: Resolution): readonly PackageChange[] =>\n pipe(\n sorted([...Rec.keys(baseline.versions), ...Rec.keys(candidate.versions)]),\n Arr.map((name) => ({\n name,\n before: baseline.versions[name] ?? [],\n after: candidate.versions[name] ?? [],\n })),\n Arr.filter((change) => Arr.join(change.before, \" \") !== Arr.join(change.after, \" \")),\n );\n\nconst growsThePackageSet = (change: PackageChange): boolean =>\n change.after.length > change.before.length;\n\nconst needsTheOverride = (\n found: Pick<OverrideReport, \"changes\" | \"peerIssues\" | \"advisories\">,\n): boolean =>\n pipe(\n found.changes,\n Arr.some((change) => growsThePackageSet(change)),\n ) ||\n Arr.isReadonlyArrayNonEmpty(found.peerIssues) ||\n Arr.isReadonlyArrayNonEmpty(found.advisories);\n\nconst judge =\n (baseline: Resolution) =>\n (key: string, candidate: Resolution): OverrideReport => {\n const changes = changesBetween(baseline, candidate);\n const peerIssues = Arr.difference(candidate.peerIssues, baseline.peerIssues);\n const advisories = Arr.difference(candidate.advisories, baseline.advisories);\n const peerContextsChanged =\n Arr.join(baseline.snapshots, \" \") !== Arr.join(candidate.snapshots, \" \");\n const found = { key, changes, peerContextsChanged, peerIssues, advisories };\n if (!Arr.isReadonlyArrayNonEmpty(changes) && !peerContextsChanged) {\n return { ...found, verdict: \"unused\" };\n }\n if (needsTheOverride(found)) {\n return { ...found, verdict: \"keep\" };\n }\n return { ...found, verdict: \"verify\" };\n };\n\nconst OVERRIDES = \"overrides\";\nconst BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\n\ninterface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst overrideKeysOf = (manifest: string): readonly OverrideKey[] => {\n const lineCounter = new LineCounter();\n const overrides = parseDocument(manifest, { lineCounter }).get(OVERRIDES);\n if (!isMap(overrides)) {\n return [];\n }\n return pipe(\n overrides.items,\n Arr.flatMap((pair): readonly OverrideKey[] => {\n const { key } = pair;\n if (!isScalar(key)) {\n return [];\n }\n return pipe(\n Option.fromNullishOr(key.range),\n Option.map(([start]) => {\n const { line, col } = lineCounter.linePos(start);\n return { key: String(key.value), line, column: col };\n }),\n Option.toArray,\n );\n }),\n );\n};\n\nconst withoutOverride =\n (key: string) =>\n (manifest: string): string => {\n const document = parseDocument(manifest);\n document.deleteIn([OVERRIDES, key]);\n return document.toString();\n };\n\nconst withBaselineProbe = (manifest: string): string => {\n const document = parseDocument(manifest);\n document.setIn([OVERRIDES, BASELINE_PROBE], REMOVED_DEPENDENCY);\n return document.toString();\n};\n\nexport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n};\nexport type { Findings, OverrideKey, OverrideReport, Resolution };\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { overrideProblem } from \"./override-findings.ts\";\nimport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n} from \"./override-resolution.ts\";\nimport type { OverrideKey } from \"./override-resolution.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst RESOLUTION_FILES = [\"*package.json\", WORKSPACE_FILE, LOCKFILE, \".npmrc\", \"patches/*\"];\nconst RESOLUTION_CONCURRENCY = 4;\nconst SUCCEEDED = 0;\n\nconst taggedError = Schema.TaggedError;\n\nclass OverrideResolutionFailed extends taggedError<\n OverrideResolutionFailed,\n { readonly brand: unique symbol }\n>()(\"OverrideResolutionFailed\", { override: Schema.String, output: Schema.String }) {}\n\ntype CandidateFailure = OverrideResolutionFailed | PlatformError.PlatformError;\ntype CandidateServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\ninterface Workspace {\n readonly root: string;\n readonly files: readonly string[];\n readonly manifest: string;\n}\n\nconst textOf = <Failure>(\n stream: Stream.Stream<Uint8Array, Failure>,\n): Effect.Effect<string, Failure> => stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst resolveIn = Effect.fn(\"resolveIn\")(function* resolveIn(directory: string, override: string) {\n const handle = yield* ChildProcess.make(\n \"vp\",\n [\"install\", \"--lockfile-only\", \"--ignore-scripts\", \"--\", \"--reporter=ndjson\"],\n { cwd: directory, env: { CI: \"true\" }, extendEnv: true, stdin: \"ignore\" },\n );\n const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n if (Number(status) !== SUCCEEDED) {\n return yield* OverrideResolutionFailed.make({ override, output });\n }\n return output;\n});\n\nconst auditIn = Effect.fn(\"auditIn\")(function* auditIn(directory: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"pm\", \"audit\", \"--json\"], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n return advisoriesIn(report);\n}, Effect.scoped);\n\nconst trackedResolutionFiles = Effect.fn(\"trackedResolutionFiles\")(function* trackedFiles(\n root: string,\n) {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", \"--\", ...RESOLUTION_FILES], {\n cwd: root,\n });\n const listed = yield* textOf(handle.stdout);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n}, Effect.scoped);\n\nconst copyFiles = Effect.fn(\"copyFiles\")(function* copyFiles(\n workspace: Workspace,\n directory: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const copyOne = (file: string): Effect.Effect<void, PlatformError.PlatformError> => {\n const target = path.join(directory, file);\n const copy = fs.copyFile(path.join(workspace.root, file), target);\n return fs.makeDirectory(path.dirname(target), { recursive: true }).pipe(Effect.andThen(copy));\n };\n yield* Effect.forEach(workspace.files, copyOne, { discard: true });\n});\n\nconst resolutionWith = Effect.fn(\"resolutionWith\")(function* resolutionWith(\n workspace: Workspace,\n override: string,\n manifest: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-overrides-\" });\n yield* copyFiles(workspace, directory);\n yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE), manifest);\n const output = yield* resolveIn(directory, override);\n const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE));\n yield* Effect.annotateCurrentSpan({ \"msch.override\": override });\n const advisories = yield* auditIn(directory);\n return resolutionOf({ peerIssues: peerIssuesIn(output), advisories })(lockfile);\n}, Effect.scoped);\n\nconst problemsFor = Effect.fn(\"problemsFor\")(function* problemsFor(\n root: string,\n manifest: string,\n keys: readonly OverrideKey[],\n) {\n const path = yield* Path.Path;\n const files = yield* trackedResolutionFiles(root);\n const workspace: Workspace = { root, files, manifest };\n const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));\n const judgeAgainstBaseline = judge(baseline);\n const file = path.join(root, WORKSPACE_FILE);\n const problemOf = (\n located: OverrideKey,\n ): Effect.Effect<Option.Option<Problem>, CandidateFailure, CandidateServices> =>\n resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(\n Effect.map((candidate) =>\n overrideProblem({ ...located, file })(judgeAgainstBaseline(located.key, candidate)),\n ),\n );\n const problems = yield* Effect.forEach(keys, problemOf, {\n concurrency: RESOLUTION_CONCURRENCY,\n });\n return Arr.getSomes(problems);\n});\n\n/** @internal */\nconst checkOverrides = Effect.fn(\"checkOverrides\")(function* checkOverrides(root: string) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE)).pipe(Effect.option);\n const keys = Option.match(manifest, { onNone: () => [], onSome: overrideKeysOf });\n if (Option.isNone(manifest) || !Arr.isReadonlyArrayNonEmpty(keys)) {\n return [];\n }\n return yield* problemsFor(root, manifest.value, keys);\n});\n\nexport { checkOverrides };\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { positionOf } from \"./text-position.ts\";\n\nconst PYTHON_FILE =\n /(?:\\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\\/)(?:pyproject\\.toml|uv\\.lock|uv\\.toml|poetry\\.lock|Pipfile|Pipfile\\.lock|setup\\.cfg|tox\\.ini|pytest\\.ini|\\.python-version|requirements[^/]*\\.txt))$/u;\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:Dockerfile[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])python[\\d.]*[ \\t]+(?:[-\"'$./]|\\S+\\.py\\b)/gu,\n /(?<![\\w./@-])pip3?[ \\t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\\b/gu,\n /(?<![\\w./@-])pipx[ \\t]+(?:run|install|inject|upgrade)\\b/gu,\n /(?<![\\w./@-])uvx[ \\t]+[^\\s=:,;)|&]/gu,\n /(?<![\\w./@-])uv[ \\t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\\b/gu,\n /(?<![\\w./@-])poetry[ \\t]+(?:run|install|add|lock|build|publish|shell|export)\\b/gu,\n /(?:\\bcommand[\"']?\\s*[:=]\\s*|(?:\\bspawn\\w*|\\bexec\\w*|\\bexeca|Command::new|ChildProcess\\.make|\\$)\\(\\s*)[\"'`](?:python[\\d.]*|pip3?|pipx|uvx?|poetry)[\"'`]/gu,\n /\\buses:\\s*[\"']?(?:actions\\/setup-python|astral-sh\\/setup-uv|astral-sh\\/ruff-action|pypa\\/[\\w.-]+|snok\\/install-poetry|abatilo\\/actions-poetry|conda-incubator\\/setup-miniconda|mamba-org\\/setup-micromamba|pdm-project\\/setup-pdm)\\b/gu,\n];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^\"'\\s=]+)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst READ_CONCURRENCY = 64;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"python-file\";\nconst COMMAND_RULE: RuleName = \"python-command\";\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst fileProblem = ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: FILE_RULE,\n message: \"Python is not used in this repository. Replace this file with TypeScript or Rust.\",\n});\n\nconst patternsFor = (name: string): readonly RegExp[] => {\n if (TOOL_VERSIONS.test(name)) {\n return [...COMMAND_PATTERNS, ...TOOL_PATTERNS];\n }\n return COMMAND_PATTERNS;\n};\n\nconst commandProblem =\n ({ file }: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: COMMAND_RULE,\n message: `Python is not used in this repository. Remove \\`${Str.trim(found[WHOLE_MATCH])}\\` and do the work in TypeScript or Rust.`,\n });\n\nconst commandProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n patternsFor(entry.name),\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map(commandProblem(entry, source)),\n );\n\nconst isPython = ({ name }: Listed): boolean => PYTHON_FILE.test(name);\n\nconst isScanned = (entry: Listed): boolean =>\n !isPython(entry) && SCANNED_FILE.test(entry.name) && !LOCKFILE.test(entry.name);\n\n/** @internal */\nconst checkPython = Effect.fn(\"checkPython\")(function* checkPython(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const listed = pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n const problemsIn = (entry: Listed): Effect.Effect<readonly Problem[]> =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => commandProblems(entry, source),\n }),\n ),\n );\n const scanned = yield* Effect.forEach(pipe(listed, Arr.filter(isScanned)), problemsIn, {\n concurrency: READ_CONCURRENCY,\n });\n const present = yield* Effect.filter(pipe(listed, Arr.filter(isPython)), ({ file }) =>\n files.exists(file),\n );\n return [...pipe(present, Arr.map(fileProblem)), ...Arr.flatten(scanned)];\n});\n\nexport { checkPython };\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkRepository } from \"./check.ts\";\nimport { checkHiddenUnicode } from \"./hidden-unicode.ts\";\nimport { checkPublishedPackages } from \"./install-size.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkOverrides } from \"./overrides.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { checkPython } from \"./python.ts\";\n\n/** @internal */\nconst checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkHiddenUnicode>\n >,\n Effect.Services<\n | ReturnType<typeof checkRepository>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkHiddenUnicode>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkRepository(root),\n checkOverrides(root),\n checkHiddenUnicode(root),\n checkPython(root),\n checkNestedDocs(root),\n checkPublishedPackages(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n\nexport { checkAll };\n","import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nclass ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nconst writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n\nexport { ProblemsFound, writeStdout };\n","import { runMain } from \"@effect/platform-node-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 \"./node-services.ts\";\nimport { ProblemsFound } from \"./output.ts\";\nimport { nodeRepositoryFiles } from \"./repository-files.ts\";\nimport type { RepositoryFiles } from \"./repository-files.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\nconst tracing = Otlp.layerFromConfig({ resource: { serviceName: \"msch\" } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n);\n\nconst runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n >,\n): void => {\n const services = Layer.mergeAll(nodeRepositoryFiles, tracing).pipe(\n Layer.provideMerge(nodeServicesLayer),\n );\n const main = Layer.build(services).pipe(\n Effect.flatMap((context) =>\n Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context),\n ),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n\n/** @internal */\nexport { runCli };\n","#!/usr/bin/env node\nimport { Effect, Schema, Stdio, Array as Arr, pipe } from \"effect\";\n\nimport { checkAll } from \"./all-checks.ts\";\nimport { JSON_FLAG } from \"./cli-contract.ts\";\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"./problem.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\nimport { runCli } from \"./runtime.ts\";\n\nconst NO_PROBLEMS = 0;\n\nconst reportText = (\n root: string,\n problems: readonly Problem[],\n): Effect.Effect<void, ProblemsFound, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n if (problems.length > NO_PROBLEMS) {\n return yield* ProblemsFound.make({ count: problems.length });\n }\n return yield* Effect.void;\n });\n\nconst msch = Effect.gen(function* msch() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const root = files.resolve(\".\");\n const found = yield* checkAll(root);\n const problems = sortProblems(found);\n if (args.includes(JSON_FLAG)) {\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);\n return yield* writeStdout(text);\n }\n return yield* reportText(root, problems);\n});\n\nrunCli(msch);\n"],"mappings":";;;;;;;;;;AA8BA,MAAM,kCAA2C,IAAI,IAAI;CACvD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,eAAe,gBACnB,gBAAgB,IAAI,YAAY,IAAI;AAEtC,MAAM,gBAAgB,gBACpB,OAAO,cAAc,aAAa,WAAW,CAAC,CAAC,KAC7C,OAAO,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