@r_masseater/msch 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -51,4 +51,6 @@ oxlint のバージョンは、@effect/tsgo が対応するものに合わせる
51
51
  `tsconfig.json` の `types` に `@r_masseater/msch/vite` を足すと、`defineConfig` の `msch` に型が付く。
52
52
  `msch` は、Betterleaks、commitlint、textlint、Steiger、fallow など、`vite.config.ts` で設定された vite-plus-adopt のすべてのチェックも実行する。これらのチェックでは `VPA_BASE` などの環境変数を読み取るため、タスクは `cache: false` で実行すること。Git フックでは、pre-commit で `msch --staged` を、commit-msg で `msch --commit-msg "$1"` を実行すること。
53
53
  `types` に `@r_masseater/msch/vite` を指定すると、`defineConfig` の vite-plus-adopt セクションも型付けされる。`ToolSections` 型は同じエントリから来ている。
54
+ masseater の日本語の textlint ルールを使うときは、`@r_masseater/msch/lint` の `textlintPresets` を `textlint.presets` に渡す。
55
+ `textlint.rules` に `"@r_masseater/preset-ja"` を書くと有効になる。
54
56
  指摘があれば終了コードは 1 になる。`--json` を付けると結果を JSON で出す。
@@ -111,6 +111,8 @@ const RuleNameSchema = Schema.Literals([
111
111
  "colocated-test",
112
112
  "layered-source",
113
113
  "public-entry",
114
+ "source-alias",
115
+ "runtime-name",
114
116
  "comment",
115
117
  "applied-package",
116
118
  "package-script",
@@ -163,4 +165,4 @@ const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${St
163
165
  const JSON_FLAG = "--json";
164
166
  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 };
165
167
 
166
- //# sourceMappingURL=cli-contract-BscmWo5N.mjs.map
168
+ //# sourceMappingURL=cli-contract-WGNqIbe-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-contract-BscmWo5N.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(probl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AO;CACb,MAAM,OAAO;CACb,QAAQ,OAAO;CACf,MAAM;CACN,SAAS,OAAO;AAClB,CAAC;AAID,MAAa,cAAc,OAAO,MAAM,aAAa;AASrD,MAAa,aACV,EAAE,MAAM,eACR,UAAyB;CACxB,MAAM,KAAK,cAAc,CAAC,CAAC;CAC3B,MAAM,OAAO,IAAI;CACjB,QAAQ,SAAS,IAAI;CACrB;CACA;AACF;AAEF,MAAM,eAAqC,MAAM,WAAW;CAC1D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,MAAM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,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"}
1
+ {"version":3,"file":"cli-contract-WGNqIbe-.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 \"source-alias\",\n \"runtime-name\",\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,GAA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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;;AC3H1G,MAAa,YAAY"}
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
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";
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$6, 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-WGNqIbe-.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$16 = "/";
320
+ const SEPARATOR$17 = "/";
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$16}`))
362
+ prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$17}`))
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$16}${entry}`));
369
+ return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$17}${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$15 = "/";
419
+ const SEPARATOR$16 = "/";
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$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));
431
+ const segments = String$1.split(specifier, SEPARATOR$16);
432
+ if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$16));
433
+ return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$16));
434
434
  };
435
435
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
436
436
  const runtimeSpecifierOf = (statement) => {
@@ -525,7 +525,7 @@ const InstalledManifest = Schema.Struct({
525
525
  peerDependencies: DependencyMap,
526
526
  peerDependenciesMeta: PeerMeta
527
527
  });
528
- const decodeManifest$3 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
528
+ const decodeManifest$4 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
529
529
  const keysOf$2 = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
530
530
  const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
531
531
  const installedNames = (manifest) => [
@@ -536,7 +536,7 @@ const installedNames = (manifest) => [
536
536
  const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
537
537
  const files = yield* RepositoryFiles;
538
538
  const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));
539
- return pipe(text, Option.flatMap(decodeManifest$3), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
539
+ return pipe(text, Option.flatMap(decodeManifest$4), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
540
540
  });
541
541
  const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
542
542
  const files = yield* RepositoryFiles;
@@ -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$4 = ({ file }, source) => (found) => ({
1042
+ const problemAt$5 = ({ 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$4(entry, source)));
1048
+ const problemsIn$12 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$5(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$14 = 1;
1086
+ const FIRST$15 = 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$14,
1094
+ column: FIRST$15,
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,7 +1100,7 @@ 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$13 = 1;
1103
+ const FIRST$14 = 1;
1104
1104
  const READ_CONCURRENCY$17 = 64;
1105
1105
  const ROOT_SUBPATH = ".";
1106
1106
  const NAME_GROUP = "name";
@@ -1117,16 +1117,16 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
1117
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
- const Manifest$2 = Schema.Struct({
1120
+ const Manifest$3 = Schema.Struct({
1121
1121
  name: Schema.optional(Schema.String),
1122
1122
  exports: Schema.optional(Schema.Unknown)
1123
1123
  });
1124
- const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
1124
+ const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
1125
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$13,
1129
- column: FIRST$13,
1128
+ line: FIRST$14,
1129
+ column: FIRST$14,
1130
1130
  rule: RULE$25,
1131
1131
  message: `${test.base} ${message}`
1132
1132
  });
@@ -1147,7 +1147,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
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);
1150
- return pipe(text, Option.flatMap(decodeManifest$2), Option.map(specifiersBeside({
1150
+ return pipe(text, Option.flatMap(decodeManifest$3), Option.map(specifiersBeside({
1151
1151
  join,
1152
1152
  dirname: files.dirname,
1153
1153
  directory: test.directory
@@ -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$14 = "/";
1199
- const FIRST$12 = 1;
1198
+ const SEPARATOR$15 = "/";
1199
+ const FIRST$13 = 1;
1200
1200
  const READ_CONCURRENCY$16 = 16;
1201
- const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$14}`)(name);
1201
+ const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$15}`)(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$12,
1212
- column: FIRST$12,
1211
+ line: FIRST$13,
1212
+ column: FIRST$13,
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,13 +1217,27 @@ 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/member-sources.ts
1221
+ const ROOT_WORKSPACE = ".";
1222
+ const EXCLUDED$2 = [
1223
+ ":(exclude,attr:linguist-vendored)",
1224
+ ":(exclude,attr:linguist-generated)",
1225
+ ":(exclude,attr:linguist-documentation)"
1226
+ ];
1227
+ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
1228
+ const files = yield* RepositoryFiles;
1229
+ const declared = yield* workspaceDirectories(root);
1230
+ return {
1231
+ workspaces: pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE)),
1232
+ listed: yield* files.matchingFiles(root, EXCLUDED$2)
1233
+ };
1234
+ });
1220
1235
  // src/features/placement/model/layered-source.ts
1221
1236
  const LAYERED_RULE = "layered-source";
1222
1237
  const ENTRY_RULE = "public-entry";
1223
- const FIRST$11 = 1;
1224
- const ROOT_WORKSPACE = ".";
1238
+ const FIRST$12 = 1;
1225
1239
  const SOURCE_DIRECTORY = "src";
1226
- const SEPARATOR$13 = "/";
1240
+ const SEPARATOR$14 = "/";
1227
1241
  const LOOSE_DEPTH = 2;
1228
1242
  const LAYERS = [
1229
1243
  "app",
@@ -1236,34 +1250,29 @@ const LAYERS = [
1236
1250
  const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
1237
1251
  const ROOT_ALLOWED = /^(?:[^/]+\.config\.[cm]?[jt]s|alchemy\.[^/]+\.ts|[^/]+\.d\.[cm]?ts|bin\/.+)$/u;
1238
1252
  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
1253
  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
1254
  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
1255
  const LAYER_MESSAGE = `is not an FSD layer. src/ holds only ${Array.join(LAYERS, ", ")}.`;
1247
1256
  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
1257
  const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
1249
1258
  const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
1250
- const problemAt$3 = (file, rule, message) => ({
1259
+ const problemAt$4 = (file, rule, message) => ({
1251
1260
  file,
1252
- line: FIRST$11,
1253
- column: FIRST$11,
1261
+ line: FIRST$12,
1262
+ column: FIRST$12,
1254
1263
  rule,
1255
1264
  message
1256
1265
  });
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) => ({
1266
+ const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$14}`)(name)), (owners) => Array.last(Array.sort(owners, byLength)), Option.map((workspace) => ({
1258
1267
  workspace,
1259
1268
  inner: String$1.slice(workspace.length + 1)(name)
1260
1269
  })));
