@r_masseater/msch 0.20.0 → 0.21.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.
@@ -67,6 +67,8 @@ const RuleNameSchema = Schema.Literals([
67
67
  "hidden-unicode",
68
68
  "python-file",
69
69
  "python-command",
70
+ "docker-file",
71
+ "docker-command",
70
72
  "unneeded-file",
71
73
  "unneeded-setup",
72
74
  "cargo-outside-pnpm",
@@ -142,4 +144,4 @@ const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${St
142
144
  const JSON_FLAG = "--json";
143
145
  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, lineOf as _, problemAt as a, isStringLiteral as at, resolvedSymbol as b, childrenOf as c, isTypeReferenceNode as ct, declarationsOf as d, isVariableDeclarationList as dt, isReturnStatement as et, descendantsOf as f, isVariableStatement as ft, isTypeDeclaration as g, isGenericDeclaration as h, formatProblem as i, isSpreadElement as it, getTextOfJSDocComment as j, getLeadingCommentRanges as k, columnOf as l, isUnionTypeNode as lt, isExternalDeclaration as m, ProblemList as n, isSignatureDeclaration as nt, sortProblems as o, isTypeAliasDeclaration as ot, importedModulesOf as p, isModuleDeclaration as q, describeFinding as r, isSourceFile as rt, NODE_MODULES_SEGMENT as s, isTypeLiteralNode as st, JSON_FLAG as t, isSatisfiesExpression as tt, contains as u, isVariableDeclaration as ut, propertyNamesOf as v, IndexKind as w, symbolAt as x, referencedSymbols as y, isEnumDeclaration as z };
144
146
 
145
- //# sourceMappingURL=cli-contract-DZEnO-xY.mjs.map
147
+ //# sourceMappingURL=cli-contract-Dia53DiS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-contract-Dia53DiS.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 isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\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\nexport const 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\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 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 isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\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 \"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 \"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\";\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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;;ACpH1G,MAAa,YAAY"}
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { A as dependencyEntries, C as propertyValue, D as publishedWorkspaces, M as workspaceDependencies, O as publicEntriesOf, S as nestedValues, _ as workspaceConfigOf, a as runTasksOf, b as keyName, c as VERIFY_TASK, i as workspaceDirectories, j as readManifest, k as MANIFEST_FILE, l as definesTask, s as RUN_TASKS, t as namedWorkspaces, u as hasVerifyTask, v as KeySchema, w as stringsIn, x as literalOf, y as childrenOf$2 } from "./workspace-CMPDXFWk.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 lineOf, a as problemAt$2, at as isStringLiteral, b as resolvedSymbol, c as childrenOf$3, ct as isTypeReferenceNode, d as declarationsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as descendantsOf, ft as isVariableStatement, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as columnOf, lt as isUnionTypeNode, m as isExternalDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as importedModulesOf, q as isModuleDeclaration, rt as isSourceFile, s as NODE_MODULES_SEGMENT, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as contains, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-DZEnO-xY.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 lineOf, a as problemAt$2, at as isStringLiteral, b as resolvedSymbol, c as childrenOf$3, ct as isTypeReferenceNode, d as declarationsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as descendantsOf, ft as isVariableStatement, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as columnOf, lt as isUnionTypeNode, m as isExternalDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as importedModulesOf, q as isModuleDeclaration, rt as isSourceFile, s as NODE_MODULES_SEGMENT, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as contains, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-Dia53DiS.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 { Array, Cause, Effect, FileSystem, Function, HashMap, HashSet, Layer, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
@@ -3127,6 +3127,112 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
3127
3127
  ], { concurrency: "unbounded" });
3128
3128
  return Array.flatten(found);
3129
3129
  });
