@r_masseater/msch 0.24.2 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cli-contract-B5ilWPaY.mjs → cli-contract-BscmWo5N.mjs} +3 -1
- package/dist/{cli-contract-B5ilWPaY.mjs.map → cli-contract-BscmWo5N.mjs.map} +1 -1
- package/dist/cli.mjs +106 -36
- package/dist/cli.mjs.map +1 -1
- package/dist/decision-rules.d.mts +2 -3
- package/dist/decision-rules.mjs +1 -31
- package/dist/index-BAZH4QMG.d.mts +213 -0
- package/dist/lint-preset-DM15aUhX.mjs +1110 -0
- package/dist/lint-preset-DM15aUhX.mjs.map +1 -0
- package/dist/lint.d.mts +2 -212
- package/dist/lint.mjs +1 -1083
- package/dist/oxlint.mjs +1 -1
- package/dist/{workspace-BPoE5oW1.mjs → workspace-g6vKzUNI.mjs} +8 -2
- package/dist/workspace-g6vKzUNI.mjs.map +1 -0
- package/dist/workspace-settings.mjs +3 -8
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/msch-checks/SKILL.md +1 -1
- package/dist/decision-rules.mjs.map +0 -1
- package/dist/lint.mjs.map +0 -1
- package/dist/workspace-BPoE5oW1.mjs.map +0 -1
|
@@ -109,6 +109,8 @@ const RuleNameSchema = Schema.Literals([
|
|
|
109
109
|
"workflow-path-filter",
|
|
110
110
|
"workflow-package",
|
|
111
111
|
"colocated-test",
|
|
112
|
+
"layered-source",
|
|
113
|
+
"public-entry",
|
|
112
114
|
"comment",
|
|
113
115
|
"applied-package",
|
|
114
116
|
"package-script",
|
|
@@ -161,4 +163,4 @@ const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${St
|
|
|
161
163
|
const JSON_FLAG = "--json";
|
|
162
164
|
export { isPropertyAssignment as $, getNameOfDeclaration as A, isExportDeclaration as B, API as C, SyntaxKind as D, SignatureKind as E, isBlock as F, isInterfaceDeclaration as G, isFunctionExpression as H, isCallExpression as I, isNewExpression as J, isModuleBlock as K, isClassDeclaration as L, isArrayLiteralExpression as M, isArrowFunction as N, getJSDocTags as O, isBinaryExpression as P, isPropertyAccessExpression as Q, isElementAccessExpression as R, uniqueByReference as S, InternalSymbolName as T, isIdentifier as U, isFunctionDeclaration as V, isImportDeclaration as W, isObjectLiteralExpression as X, isNumericLiteral as Y, isParenthesizedExpression as Z, packageOf as _, problemAt as a, isStringLiteral as at, resolvedSymbol as b, columnOf as c, isTypeReferenceNode as ct, descendantsOf as d, isVariableDeclarationList as dt, isReturnStatement as et, importedModulesOf as f, isVariableStatement as ft, lineOf as g, isTypeDeclaration as h, formatProblem as i, isSpreadElement as it, getTextOfJSDocComment as j, getLeadingCommentRanges as k, contains as l, isUnionTypeNode as lt, isGenericDeclaration as m, ProblemList as n, isSignatureDeclaration as nt, sortProblems as o, isTypeAliasDeclaration as ot, isExternalDeclaration as p, isModuleDeclaration as q, describeFinding as r, isSourceFile as rt, childrenOf as s, isTypeLiteralNode as st, JSON_FLAG as t, isSatisfiesExpression as tt, declarationsOf as u, isVariableDeclaration as ut, propertyNamesOf as v, IndexKind as w, symbolAt as x, referencedSymbols as y, isEnumDeclaration as z };
|
|
163
165
|
|
|
164
|
-
//# sourceMappingURL=cli-contract-
|
|
166
|
+
//# sourceMappingURL=cli-contract-BscmWo5N.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-contract-B5ilWPaY.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/syntax.ts","../src/shared/lib/problem.ts","../src/shared/lib/cli-contract.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const 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\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"docker-file\",\n \"docker-command\",\n \"unnamed-restriction\",\n \"git-subpath-dependency\",\n \"unneeded-file\",\n \"unneeded-setup\",\n \"cargo-outside-pnpm\",\n \"nested-docs\",\n \"root-readme\",\n \"agent-docs-length\",\n \"root-docs\",\n \"shell-script\",\n \"workflow-script\",\n \"workflow-queue\",\n \"stack-dependency\",\n \"install-size\",\n \"unverified-crate\",\n \"hidden-verify\",\n \"root-workspace-path\",\n \"shared-uncached-task\",\n \"workflow-path\",\n \"command-outside-bin\",\n \"unrun-command\",\n \"scripts-directory\",\n \"listed-entry\",\n \"workflow-path-filter\",\n \"workflow-package\",\n \"colocated-test\",\n \"comment\",\n \"applied-package\",\n \"package-script\",\n \"package-manager-command\",\n \"skipped-gate\",\n \"filter-task\",\n \"vite-plus-block\",\n \"node-version\",\n \"replaced-tool\",\n \"missing-hook\",\n \"dangling-link\",\n \"alchemy-patch\",\n \"skill-file\",\n \"unlocked-skill\",\n \"pass-through-wrapper\",\n]);\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n","export const JSON_FLAG = \"--json\";\n"],"mappings":";;;;;;AA6BA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAa,qBAA2B,UACtCA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAa,cAAc,SAAgC;CACzD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAa,aAAa,aAA6B;CACrD,MAAM,eAAe,KACnB,UACAC,SAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,SAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,SAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C,IAAIA,SAAI,WAAW,YAAY,CAAC,CAAC,YAAY,GAC3C,OAAO,KAAKD,MAAI,KAAK,UAAU,eAAe,GAAGA,MAAI,KAAK,GAAG,CAAC;CAEhE,OAAO,KAAKA,MAAI,KAAK,UAAU,iBAAiB,GAAGA,MAAI,KAAK,GAAG,CAAC;AAClE;AAEA,MAAa,iBAAiB,SAC5B,KACE,WAAW,IAAI,GACfA,MAAI,SAAS,UAAUA,MAAI,QAAQ,cAAc,KAAK,GAAG,KAAK,CAAC,CACjE;AAEF,MAAM,kBACH,aACA,eACC,CAAC,QAAQ,2BAA2B,UAAU,MAC7CC,SAAI,SAAS,oBAAoB,CAAC,CAAC,WAAW,QAAQ,KACrD,QA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scmWo5N.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/syntax.ts","../src/shared/lib/problem.ts","../src/shared/lib/cli-contract.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const 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\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"docker-file\",\n \"docker-command\",\n \"unnamed-restriction\",\n \"git-subpath-dependency\",\n \"unneeded-file\",\n \"unneeded-setup\",\n \"cargo-outside-pnpm\",\n \"nested-docs\",\n \"root-readme\",\n \"agent-docs-length\",\n \"root-docs\",\n \"shell-script\",\n \"workflow-script\",\n \"workflow-queue\",\n \"stack-dependency\",\n \"install-size\",\n \"unverified-crate\",\n \"hidden-verify\",\n \"root-workspace-path\",\n \"shared-uncached-task\",\n \"workflow-path\",\n \"command-outside-bin\",\n \"unrun-command\",\n \"scripts-directory\",\n \"listed-entry\",\n \"workflow-path-filter\",\n \"workflow-package\",\n \"colocated-test\",\n \"layered-source\",\n \"public-entry\",\n \"comment\",\n \"applied-package\",\n \"package-script\",\n \"package-manager-command\",\n \"skipped-gate\",\n \"filter-task\",\n \"vite-plus-block\",\n \"node-version\",\n \"replaced-tool\",\n \"missing-hook\",\n \"dangling-link\",\n \"alchemy-patch\",\n \"skill-file\",\n \"unlocked-skill\",\n \"pass-through-wrapper\",\n]);\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n","export const JSON_FLAG = \"--json\";\n"],"mappings":";;;;;;AA6BA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAa,qBAA2B,UACtCA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAa,cAAc,SAAgC;CACzD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAa,aAAa,aAA6B;CACrD,MAAM,eAAe,KACnB,UACAC,SAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,SAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,SAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C,IAAIA,SAAI,WAAW,YAAY,CAAC,CAAC,YAAY,GAC3C,OAAO,KAAKD,MA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,CACf;AAEF,MAAa,gBAAgB,aAC3BA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAa,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAE1F,MAAa,iBACV,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO;;ACzH1G,MAAa,YAAY"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as
|
|
3
|
-
import { $ as isPropertyAssignment, A as getNameOfDeclaration, B as isExportDeclaration, C as API, D as SyntaxKind, E as SignatureKind, F as isBlock, G as isInterfaceDeclaration, H as isFunctionExpression, I as isCallExpression, J as isNewExpression, K as isModuleBlock, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isPropertyAccessExpression, R as isElementAccessExpression, S as uniqueByReference, T as InternalSymbolName, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as packageOf$1, a as problemAt$
|
|
2
|
+
import { A as publicEntriesOf, C as nestedValues, M as dependencyEntries, N as readManifest, O as publishedWorkspaces, P as workspaceDependencies, S as literalOf, T as stringsIn, a as workspaceDirectories, b as childrenOf$2, c as RUN_TASKS, d as hasVerifyTask, j as MANIFEST_FILE, k as EntryManifestJson, l as VERIFY_TASK, n as patternOf, o as runTasksOf, t as namedWorkspaces, u as definesTask, v as workspaceConfigOf, w as propertyValue, x as keyName, y as KeySchema } from "./workspace-g6vKzUNI.mjs";
|
|
3
|
+
import { $ as isPropertyAssignment, A as getNameOfDeclaration, B as isExportDeclaration, C as API, D as SyntaxKind, E as SignatureKind, F as isBlock, G as isInterfaceDeclaration, H as isFunctionExpression, I as isCallExpression, J as isNewExpression, K as isModuleBlock, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isPropertyAccessExpression, R as isElementAccessExpression, S as uniqueByReference, T as InternalSymbolName, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as packageOf$1, a as problemAt$5, at as isStringLiteral, b as resolvedSymbol, c as columnOf, ct as isTypeReferenceNode, d as descendantsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as importedModulesOf, ft as isVariableStatement, g as lineOf, h as isTypeDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as contains, lt as isUnionTypeNode, m as isGenericDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as isExternalDeclaration, q as isModuleDeclaration, rt as isSourceFile, s as childrenOf$3, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as declarationsOf, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-BscmWo5N.mjs";
|
|
4
4
|
import { a as groupOf$1, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-B11FFAIk.mjs";
|
|
5
5
|
import { t as COMMENT_DIRECTIVES } from "./comment-directives-WcDqvLwJ.mjs";
|
|
6
6
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
@@ -317,7 +317,7 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
|
|
|
317
317
|
return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
|
|
318
318
|
});
|
|
319
319
|
// src/entities/project/model/inputs.ts
|
|
320
|
-
const SEPARATOR$
|
|
320
|
+
const SEPARATOR$16 = "/";
|
|
321
321
|
const SCOPE_PREFIX$1 = "@";
|
|
322
322
|
const HIDDEN_PREFIX = ".";
|
|
323
323
|
const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
@@ -359,14 +359,14 @@ const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath)
|
|
|
359
359
|
const directories = yield* workspaceClosure(directory);
|
|
360
360
|
return {
|
|
361
361
|
directories,
|
|
362
|
-
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$
|
|
362
|
+
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$16}`))
|
|
363
363
|
};
|
|
364
364
|
});
|
|
365
365
|
const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
|
|
366
366
|
const files = yield* RepositoryFiles;
|
|
367
367
|
if (!String$1.startsWith(SCOPE_PREFIX$1)(name)) return [name];
|
|
368
368
|
const scoped = yield* files.readDirectory(files.join(modules, name));
|
|
369
|
-
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$
|
|
369
|
+
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$16}${entry}`));
|
|
370
370
|
});
|
|
371
371
|
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
372
372
|
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
@@ -416,7 +416,7 @@ const RELATIVE$1 = /^\.\.?(?:\/|$)/u;
|
|
|
416
416
|
const SUBPATH_IMPORT = "#";
|
|
417
417
|
const WILDCARD$2 = "*";
|
|
418
418
|
const SCOPE$1 = "@";
|
|
419
|
-
const SEPARATOR$
|
|
419
|
+
const SEPARATOR$15 = "/";
|
|
420
420
|
const SOURCE_SUFFIXES = [
|
|
421
421
|
"",
|
|
422
422
|
".ts",
|
|
@@ -428,9 +428,9 @@ const PLAIN_SEGMENTS = 1;
|
|
|
428
428
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
429
429
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
430
430
|
const packageNameOf = (specifier) => {
|
|
431
|
-
const segments = String$1.split(specifier, SEPARATOR$
|
|
432
|
-
if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$
|
|
433
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$
|
|
431
|
+
const segments = String$1.split(specifier, SEPARATOR$15);
|
|
432
|
+
if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$15));
|
|
433
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$15));
|
|
434
434
|
};
|
|
435
435
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
436
436
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -1039,13 +1039,13 @@ const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
|
1039
1039
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
1040
1040
|
const RULE$28 = "git-subpath-dependency";
|
|
1041
1041
|
const WHOLE_MATCH$3 = 0;
|
|
1042
|
-
const problemAt$
|
|
1042
|
+
const problemAt$4 = ({ file }, source) => (found) => ({
|
|
1043
1043
|
file,
|
|
1044
1044
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
1045
1045
|
rule: RULE$28,
|
|
1046
1046
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$3])}\`.`
|
|
1047
1047
|
});
|
|
1048
|
-
const problemsIn$12 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$
|
|
1048
|
+
const problemsIn$12 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$4(entry, source)));
|
|
1049
1049
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
1050
1050
|
/** @internal */
|
|
1051
1051
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
@@ -1083,7 +1083,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
1083
1083
|
});
|
|
1084
1084
|
// src/features/placement/model/agent-docs-length.ts
|
|
1085
1085
|
const RECOMMENDED_LINES = 200;
|
|
1086
|
-
const FIRST$
|
|
1086
|
+
const FIRST$14 = 1;
|
|
1087
1087
|
const RULE$26 = "agent-docs-length";
|
|
1088
1088
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
1089
1089
|
const problemFor$5 = (file) => (lines) => {
|
|
@@ -1091,7 +1091,7 @@ const problemFor$5 = (file) => (lines) => {
|
|
|
1091
1091
|
return Option.some({
|
|
1092
1092
|
file,
|
|
1093
1093
|
line: 201,
|
|
1094
|
-
column: FIRST$
|
|
1094
|
+
column: FIRST$14,
|
|
1095
1095
|
rule: RULE$26,
|
|
1096
1096
|
message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`
|
|
1097
1097
|
});
|
|
@@ -1100,12 +1100,12 @@ const problemFor$5 = (file) => (lines) => {
|
|
|
1100
1100
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
|
|
1101
1101
|
// src/features/placement/model/colocated-tests.ts
|
|
1102
1102
|
const RULE$25 = "colocated-test";
|
|
1103
|
-
const FIRST$
|
|
1103
|
+
const FIRST$13 = 1;
|
|
1104
1104
|
const READ_CONCURRENCY$17 = 64;
|
|
1105
1105
|
const ROOT_SUBPATH = ".";
|
|
1106
1106
|
const NAME_GROUP = "name";
|
|
1107
1107
|
const SPECIFIER_GROUP = "specifier";
|
|
1108
|
-
const SCRIPT$
|
|
1108
|
+
const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
|
|
1109
1109
|
const TEST_FILE = /\.test\.[cm]?[jt]sx?$/u;
|
|
1110
1110
|
const MANIFEST_NAME = /package\.json$/u;
|
|
1111
1111
|
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
|
|
@@ -1114,7 +1114,7 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
1114
1114
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
1115
1115
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
1116
1116
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
1117
|
-
const EXCLUDED$
|
|
1117
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
1118
1118
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
1119
1119
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
1120
1120
|
const Manifest$2 = Schema.Struct({
|
|
@@ -1122,19 +1122,19 @@ const Manifest$2 = Schema.Struct({
|
|
|
1122
1122
|
exports: Schema.optional(Schema.Unknown)
|
|
1123
1123
|
});
|
|
1124
1124
|
const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
1125
|
-
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1125
|
+
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1126
1126
|
const problemFor$4 = (test, message) => ({
|
|
1127
1127
|
file: test.file,
|
|
1128
|
-
line: FIRST$
|
|
1129
|
-
column: FIRST$
|
|
1128
|
+
line: FIRST$13,
|
|
1129
|
+
column: FIRST$13,
|
|
1130
1130
|
rule: RULE$25,
|
|
1131
1131
|
message: `${test.base} ${message}`
|
|
1132
1132
|
});
|
|
1133
1133
|
const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
1134
1134
|
const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE.test(name)));
|
|
1135
|
-
const ownerOf$
|
|
1135
|
+
const ownerOf$3 = (packages, name) => {
|
|
1136
1136
|
const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
|
|
1137
|
-
return Array.last(Array.sort(owners, byLength));
|
|
1137
|
+
return Array.last(Array.sort(owners, byLength$1));
|
|
1138
1138
|
};
|
|
1139
1139
|
const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.map((name) => pipe(publicEntriesOf({
|
|
1140
1140
|
manifest,
|
|
@@ -1143,7 +1143,7 @@ const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Op
|
|
|
1143
1143
|
}), Array.filter(({ source }) => dirname(source) === directory), Array.map(({ label }) => String$1.replace(ROOT_SUBPATH, name)(label)))), Option.getOrElse(() => []));
|
|
1144
1144
|
const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context, test) {
|
|
1145
1145
|
const files = yield* RepositoryFiles;
|
|
1146
|
-
const owner = ownerOf$
|
|
1146
|
+
const owner = ownerOf$3(context.packages, test.name);
|
|
1147
1147
|
if (Option.isNone(owner)) return [];
|
|
1148
1148
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
|
|
1149
1149
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
@@ -1175,13 +1175,13 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
|
1175
1175
|
/** @internal */
|
|
1176
1176
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
1177
1177
|
const files = yield* RepositoryFiles;
|
|
1178
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
1178
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$3);
|
|
1179
1179
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
1180
1180
|
const context = {
|
|
1181
1181
|
root,
|
|
1182
1182
|
packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map(String$1.replace(MANIFEST_NAME, "")))
|
|
1183
1183
|
};
|
|
1184
|
-
const tests = pipe(names, Array.filter((name) => SCRIPT$
|
|
1184
|
+
const tests = pipe(names, Array.filter((name) => SCRIPT$2.test(name)), Array.map((name) => {
|
|
1185
1185
|
const file = files.join(root, name);
|
|
1186
1186
|
return {
|
|
1187
1187
|
name,
|
|
@@ -1195,10 +1195,10 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
1195
1195
|
});
|
|
1196
1196
|
// src/features/placement/model/dangling-links.ts
|
|
1197
1197
|
const RULE$24 = "dangling-link";
|
|
1198
|
-
const SEPARATOR$
|
|
1199
|
-
const FIRST$
|
|
1198
|
+
const SEPARATOR$14 = "/";
|
|
1199
|
+
const FIRST$12 = 1;
|
|
1200
1200
|
const READ_CONCURRENCY$16 = 16;
|
|
1201
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
1201
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$14}`)(name);
|
|
1202
1202
|
/** @internal */
|
|
1203
1203
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
1204
1204
|
const files = yield* RepositoryFiles;
|
|
@@ -1208,8 +1208,8 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
1208
1208
|
const link = yield* files.readLink(file);
|
|
1209
1209
|
return pipe(link, Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))), Option.filter((target) => !pipe(listed, Array.some(holds(target)))), Option.map((target) => ({
|
|
1210
1210
|
file,
|
|
1211
|
-
line: FIRST$
|
|
1212
|
-
column: FIRST$
|
|
1211
|
+
line: FIRST$12,
|
|
1212
|
+
column: FIRST$12,
|
|
1213
1213
|
rule: RULE$24,
|
|
1214
1214
|
message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
|
|
1215
1215
|
})));
|
|
@@ -1217,6 +1217,75 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
1217
1217
|
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$16 });
|
|
1218
1218
|
return Array.getSomes(found);
|
|
1219
1219
|
});
|
|
1220
|
+
// src/features/placement/model/layered-source.ts
|
|
1221
|
+
const LAYERED_RULE = "layered-source";
|
|
1222
|
+
const ENTRY_RULE = "public-entry";
|
|
1223
|
+
const FIRST$11 = 1;
|
|
1224
|
+
const ROOT_WORKSPACE = ".";
|
|
1225
|
+
const SOURCE_DIRECTORY = "src";
|
|
1226
|
+
const SEPARATOR$13 = "/";
|
|
1227
|
+
const LOOSE_DEPTH = 2;
|
|
1228
|
+
const LAYERS = [
|
|
1229
|
+
"app",
|
|
1230
|
+
"pages",
|
|
1231
|
+
"widgets",
|
|
1232
|
+
"features",
|
|
1233
|
+
"entities",
|
|
1234
|
+
"shared"
|
|
1235
|
+
];
|
|
1236
|
+
const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
|
|
1237
|
+
const ROOT_ALLOWED = /^(?:[^/]+\.config\.[cm]?[jt]s|alchemy\.[^/]+\.ts|[^/]+\.d\.[cm]?ts|bin\/.+)$/u;
|
|
1238
|
+
const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
|
|
1239
|
+
const EXCLUDED$2 = [
|
|
1240
|
+
":(exclude,attr:linguist-vendored)",
|
|
1241
|
+
":(exclude,attr:linguist-generated)",
|
|
1242
|
+
":(exclude,attr:linguist-documentation)"
|
|
1243
|
+
];
|
|
1244
|
+
const OUTSIDE_MESSAGE = "sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root.";
|
|
1245
|
+
const LOOSE_MESSAGE = "sits directly in src/. Put it in a layer: app/ for entry points and wiring, features/<verb>-<object>/ for one operation, entities/<noun>/ for a shared domain object, or shared/<segment>/ for code without domain rules.";
|
|
1246
|
+
const LAYER_MESSAGE = `is not an FSD layer. src/ holds only ${Array.join(LAYERS, ", ")}.`;
|
|
1247
|
+
const ENTRY_MESSAGE = "is a package entry that points inside a slice. Point exports and bin at bin/<name>.ts, src/app/<entry>.ts or a slice's index.ts.";
|
|
1248
|
+
const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
|
|
1249
|
+
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1250
|
+
const problemAt$3 = (file, rule, message) => ({
|
|
1251
|
+
file,
|
|
1252
|
+
line: FIRST$11,
|
|
1253
|
+
column: FIRST$11,
|
|
1254
|
+
rule,
|
|
1255
|
+
message
|
|
1256
|
+
});
|
|
1257
|
+
const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$13}`)(name)), (owners) => Array.last(Array.sort(owners, byLength)), Option.map((workspace) => ({
|
|
1258
|
+
workspace,
|
|
1259
|
+
inner: String$1.slice(workspace.length + 1)(name)
|
|
1260
|
+
})));
|
|
1261
|
+
const layerProblemOf = (owned) => {
|
|
1262
|
+
const parts = String$1.split(owned.inner, SEPARATOR$13);
|
|
1263
|
+
const [top, layer] = parts;
|
|
1264
|
+
if (top !== SOURCE_DIRECTORY) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$13}${owned.inner}`, OUTSIDE_MESSAGE], () => !ROOT_ALLOWED.test(owned.inner));
|
|
1265
|
+
if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$13}${owned.inner}`, LOOSE_MESSAGE]);
|
|
1266
|
+
return Option.liftPredicate([`${owned.workspace}${SEPARATOR$13}${SOURCE_DIRECTORY}${SEPARATOR$13}${layer}`, LAYER_MESSAGE], () => !pipe(LAYERS, Array.contains(layer ?? "")));
|
|
1267
|
+
};
|
|
1268
|
+
const entryProblems = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
|
|
1269
|
+
const files = yield* RepositoryFiles;
|
|
1270
|
+
const directory = files.join(root, workspace);
|
|
1271
|
+
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));
|
|
1272
|
+
const join = (target) => files.join(directory, target);
|
|
1273
|
+
return pipe(text, Option.flatMap(decodeEntryManifest), Option.map((manifest) => publicEntriesOf({
|
|
1274
|
+
manifest,
|
|
1275
|
+
join,
|
|
1276
|
+
packEntries: []
|
|
1277
|
+
})), Option.getOrElse(() => []), Array.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))), Array.map(({ label, source }) => problemAt$3(source, ENTRY_RULE, `${label} ${ENTRY_MESSAGE}`)));
|
|
1278
|
+
});
|
|
1279
|
+
/** @internal */
|
|
1280
|
+
const checkLayeredSource = Effect.fn("checkLayeredSource")(function* checkLayeredSource(root) {
|
|
1281
|
+
const files = yield* RepositoryFiles;
|
|
1282
|
+
const declared = yield* workspaceDirectories(root);
|
|
1283
|
+
const workspaces = pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE));
|
|
1284
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$2);
|
|
1285
|
+
const layered = pipe(listed, Array.filter((name) => SCRIPT$1.test(name)), Array.map(ownerOf$2(workspaces)), Array.getSomes, Array.map(layerProblemOf), Array.getSomes, Array.dedupeWith(([left], [right]) => left === right), Array.map(([file, message]) => problemAt$3(files.join(root, file), LAYERED_RULE, message)));
|
|
1286
|
+
const entries = yield* pipe(workspaces, Effect.forEach((workspace) => entryProblems(root, workspace)));
|
|
1287
|
+
return [...layered, ...Array.flatten(entries)];
|
|
1288
|
+
});
|
|
1220
1289
|
// src/features/placement/model/nested-docs.ts
|
|
1221
1290
|
const RULE$23 = "nested-docs";
|
|
1222
1291
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
@@ -1384,6 +1453,7 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
|
|
|
1384
1453
|
checkRootDocs(root),
|
|
1385
1454
|
checkColocatedTests(root),
|
|
1386
1455
|
checkAgentDocsLength(root),
|
|
1456
|
+
checkLayeredSource(root),
|
|
1387
1457
|
checkDanglingLinks(root)
|
|
1388
1458
|
], { concurrency: "unbounded" });
|
|
1389
1459
|
return Array.flatten(found);
|
|
@@ -2138,7 +2208,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
2138
2208
|
};
|
|
2139
2209
|
const problemOf$4 = (checker) => (candidate) => {
|
|
2140
2210
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
2141
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
2211
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$5({
|
|
2142
2212
|
rule: RULE$14,
|
|
2143
2213
|
message: messageOf(forward.callee.getText())
|
|
2144
2214
|
})(candidate.name)));
|
|
@@ -2228,7 +2298,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
2228
2298
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
2229
2299
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
2230
2300
|
};
|
|
2231
|
-
const annotationProblem = (message) => problemAt$
|
|
2301
|
+
const annotationProblem = (message) => problemAt$5({
|
|
2232
2302
|
rule: "owner-annotation",
|
|
2233
2303
|
message
|
|
2234
2304
|
});
|
|
@@ -2361,7 +2431,7 @@ const shapeProblem = (site, matches) => {
|
|
|
2361
2431
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
2362
2432
|
onSome: () => "Use the library type instead of copying it."
|
|
2363
2433
|
});
|
|
2364
|
-
return problemAt$
|
|
2434
|
+
return problemAt$5({
|
|
2365
2435
|
rule: "library-shape",
|
|
2366
2436
|
message: `This shape copies ${shown}. ${advice}`
|
|
2367
2437
|
})(site.node);
|
|
@@ -2455,7 +2525,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
2455
2525
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
2456
2526
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
2457
2527
|
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.`;
|
|
2458
|
-
return verdict([problemAt$
|
|
2528
|
+
return verdict([problemAt$5({
|
|
2459
2529
|
rule: "owner-extension",
|
|
2460
2530
|
message
|
|
2461
2531
|
})(site.node)], []);
|
|
@@ -2477,7 +2547,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2477
2547
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
2478
2548
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
2479
2549
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
2480
|
-
return verdict([problemAt$
|
|
2550
|
+
return verdict([problemAt$5({
|
|
2481
2551
|
rule: "owner-value-set",
|
|
2482
2552
|
message
|
|
2483
2553
|
})(site.node)], []);
|
|
@@ -2485,7 +2555,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2485
2555
|
const candidates = libraryCandidates(context)(site);
|
|
2486
2556
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
2487
2557
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
2488
|
-
return verdict([problemAt$
|
|
2558
|
+
return verdict([problemAt$5({
|
|
2489
2559
|
rule: "library-value-set",
|
|
2490
2560
|
message
|
|
2491
2561
|
})(site.node)], []);
|
|
@@ -2516,7 +2586,7 @@ const isValuePosition = (node) => {
|
|
|
2516
2586
|
const { parent } = node;
|
|
2517
2587
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
2518
2588
|
};
|
|
2519
|
-
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$
|
|
2589
|
+
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$5({
|
|
2520
2590
|
rule: "owned-literal",
|
|
2521
2591
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
2522
2592
|
})(literal)));
|