1261
1270
  const layerProblemOf = (owned) => {
1262
- const parts = String$1.split(owned.inner, SEPARATOR$13);
1271
+ const parts = String$1.split(owned.inner, SEPARATOR$14);
1263
1272
  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 ?? "")));
1273
+ if (top !== SOURCE_DIRECTORY) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$14}${owned.inner}`, OUTSIDE_MESSAGE], () => !ROOT_ALLOWED.test(owned.inner));
1274
+ if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$14}${owned.inner}`, LOOSE_MESSAGE]);
1275
+ return Option.liftPredicate([`${owned.workspace}${SEPARATOR$14}${SOURCE_DIRECTORY}${SEPARATOR$14}${layer}`, LAYER_MESSAGE], () => !pipe(LAYERS, Array.contains(layer ?? "")));
1267
1276
  };
1268
1277
  const entryProblems = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
1269
1278
  const files = yield* RepositoryFiles;
@@ -1274,23 +1283,21 @@ const entryProblems = Effect.fn("entryProblems")(function* entryProblems(root, w
1274
1283
  manifest,
1275
1284
  join,
1276
1285
  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}`)));
1286
+ })), Option.getOrElse(() => []), Array.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))), Array.map(({ label, source }) => problemAt$4(source, ENTRY_RULE, `${label} ${ENTRY_MESSAGE}`)));
1278
1287
  });
1279
1288
  /** @internal */
1280
1289
  const checkLayeredSource = Effect.fn("checkLayeredSource")(function* checkLayeredSource(root) {
1281
1290
  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)));
1291
+ const { workspaces, listed } = yield* memberSources(root);
1292
+ 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$4(files.join(root, file), LAYERED_RULE, message)));
1286
1293
  const entries = yield* pipe(workspaces, Effect.forEach((workspace) => entryProblems(root, workspace)));
1287
1294
  return [...layered, ...Array.flatten(entries)];
1288
1295
  });
1289
1296
  // src/features/placement/model/nested-docs.ts
1290
1297
  const RULE$23 = "nested-docs";
1291
1298
  const CONFIG_FILE$4 = "vite.config.ts";
1292
- const SEPARATOR$12 = "/";
1293
- const FIRST$10 = 1;
1299
+ const SEPARATOR$13 = "/";
1300
+ const FIRST$11 = 1;
1294
1301
  const READ_CONCURRENCY$15 = 64;
1295
1302
  const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
1296
1303
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
@@ -1298,11 +1305,11 @@ const README = /^README(?:\.[^/]+)?$/iu;
1298
1305
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
1299
1306
  const taggedError$3 = Schema.TaggedError;
1300
1307
  var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
1301
- const isNested = (name) => String$1.includes(SEPARATOR$12)(name);
1308
+ const isNested = (name) => String$1.includes(SEPARATOR$13)(name);
1302
1309
  const problemFor$3 = (file, message) => ({
1303
1310
  file,
1304
- line: FIRST$10,
1305
- column: FIRST$10,
1311
+ line: FIRST$11,
1312
+ column: FIRST$11,
1306
1313
  rule: RULE$23,
1307
1314
  message
1308
1315
  });
@@ -1354,20 +1361,20 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
1354
1361
  });
1355
1362
  // src/features/placement/model/root-docs.ts
1356
1363
  const RULE$22 = "root-docs";
1357
- const SEPARATOR$11 = "/";
1358
- const FIRST$9 = 1;
1364
+ const SEPARATOR$12 = "/";
1365
+ const FIRST$10 = 1;
1359
1366
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
1360
1367
  const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
1361
1368
  const MESSAGE$5 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
1362
- const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$11)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1369
+ const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$12)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1363
1370
  /** @internal */
1364
1371
  const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
1365
1372
  const files = yield* RepositoryFiles;
1366
1373
  const names = yield* files.listedFiles(root);
1367
1374
  return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
1368
1375
  file: files.join(root, name),
1369
- line: FIRST$9,
1370
- column: FIRST$9,
1376
+ line: FIRST$10,
1377
+ column: FIRST$10,
1371
1378
  rule: RULE$22,
1372
1379
  message: `${name} ${MESSAGE$5}`
1373
1380
  })));
@@ -1380,7 +1387,7 @@ const START$12 = 0;
1380
1387
  const CHECK_POLICY = "@r_masseater/msch";
1381
1388
  const MARKETPLACE = ".claude-plugin/marketplace.json";
1382
1389
  const RELATIVE = /^\.\//u;
1383
- const SEPARATOR$10 = "/";
1390
+ const SEPARATOR$11 = "/";
1384
1391
  const MarketplacePlugin = Schema.Struct({
1385
1392
  name: Schema.optional(Schema.String),
1386
1393
  source: Schema.Unknown
@@ -1392,7 +1399,7 @@ const NO_PLUGINS = {
1392
1399
  };
1393
1400
  const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
1394
1401
  const messageFor = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
1395
- const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$10)(directory), Array.last, Option.getOrElse(() => directory));
1402
+ const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$11)(directory), Array.last, Option.getOrElse(() => directory));
1396
1403
  const pluginsOf = (plugins) => {
1397
1404
  const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE, "")));
1398
1405
  const segments = pipe(directories, Array.map(lastSegment));
@@ -1444,6 +1451,62 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
1444
1451
  const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$14 });
1445
1452
  return Array.flatten(found);
1446
1453
  });
1454
+ // src/features/placement/model/source-names.ts
1455
+ const ALIAS_RULE = "source-alias";
1456
+ const RUNTIME_RULE = "runtime-name";
1457
+ const FIRST$9 = 1;
1458
+ const SEPARATOR$10 = "/";
1459
+ const SOURCE_ALIAS = "#/*";
1460
+ const SOURCE_TARGET = "./src/*";
1461
+ const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
1462
+ const RUNTIME_NAMES = [
1463
+ "worker",
1464
+ "workers",
1465
+ "cloudflare",
1466
+ "durable-objects",
1467
+ "node",
1468
+ "nodejs",
1469
+ "bun",
1470
+ "deno",
1471
+ "browser",
1472
+ "tauri",
1473
+ "electron",
1474
+ "lambda",
1475
+ "vercel"
1476
+ ];
1477
+ const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
1478
+ const RUNTIME_MESSAGE = "names the runtime that runs the code. Name folders after what the code does: entry code goes in app/entrypoint/, and code that does not depend on the runtime moves to the slice or shared segment of its role.";
1479
+ const Manifest$2 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
1480
+ const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
1481
+ const problemAt$3 = (file, rule, message) => ({
1482
+ file,
1483
+ line: FIRST$9,
1484
+ column: FIRST$9,
1485
+ rule,
1486
+ message
1487
+ });
1488
+ const targetsOf = (target) => {
1489
+ if (Predicate.isString(target)) return [target];
1490
+ if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
1491
+ return [];
1492
+ };
1493
+ const intoSource = ([key, target]) => !(key === SOURCE_ALIAS && pipe(targetsOf(target), Array.every((path) => path === SOURCE_TARGET))) && pipe(targetsOf(target), Array.some((path) => SOURCE_PREFIX.test(path)));
1494
+ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
1495
+ const files = yield* RepositoryFiles;
1496
+ const manifest = files.join(root, workspace, MANIFEST_FILE);
1497
+ const text = yield* files.readFile(manifest);
1498
+ return pipe(text, Option.flatMap(decodeManifest$2), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemAt$3(manifest, ALIAS_RULE, `"${key}" ${ALIAS_MESSAGE}`)));
1499
+ });
1500
+ const RUNTIME_FOLDER = new RegExp(`^(?<folder>.*?/src(?:/[^/]+)*?/(?:${Array.join(RUNTIME_NAMES, "|")}))/`, "u");
1501
+ const runtimeFolderOf = (name) => pipe(Option.fromNullishOr(RUNTIME_FOLDER.exec(name)), Option.flatMap((found) => Option.fromUndefinedOr(found.groups)), Option.flatMap((groups) => Option.fromUndefinedOr(groups["folder"])));
1502
+ /** @internal */
1503
+ const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
1504
+ const files = yield* RepositoryFiles;
1505
+ const { workspaces, listed } = yield* memberSources(root);
1506
+ const folders = pipe(listed, Array.filter((name) => pipe(workspaces, Array.some((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$10}src${SEPARATOR$10}`)(name)))), Array.map(runtimeFolderOf), Array.getSomes, Array.dedupe, Array.map((folder) => problemAt$3(files.join(root, folder), RUNTIME_RULE, RUNTIME_MESSAGE)));
1507
+ const aliases = yield* pipe(workspaces, Effect.forEach((workspace) => aliasProblems(root, workspace)));
1508
+ return [...folders, ...Array.flatten(aliases)];
1509
+ });
1447
1510
  // src/features/placement/model/placement-checks.ts