3130
+ // src/shared/lib/scanned-files.ts
3131
+ const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
3132
+ const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
3133
+ const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
3134
+ const READ_CONCURRENCY$3 = 64;
3135
+ const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
3136
+ const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
3137
+ /** @internal */
3138
+ const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
3139
+ const files = yield* RepositoryFiles;
3140
+ const names = yield* files.listedFiles(root);
3141
+ return pipe(names, Array.map((name) => ({
3142
+ name,
3143
+ file: files.join(root, name)
3144
+ })));
3145
+ });
3146
+ /** @internal */
3147
+ const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
3148
+ const files = yield* RepositoryFiles;
3149
+ return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
3150
+ });
3151
+ /** @internal */
3152
+ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
3153
+ const files = yield* RepositoryFiles;
3154
+ const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
3155
+ onNone: () => [],
3156
+ onSome: (source) => problemsIn(entry, source)
3157
+ }))), { concurrency: READ_CONCURRENCY$3 });
3158
+ return Array.flatten(found);
3159
+ });
3160
+ // src/features/banned-tools/model/banned-tool.ts
3161
+ const FIRST_LINE$2 = 1;
3162
+ const FIRST_COLUMN$2 = 1;
3163
+ const WHOLE_MATCH$1 = 0;
3164
+ const fileProblem = (tool) => (entry) => ({
3165
+ file: entry.file,
3166
+ line: FIRST_LINE$2,
3167
+ column: FIRST_COLUMN$2,
3168
+ rule: tool.fileRule,
3169
+ message: tool.fileMessage(entry)
3170
+ });
3171
+ const commandProblem = (tool, entry, source) => (found) => ({
3172
+ file: entry.file,
3173
+ ...positionOf(source)(found.index ?? WHOLE_MATCH$1),
3174
+ rule: tool.commandRule,
3175
+ message: tool.commandMessage(String$1.trim(found[WHOLE_MATCH$1]))
3176
+ });
3177
+ const commandProblems = (tool) => (entry, source) => pipe(tool.patternsFor(entry), Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map(commandProblem(tool, entry, source)));
3178
+ /** @internal */
3179
+ const checkBannedTool = Effect.fn("checkBannedTool")(function* checkBannedTool(root, tool) {
3180
+ const listed = yield* listedFiles(root);
3181
+ const isScanned = (entry) => !tool.isFile(entry) && isScannedText(entry);
3182
+ const scanned = yield* scanText(pipe(listed, Array.filter(isScanned)), commandProblems(tool));
3183
+ const present = yield* presentFiles(pipe(listed, Array.filter(tool.isFile)));
3184
+ return [...pipe(present, Array.map(fileProblem(tool))), ...scanned];
3185
+ });
3186
+ // src/features/banned-tools/model/docker.ts
3187
+ const RENAMES = [
3188
+ [/(?:^|\/)Dockerfile(?:\.[^/]+)?$|\.dockerfile$/iu, "Containerfile"],
3189
+ [/(?:^|\/)(?:[^/]+)?\.dockerignore$/u, ".containerignore"],
3190
+ [/(?:^|\/)docker-compose(?:\.[^/]+)?\.ya?ml$/u, "compose.yaml"]
3191
+ ];
3192
+ const COMMAND_PATTERNS$1 = [
3193
+ /(?<![\w./@-])docker[ \t]+(?:build|buildx|compose|run|push|pull|login|logout|exec|tag|image|images|ps|rm|rmi|stop|start|kill|save|load|create|cp|inspect|logs|network|volume|system|manifest|context|container)\b/gu,
3194
+ /(?<![\w./@-])docker-compose[ \t]+(?:up|down|build|run|exec|pull|push|ps|logs|stop|start|restart|config)\b/gu,
3195
+ /(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make|\$)\(\s*)["'`]docker(?:-compose)?["'`]/gu,
3196
+ /\buses:\s*["']?docker(?:\/[\w.-]+|:\/\/)/gu
3197
+ ];
3198
+ const renameOf = ({ name }) => pipe(RENAMES, Array.findFirst(([pattern]) => pattern.test(name)), Option.map(([, renamed]) => renamed));
3199
+ const DOCKER = {
3200
+ fileRule: "docker-file",
3201
+ commandRule: "docker-command",
3202
+ isFile: (entry) => Option.isSome(renameOf(entry)),
3203
+ patternsFor: () => COMMAND_PATTERNS$1,
3204
+ fileMessage: (entry) => `Docker is not used in this repository: podman builds and runs containers. Name this file ${Option.getOrElse(renameOf(entry), () => "for podman")}, the name podman reads.`,
3205
+ commandMessage: (command) => `Docker is not used in this repository. Replace \`${command}\` with podman, which takes the same arguments.`
3206
+ };
3207
+ /** @internal */
3208
+ const checkDocker = (root) => checkBannedTool(root, DOCKER);
3209
+ // src/features/banned-tools/model/python.ts
3210
+ const PYTHON_FILE = /(?:\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\/)(?:pyproject\.toml|uv\.lock|uv\.toml|poetry\.lock|Pipfile|Pipfile\.lock|setup\.cfg|tox\.ini|pytest\.ini|\.python-version|requirements[^/]*\.txt))$/u;
3211
+ const COMMAND_PATTERNS = [
3212
+ /(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
3213
+ /(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
3214
+ /(?<![\w./@-])pipx[ \t]+(?:run|install|inject|upgrade)\b/gu,
3215
+ /(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
3216
+ /(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
3217
+ /(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
3218
+ /(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make|\$)\(\s*)["'`](?:python[\d.]*|pip3?|pipx|uvx?|poetry)["'`]/gu,
3219
+ /\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
3220
+ ];
3221
+ const TOOL_PATTERNS$1 = [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
3222
+ const patternsFor = (entry) => {
3223
+ if (isToolVersions(entry)) return [...COMMAND_PATTERNS, ...TOOL_PATTERNS$1];
3224
+ return COMMAND_PATTERNS;
3225
+ };
3226
+ const PYTHON = {
3227
+ fileRule: "python-file",
3228
+ commandRule: "python-command",
3229
+ isFile: ({ name }) => PYTHON_FILE.test(name),
3230
+ patternsFor,
3231
+ fileMessage: () => "Python is not used in this repository. Replace this file with TypeScript or Rust.",
3232
+ commandMessage: (command) => `Python is not used in this repository. Remove \`${command}\` and do the work in TypeScript or Rust.`
3233
+ };
3234
+ /** @internal */
3235
+ const checkPython = (root) => checkBannedTool(root, PYTHON);
3130
3236
  // src/features/comments/model/found-comment.ts
3131
3237
  const taggedError$2 = Schema.TaggedError;
3132
3238
  var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
@@ -3319,10 +3425,10 @@ const commentsWith = (grammars) => (reader, source) => {
3319
3425
  const RULE$6 = "comment";
3320
3426
  const CONFIG_FILE = "vite.config.ts";
3321
3427
  const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
3322
- const READ_CONCURRENCY$3 = 64;
3428
+ const READ_CONCURRENCY$2 = 64;
3323
3429
  const START$6 = 0;
3324
- const FIRST_LINE$2 = 1;
3325
- const FIRST_COLUMN$2 = 1;
3430
+ const FIRST_LINE$1 = 1;
3431
+ const FIRST_COLUMN$1 = 1;
3326
3432
  const READERS = [
3327
3433
  [/\.(?:[cm]?jsx?)$/u, "javascript"],
3328
3434
  [/\.(?:[cm]?ts)$/u, "typescript"],
@@ -3391,8 +3497,8 @@ const problemOf$2 = (file, source) => ({ index }) => ({
3391
3497
  });
3392
3498
  const unreadableProblem = (file, message) => ({
3393
3499
  file,
3394
- line: FIRST_LINE$2,
3395
- column: FIRST_COLUMN$2,
3500
+ line: FIRST_LINE$1,
3501
+ column: FIRST_COLUMN$1,
3396
3502
  rule: RULE$6,
3397
3503
  message: `msch could not read the comments in this file: ${message}`
3398
3504
  });
@@ -3448,7 +3554,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
3448
3554
  const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
3449
3555
  onNone: () => Effect.succeed(NONE),
3450
3556
  onSome: (source) => problemsIn(entry, source)
3451
- }))), { concurrency: READ_CONCURRENCY$3 });
3557
+ }))), { concurrency: READ_CONCURRENCY$2 });
3452
3558
  return Array.flatten(found);
