@r_masseater/msch 0.23.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{cli-contract-BViRo52q.mjs → cli-contract-B5ilWPaY.mjs} +7 -4
- package/dist/cli-contract-B5ilWPaY.mjs.map +1 -0
- package/dist/cli.mjs +91 -35
- package/dist/cli.mjs.map +1 -1
- package/dist/decision-rules.mjs +2 -2
- package/dist/decision-rules.mjs.map +1 -1
- package/dist/{inline-exports.d.mts → lint-rules.d.mts} +1 -1
- package/dist/{inline-exports.mjs → lint-rules.mjs} +162 -21
- package/dist/lint-rules.mjs.map +1 -0
- package/dist/lint.d.mts +5 -28
- package/dist/lint.mjs +199 -222
- package/dist/lint.mjs.map +1 -1
- package/dist/oxlint.mjs +1 -1
- package/dist/{workspace-CMPDXFWk.mjs → workspace-BPoE5oW1.mjs} +9 -9
- package/dist/{workspace-CMPDXFWk.mjs.map → workspace-BPoE5oW1.mjs.map} +1 -1
- package/dist/workspace-settings.mjs +1 -1
- package/package.json +5 -5
- package/skills/msch-checks/SKILL.md +1 -1
- package/dist/cli-contract-BViRo52q.mjs.map +0 -1
- package/dist/inline-exports.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ export default defineConfig({ lint });
|
|
|
32
32
|
`steigerRules` は `steiger` セクションに渡す Steiger のルールリストで、推奨の Feature-Sliced Design ルールのあとに masseater のリポジトリで足すルールを並べる。
|
|
33
33
|
decision ルールは呼ぶたびに費用がかかるので、プリセットは有効にしない。
|
|
34
34
|
`decisionRules` を掛けたいファイルの overrides に渡す。
|
|
35
|
+
`tracedRules` は、@r_masseater/workers-tracing でスパンを取る Worker のコードの overrides に渡す。
|
|
35
36
|
|
|
36
37
|
Vite+ はワークスペースの `vite.config.ts` の `lint` を使わない。
|
|
37
38
|
1 つのワークスペースだけに効く設定は、そのワークスペースの `vite.config.ts` の `msch` にリテラルで書く。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as NODE_MODULES } from "./repository-files-B11FFAIk.mjs";
|
|
2
2
|
import { Array, Option, Order, Schema, String as String$1, pipe } from "effect";
|
|
3
3
|
import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
|
|
4
|
-
import { isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBlock, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportDeclaration, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isReturnStatement, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
|
|
4
|
+
import { isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBlock, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportAssignment, isExportDeclaration, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isReturnStatement, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
|
|
5
5
|
import { API, IndexKind, SignatureKind } from "typescript/sync";
|
|
6
6
|
// src/shared/lib/syntax.ts
|
|
7
7
|
const NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;
|
|
@@ -26,7 +26,7 @@ const packageOf = (fileName) => {
|
|
|
26
26
|
return pipe(Array.take(segments, UNSCOPED_SEGMENTS), Array.join("/"));
|
|
27
27
|
};
|
|
28
28
|
const descendantsOf = (node) => pipe(childrenOf(node), Array.flatMap((child) => Array.prepend(descendantsOf(child), child)));
|
|
29
|
-
const isExternalFile = (program) => (sourceFile) => String$1.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) || program.isSourceFileFromExternalLibrary(sourceFile);
|
|
29
|
+
const isExternalFile = (program) => (sourceFile) => !program.isSourceFileDefaultLibrary(sourceFile) && (String$1.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) || program.isSourceFileFromExternalLibrary(sourceFile));
|
|
30
30
|
const isExternalDeclaration = (program) => (declaration) => isExternalFile(program)(declaration.getSourceFile());
|
|
31
31
|
const ALIAS_KINDS = /* @__PURE__ */ new Set([
|
|
32
32
|
SyntaxKind.ImportSpecifier,
|
|
@@ -37,7 +37,9 @@ const ALIAS_KINDS = /* @__PURE__ */ new Set([
|
|
|
37
37
|
SyntaxKind.ExportAssignment
|
|
38
38
|
]);
|
|
39
39
|
const declarationsOf = (symbol) => pipe(symbol.declarations, Array.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))));
|
|
40
|
-
const
|
|
40
|
+
const isEntityName = (expression) => isIdentifier(expression) || isPropertyAccessExpression(expression) && isEntityName(expression.expression);
|
|
41
|
+
const aliasesAnEntity = (declaration) => !isExportAssignment(declaration) || isEntityName(declaration.expression);
|
|
42
|
+
const isAliasDeclaration = (declaration) => ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);
|
|
41
43
|
const resolvedSymbol = (checker) => (symbol) => {
|
|
42
44
|
if (!pipe(declarationsOf(symbol), Array.some((declaration) => isAliasDeclaration(declaration)))) return symbol;
|
|
43
45
|
return checker.getAliasedSymbol(symbol);
|
|
@@ -81,6 +83,7 @@ const RuleNameSchema = Schema.Literals([
|
|
|
81
83
|
"python-command",
|
|
82
84
|
"docker-file",
|
|
83
85
|
"docker-command",
|
|
86
|
+
"unnamed-restriction",
|
|
84
87
|
"git-subpath-dependency",
|
|
85
88
|
"unneeded-file",
|
|
86
89
|
"unneeded-setup",
|
|
@@ -158,4 +161,4 @@ const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${St
|
|
|
158
161
|
const JSON_FLAG = "--json";
|
|
159
162
|
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 };
|
|
160
163
|
|
|
161
|
-
//# sourceMappingURL=cli-contract-
|
|
164
|
+
//# sourceMappingURL=cli-contract-B5ilWPaY.mjs.map
|
|
@@ -0,0 +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,e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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;;ACvH1G,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$4, 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-
|
|
2
|
+
import { A as MANIFEST_FILE, C as nestedValues, M as readManifest, N as workspaceDependencies, O as publishedWorkspaces, S as literalOf, T as stringsIn, a as workspaceDirectories, b as childrenOf$2, c as RUN_TASKS, d as hasVerifyTask, j as dependencyEntries, k as publicEntriesOf, 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-BPoE5oW1.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$4, 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-B5ilWPaY.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$15 = "/";
|
|
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$15}`))
|
|
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$15}${entry}`));
|
|
370
370
|
});
|
|
371
371
|
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
372
372
|
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
@@ -412,11 +412,11 @@ const positionOf = (source) => (index) => {
|
|
|
412
412
|
};
|
|
413
413
|
};
|
|
414
414
|
// src/features/install-size/model/import-graph.ts
|
|
415
|
-
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
415
|
+
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$14 = "/";
|
|
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$14);
|
|
432
|
+
if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$14));
|
|
433
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$14));
|
|
434
434
|
};
|
|
435
435
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
436
436
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -462,13 +462,13 @@ const existingSource = Effect.fn("existingSource")(function* existingSource(base
|
|
|
462
462
|
});
|
|
463
463
|
const localFile = Effect.fn("localFile")(function* localFile({ directory, imports }, from, specifier) {
|
|
464
464
|
const files = yield* RepositoryFiles;
|
|
465
|
-
if (RELATIVE.test(specifier)) return yield* existingSource(files.resolve(files.dirname(from), specifier));
|
|
465
|
+
if (RELATIVE$1.test(specifier)) return yield* existingSource(files.resolve(files.dirname(from), specifier));
|
|
466
466
|
const target = subpathTarget(imports, specifier);
|
|
467
467
|
if (Option.isNone(target)) return Option.none();
|
|
468
468
|
return yield* existingSource(files.resolve(directory, target.value));
|
|
469
469
|
});
|
|
470
470
|
const referenceOf$1 = (graph, from, specifier) => {
|
|
471
|
-
if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
|
|
471
|
+
if (RELATIVE$1.test(specifier) || String$1.startsWith(SUBPATH_IMPORT)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
|
|
472
472
|
const name = packageNameOf(specifier);
|
|
473
473
|
return Effect.succeedSome(Result.fail(name));
|
|
474
474
|
};
|
|
@@ -1037,20 +1037,35 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
1037
1037
|
// src/features/overrides/model/git-subpath.ts
|
|
1038
1038
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
1039
1039
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
1040
|
-
const RULE$
|
|
1041
|
-
const WHOLE_MATCH$
|
|
1040
|
+
const RULE$28 = "git-subpath-dependency";
|
|
1041
|
+
const WHOLE_MATCH$3 = 0;
|
|
1042
1042
|
const problemAt$3 = ({ file }, source) => (found) => ({
|
|
1043
1043
|
file,
|
|
1044
|
-
...positionOf(source)(found.index ?? WHOLE_MATCH$
|
|
1045
|
-
rule: RULE$
|
|
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$
|
|
1044
|
+
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
1045
|
+
rule: RULE$28,
|
|
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$
|
|
1048
|
+
const problemsIn$12 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$3(entry, source)));
|
|
1049
1049
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
1050
1050
|
/** @internal */
|
|
1051
1051
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
1052
1052
|
const listed = yield* listedFiles(root);
|
|
1053
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
1053
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$12);
|
|
1054
|
+
});
|
|
1055
|
+
// src/features/overrides/model/restricted-rules.ts
|
|
1056
|
+
const RULE$27 = "unnamed-restriction";
|
|
1057
|
+
const WHOLE_MATCH$2 = 0;
|
|
1058
|
+
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
1059
|
+
const problemsIn$11 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
1060
|
+
file: entry.file,
|
|
1061
|
+
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
1062
|
+
rule: RULE$27,
|
|
1063
|
+
message: `${found[WHOLE_MATCH$2]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
1064
|
+
})));
|
|
1065
|
+
/** @internal */
|
|
1066
|
+
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
1067
|
+
const listed = yield* listedFiles(root);
|
|
1068
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$11);
|
|
1054
1069
|
});
|
|
1055
1070
|
// src/shared/lib/agent-docs.ts
|
|
1056
1071
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
@@ -1093,7 +1108,9 @@ const SPECIFIER_GROUP = "specifier";
|
|
|
1093
1108
|
const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
|
|
1094
1109
|
const TEST_FILE = /\.test\.[cm]?[jt]sx?$/u;
|
|
1095
1110
|
const MANIFEST_NAME = /package\.json$/u;
|
|
1096
|
-
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests
|
|
1111
|
+
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
|
|
1112
|
+
const SPEC_DIRECTORY = /(?:^|\/)specs?\//u;
|
|
1113
|
+
const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
1097
1114
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
1098
1115
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
1099
1116
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
@@ -1148,8 +1165,9 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
1148
1165
|
if (Option.isNone(source)) return true;
|
|
1149
1166
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
1150
1167
|
});
|
|
1168
|
+
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
1151
1169
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
1152
|
-
if (
|
|
1170
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$4(test, DIRECTORY_MESSAGE));
|
|
1153
1171
|
if (!TEST_FILE.test(test.name)) return Option.none();
|
|
1154
1172
|
if (yield* refersIn(context, test)) return Option.none();
|
|
1155
1173
|
return Option.some(problemFor$4(test, SIBLING_MESSAGE));
|
|
@@ -1177,10 +1195,10 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
1177
1195
|
});
|
|
1178
1196
|
// src/features/placement/model/dangling-links.ts
|
|
1179
1197
|
const RULE$24 = "dangling-link";
|
|
1180
|
-
const SEPARATOR$
|
|
1198
|
+
const SEPARATOR$13 = "/";
|
|
1181
1199
|
const FIRST$11 = 1;
|
|
1182
1200
|
const READ_CONCURRENCY$16 = 16;
|
|
1183
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
1201
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$13}`)(name);
|
|
1184
1202
|
/** @internal */
|
|
1185
1203
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
1186
1204
|
const files = yield* RepositoryFiles;
|
|
@@ -1202,7 +1220,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
1202
1220
|
// src/features/placement/model/nested-docs.ts
|
|
1203
1221
|
const RULE$23 = "nested-docs";
|
|
1204
1222
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1205
|
-
const SEPARATOR$
|
|
1223
|
+
const SEPARATOR$12 = "/";
|
|
1206
1224
|
const FIRST$10 = 1;
|
|
1207
1225
|
const READ_CONCURRENCY$15 = 64;
|
|
1208
1226
|
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
@@ -1211,7 +1229,7 @@ const README = /^README(?:\.[^/]+)?$/iu;
|
|
|
1211
1229
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1212
1230
|
const taggedError$3 = Schema.TaggedError;
|
|
1213
1231
|
var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1214
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1232
|
+
const isNested = (name) => String$1.includes(SEPARATOR$12)(name);
|
|
1215
1233
|
const problemFor$3 = (file, message) => ({
|
|
1216
1234
|
file,
|
|
1217
1235
|
line: FIRST$10,
|
|
@@ -1267,12 +1285,12 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1267
1285
|
});
|
|
1268
1286
|
// src/features/placement/model/root-docs.ts
|
|
1269
1287
|
const RULE$22 = "root-docs";
|
|
1270
|
-
const SEPARATOR$
|
|
1288
|
+
const SEPARATOR$11 = "/";
|
|
1271
1289
|
const FIRST$9 = 1;
|
|
1272
1290
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1273
1291
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1274
1292
|
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.";
|
|
1275
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
1293
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$11)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1276
1294
|
/** @internal */
|
|
1277
1295
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1278
1296
|
const files = yield* RepositoryFiles;
|
|
@@ -1291,11 +1309,47 @@ const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
|
1291
1309
|
const READ_CONCURRENCY$14 = 16;
|
|
1292
1310
|
const START$12 = 0;
|
|
1293
1311
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1312
|
+
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
1313
|
+
const RELATIVE = /^\.\//u;
|
|
1314
|
+
const SEPARATOR$10 = "/";
|
|
1315
|
+
const MarketplacePlugin = Schema.Struct({
|
|
1316
|
+
name: Schema.optional(Schema.String),
|
|
1317
|
+
source: Schema.Unknown
|
|
1318
|
+
});
|
|
1319
|
+
const Marketplace = Schema.fromJsonString(Schema.Struct({ plugins: Schema.Array(MarketplacePlugin) }));
|
|
1320
|
+
const NO_PLUGINS = {
|
|
1321
|
+
directories: [],
|
|
1322
|
+
names: []
|
|
1323
|
+
};
|
|
1294
1324
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1295
1325
|
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.`;
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1326
|
+
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$10)(directory), Array.last, Option.getOrElse(() => directory));
|
|
1327
|
+
const pluginsOf = (plugins) => {
|
|
1328
|
+
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE, "")));
|
|
1329
|
+
const segments = pipe(directories, Array.map(lastSegment));
|
|
1330
|
+
return {
|
|
1331
|
+
directories,
|
|
1332
|
+
names: pipe(plugins, Array.map(({ name }) => name), Array.filter(Predicate.isString), Array.appendAll(segments), Array.dedupe)
|
|
1333
|
+
};
|
|
1334
|
+
};
|
|
1335
|
+
const marketplacePlugins = Effect.fn("marketplacePlugins")(function* marketplacePlugins(root) {
|
|
1336
|
+
const files = yield* RepositoryFiles;
|
|
1337
|
+
const text = yield* files.readFile(files.join(root, MARKETPLACE));
|
|
1338
|
+
return pipe(text, Option.flatMap(Schema.decodeOption(Marketplace)), Option.map(({ plugins }) => pluginsOf(plugins)), Option.getOrElse(() => NO_PLUGINS));
|
|
1339
|
+
});
|
|
1340
|
+
const isPluginName = (plugins) => (name) => Array.contains(plugins.names, name);
|
|
1341
|
+
const ownNames = (plugins, names) => {
|
|
1342
|
+
const ownName = Predicate.not(isPluginName(plugins));
|
|
1343
|
+
return pipe(names, Array.filter(ownName));
|
|
1344
|
+
};
|
|
1345
|
+
const patternFor = (plugins) => ({ directory, names }) => patternOf(Option.match(Array.findFirst(plugins.directories, (plugin) => plugin === directory), {
|
|
1346
|
+
onNone: () => ownNames(plugins, names),
|
|
1347
|
+
onSome: () => [directory]
|
|
1348
|
+
}));
|
|
1349
|
+
const problemsIn$10 = (file, source, plugins) => (workspace) => {
|
|
1350
|
+
const message = messageFor(workspace.directory);
|
|
1298
1351
|
const at = positionOf(source);
|
|
1352
|
+
const pattern = patternFor(plugins)(workspace);
|
|
1299
1353
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
1300
1354
|
file,
|
|
1301
1355
|
...at(found.index ?? START$12),
|
|
@@ -1303,11 +1357,11 @@ const problemsIn$10 = (file, source) => ({ directory, pattern }) => {
|
|
|
1303
1357
|
message
|
|
1304
1358
|
})));
|
|
1305
1359
|
};
|
|
1306
|
-
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces) {
|
|
1360
|
+
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1307
1361
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1308
1362
|
return pipe(text, Option.match({
|
|
1309
1363
|
onNone: () => [],
|
|
1310
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$10(file, source)))
|
|
1364
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$10(file, source, plugins)))
|
|
1311
1365
|
}));
|
|
1312
1366
|
});
|
|
1313
1367
|
/** @internal */
|
|
@@ -1317,7 +1371,8 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1317
1371
|
const readmes = pipe(names, Array.filter((name) => ROOT_DOC.test(name)));
|
|
1318
1372
|
const named = yield* namedWorkspaces(root);
|
|
1319
1373
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1320
|
-
const
|
|
1374
|
+
const plugins = yield* marketplacePlugins(root);
|
|
1375
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$14 });
|
|
1321
1376
|
return Array.flatten(found);
|
|
1322
1377
|
});
|
|
1323
1378
|
// src/features/placement/model/placement-checks.ts
|
|
@@ -1909,7 +1964,7 @@ const pathFiltersIn = (file, source) => {
|
|
|
1909
1964
|
source
|
|
1910
1965
|
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
1911
1966
|
};
|
|
1912
|
-
const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({
|
|
1967
|
+
const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ names }) => Array.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf(names))(text))), Option.map(({ directory }) => directory));
|
|
1913
1968
|
const named = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
1914
1969
|
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$4}`)(path)), Option.map(({ directory }) => directory));
|
|
1915
1970
|
const namesIn = (name, source) => {
|
|
@@ -3168,7 +3223,8 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
3168
3223
|
checkVitePlus(root),
|
|
3169
3224
|
checkMissingHooks(root),
|
|
3170
3225
|
checkScripts(root),
|
|
3171
|
-
checkWorkflowQueues(root)
|
|
3226
|
+
checkWorkflowQueues(root),
|
|
3227
|
+
checkRestrictedRules(root)
|
|
3172
3228
|
], { concurrency: "unbounded" });
|
|
3173
3229
|
return Array.flatten(found);
|
|
3174
3230
|
});
|
|
@@ -3573,7 +3629,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
3573
3629
|
return Array.flatten(found);
|
|
3574
3630
|
});
|
|
3575
3631
|
// src/features/invisible-characters/model/hidden-unicode.ts
|
|
3576
|
-
const HIDDEN = /[\u00AD\u180E\u200B
|
|
3632
|
+
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
3577
3633
|
const NUL = "\0";
|
|
3578
3634
|
const START$5 = 0;
|
|
3579
3635
|
const HEX = 16;
|