1448
1511
  /** @internal */
1449
1512
  const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root) {
@@ -1454,7 +1517,8 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
1454
1517
  checkColocatedTests(root),
1455
1518
  checkAgentDocsLength(root),
1456
1519
  checkLayeredSource(root),
1457
- checkDanglingLinks(root)
1520
+ checkDanglingLinks(root),
1521
+ checkSourceNames(root)
1458
1522
  ], { concurrency: "unbounded" });
1459
1523
  return Array.flatten(found);
1460
1524
  });
@@ -2208,7 +2272,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
2208
2272
  };
2209
2273
  const problemOf$4 = (checker) => (candidate) => {
2210
2274
  if (changesTheCall(candidate.wrapper)) return Option.none();
2211
- return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$5({
2275
+ return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$6({
2212
2276
  rule: RULE$14,
2213
2277
  message: messageOf(forward.callee.getText())
2214
2278
  })(candidate.name)));
@@ -2298,7 +2362,7 @@ const ownerValuesOf = (checker) => (declaration) => {
2298
2362
  const type = checker.getTypeAtLocation(declaration.name);
2299
2363
  return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
2300
2364
  };
2301
- const annotationProblem = (message) => problemAt$5({
2365
+ const annotationProblem = (message) => problemAt$6({
2302
2366
  rule: "owner-annotation",
2303
2367
  message
2304
2368
  });
@@ -2431,7 +2495,7 @@ const shapeProblem = (site, matches) => {
2431
2495
  onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
2432
2496
  onSome: () => "Use the library type instead of copying it."
2433
2497
  });
2434
- return problemAt$5({
2498
+ return problemAt$6({
2435
2499
  rule: "library-shape",
2436
2500
  message: `This shape copies ${shown}. ${advice}`
2437
2501
  })(site.node);
@@ -2525,7 +2589,7 @@ const derivedVerdict = (context) => (site) => {
2525
2589
  const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
2526
2590
  if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
2527
2591
  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.`;
2528
- return verdict([problemAt$5({
2592
+ return verdict([problemAt$6({
2529
2593
  rule: "owner-extension",
2530
2594
  message
2531
2595
  })(site.node)], []);
@@ -2547,7 +2611,7 @@ const originalVerdict = (context) => (site) => {
2547
2611
  const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
2548
2612
  if (Array.isReadonlyArrayNonEmpty(owners)) {
2549
2613
  const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
2550
- return verdict([problemAt$5({
2614
+ return verdict([problemAt$6({
2551
2615
  rule: "owner-value-set",
2552
2616
  message
2553
2617
  })(site.node)], []);
@@ -2555,7 +2619,7 @@ const originalVerdict = (context) => (site) => {
2555
2619
  const candidates = libraryCandidates(context)(site);
2556
2620
  if (Array.isReadonlyArrayNonEmpty(candidates)) {
2557
2621
  const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
2558
- return verdict([problemAt$5({
2622
+ return verdict([problemAt$6({
2559
2623
  rule: "library-value-set",
2560
2624
  message
2561
2625
  })(site.node)], []);
@@ -2586,7 +2650,7 @@ const isValuePosition = (node) => {
2586
2650
  const { parent } = node;
2587
2651
  return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
2588
2652
  };
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({
2653
+ 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$6({
2590
2654
  rule: "owned-literal",
2591
2655
  message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
2592
2656
  })(literal)));