3453
3559
  });
3454
3560
  // src/features/invisible-characters/model/hidden-unicode.ts
@@ -3457,7 +3563,7 @@ const NUL = "\0";
3457
3563
  const START$5 = 0;
3458
3564
  const HEX = 16;
3459
3565
  const CODE_POINT_WIDTH = 4;
3460
- const READ_CONCURRENCY$2 = 64;
3566
+ const READ_CONCURRENCY$1 = 64;
3461
3567
  const RULE$5 = "hidden-unicode";
3462
3568
  const hexOf = (character) => pipe(String$1.codePointAt(START$5)(character), Option.getOrElse(() => START$5), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
3463
3569
  const problemOf$1 = (file, source) => (found) => {
@@ -3483,91 +3589,16 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
3483
3589
  onNone: () => [],
3484
3590
  onSome: (source) => problemsIn$3(file, source)
3485
3591
  })));
3486
- }, { concurrency: READ_CONCURRENCY$2 });
3487
- return Array.flatten(found);
3488
- });
3489
- // src/shared/lib/scanned-files.ts
3490
- const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:Dockerfile[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
3491
- const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
3492
- const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
3493
- const READ_CONCURRENCY$1 = 64;
3494
- const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
3495
- const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
3496
- /** @internal */
3497
- const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
3498
- const files = yield* RepositoryFiles;
3499
- const names = yield* files.listedFiles(root);
3500
- return pipe(names, Array.map((name) => ({
3501
- name,
3502
- file: files.join(root, name)
3503
- })));
3504
- });
3505
- /** @internal */
3506
- const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
3507
- const files = yield* RepositoryFiles;
3508
- return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
3509
- });
3510
- /** @internal */
3511
- const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
3512
- const files = yield* RepositoryFiles;
3513
- const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
3514
- onNone: () => [],
3515
- onSome: (source) => problemsIn(entry, source)
3516
- }))), { concurrency: READ_CONCURRENCY$1 });
3592
+ }, { concurrency: READ_CONCURRENCY$1 });
3517
3593
  return Array.flatten(found);
3518
3594
  });
3519
- // src/features/python/model/python.ts
3520
- const PYTHON_FILE = /(?:\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\/)(?:pyproject\.toml|uv\.lock|uv\.toml|poetry\.lock|Pipfile|Pipfile\.lock|setup\.cfg|tox\.ini|pytest\.ini|\.python-version|requirements[^/]*\.txt))$/u;
3521
- const COMMAND_PATTERNS = [
3522
- /(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
3523
- /(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
3524
- /(?<![\w./@-])pipx[ \t]+(?:run|install|inject|upgrade)\b/gu,
3525
- /(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
3526
- /(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
3527
- /(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
3528
- /(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make|\$)\(\s*)["'`](?:python[\d.]*|pip3?|pipx|uvx?|poetry)["'`]/gu,
3529
- /\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
3530
- ];
3531
- const TOOL_PATTERNS$1 = [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
3532
- const FIRST_LINE$1 = 1;
3533
- const FIRST_COLUMN$1 = 1;
3534
- const WHOLE_MATCH$1 = 0;
3535
- const FILE_RULE$1 = "python-file";
3536
- const COMMAND_RULE = "python-command";
3537
- const fileProblem = ({ file }) => ({
3538
- file,
3539
- line: FIRST_LINE$1,
3540
- column: FIRST_COLUMN$1,
3541
- rule: FILE_RULE$1,
3542
- message: "Python is not used in this repository. Replace this file with TypeScript or Rust."
3543
- });
3544
- const patternsFor = (entry) => {
3545
- if (isToolVersions(entry)) return [...COMMAND_PATTERNS, ...TOOL_PATTERNS$1];
3546
- return COMMAND_PATTERNS;
3547
- };
3548
- const commandProblem = ({ file }, source) => (found) => ({
3549
- file,
3550
- ...positionOf(source)(found.index ?? WHOLE_MATCH$1),
3551
- rule: COMMAND_RULE,
3552
- message: `Python is not used in this repository. Remove \`${String$1.trim(found[WHOLE_MATCH$1])}\` and do the work in TypeScript or Rust.`
3553
- });
3554
- const commandProblems = (entry, source) => pipe(patternsFor(entry), Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map(commandProblem(entry, source)));
3555
- const isPython = ({ name }) => PYTHON_FILE.test(name);
3556
- const isScanned = (entry) => !isPython(entry) && isScannedText(entry);
3557
- /** @internal */
3558
- const checkPython = Effect.fn("checkPython")(function* checkPython(root) {
3559
- const listed = yield* listedFiles(root);
3560
- const scanned = yield* scanText(pipe(listed, Array.filter(isScanned)), commandProblems);
3561
- const present = yield* presentFiles(pipe(listed, Array.filter(isPython)));
3562
- return [...pipe(present, Array.map(fileProblem)), ...scanned];
3563
- });
3564
3595
  // src/features/runtime-version/model/node-version.ts
3565
3596
  const RULE$4 = "node-version";
3566
3597
  const MINIMUM = 26;
3567
3598
  const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
3568
3599
  const MANIFEST = /(?:^|\/)package\.json$/u;
3569
3600
  const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
3570
- const DOCKERFILE = /(?:^|\/)Dockerfile[^/]*$/u;
3601
+ const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
3571
3602
  const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
3572
3603
  const PINNED_VERSION = /^\s*v?(?<major>\d+)/u;
3573
3604
  const BASE_IMAGE = /^FROM[ \t]+(?:--\S+[ \t]+)*(?:[\w.-]+(?::\d+)?\/)*node:(?<major>\d+)/gimu;
@@ -4052,6 +4083,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
4052
4083
  const found = yield* Effect.all([
4053
4084
  checkHiddenUnicode(root),
4054
4085
  checkPython(root),
4086
+ checkDocker(root),
4055
4087
  checkUnneededFiles(root),
4056
4088
  checkReplacedTools(root),
4057
4089
  checkAlchemyPatch(root),