@r_masseater/msch 0.69.0 → 0.70.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["Arr","ALTERNATIVE","SCOPE","SPECIAL","patternOf","Arr","Str","SEPARATOR","SUCCESS","crateOf","Arr","Str","Arr","Arr","Str","Bool","NO_PROBLEMS","keyOf","Arr","Arr","Rec","Str","QUOTES","WORKSPACE_FILE","SUCCEEDED","taggedError","Str","Arr","problemsFor","LOCKFILE","READ_CONCURRENCY","Arr","RULE","WHOLE_MATCH","problemAt","Str","problemsIn","Arr","RULE","WHOLE_MATCH","problemsIn","Arr","Str","RULE","WHOLE_MATCH","problemsIn","Arr","Str","RULE","WORKSPACE_FILE","START","Str","Arr","EXCLUDED","isPublished","MANIFEST_FILE","Arr","RULE","ROOT","NEGATION","COMMENT","FIRST","READ_CONCURRENCY","Str","entryOf","Arr","entriesIn","MANIFEST_FILE","RULE","FIRST","READ_CONCURRENCY","SCRIPT","TEST_FILE","EXCLUDED","Manifest","decodeManifest","byLength","problemFor","groupsOf","Arr","Str","ownerOf","MANIFEST_FILE","problemIn","READ_CONCURRENCY","Arr","FIRST","RULE","Str","problemFor","RULE","FIRST","READ_CONCURRENCY","MESSAGE","Arr","RULE","SEPARATOR","FIRST","READ_CONCURRENCY","Str","Arr","ROOT_WORKSPACE","FIRST","SEPARATOR","EXCLUDED","Arr","byLength","fileProblem","ownerOf","Str","fileProblem","RULE","ROOT_DIRECTORY","READ_CONCURRENCY","MISSING_MESSAGE","decodeKey","Arr","childrenOf","problemIn","fileProblem","RULE","CONFIG_FILE","SEPARATOR","READ_CONCURRENCY","AGENT_DOCS","MANIFEST","RootConfig","taggedError","Str","problemFor","MISSING_MESSAGE","Arr","problemIn","RULE","READ_CONCURRENCY","MESSAGE","problemIn","Arr","RULE","MANIFEST_FILE","TEST_FILE","MESSAGE","Arr","Str","problemFor","RULE","SEPARATOR","FIRST","MARKDOWN","MESSAGE","Str","Arr","RULE","READ_CONCURRENCY","START","MARKETPLACE","RELATIVE","Marketplace","messageFor","Arr","Str","patternOf","problemsIn","Arr","RULE","READ_CONCURRENCY","Str","Arr","ownerOf","problemFor","problemIn","RULE","FIRST","MESSAGE","Arr","ENTRY_RULE","ENTRY_MESSAGE","entryProblems","MANIFEST_FILE","Arr","problemAt","SEPARATOR","NEXT","MANIFEST","SOURCE_PREFIX","Arr","Str","kindOf","NEXT","Arr","SLICE_RULE","ENTRY_RULE","SEPARATOR","NEXT","WORD_SEPARATOR","FEATURES","SOURCE","SCRIPT","englishVerbs","SLICE_MESSAGE","ENTRY_MESSAGE","Str","Arr","misnamedSlice","ownerOf","fileProblem","ENTRY_RULE","READ_CONCURRENCY","EXCLUDED","NONE","Arr","entryProblems","fileProblem","problemsOf","kindOf","RULE","FIRST","problemOf","Arr","Manifest","decodeManifest","Rec","Arr","MANIFEST_FILE","Arr","WORKFLOW_DIRECTORY","SEPARATOR","READ_CONCURRENCY","FIRST","COMMAND","Manifest","decodeManifest","Str","Arr","Rec","entriesOf","MANIFEST_FILE","isCommand","problemsIn","START","Arr","Str","quoted","START","WILDCARD","decodeStrings","Arr","Rec","Str","WILDCARD","SEPARATOR","FIRST","Arr","Str","WRAP_OFFSET","WILDCARD","SEPARATOR","RELATIVE","childrenOf","Arr","Str","listed","RULE","WORKSPACE_FILE","READ_CONCURRENCY","isMissing","Arr","Str","problemOf","problemsIn","RULE","MANIFEST_FILE","CARGO_FILE","CONFIG_FILE","SEPARATOR","FIRST","READ_CONCURRENCY","problemFor","problemIn","Arr","Str","RULE","FALLOW_CONFIG","WRAP_OFFSET","READ_CONCURRENCY","MESSAGE","decodeKey","Arr","childrenOf","Str","problemsIn","RULE","WILDCARD","SEPARATOR","READ_CONCURRENCY","Arr","childrenOf","Str","problemsIn","RULE","CONFIG_FILE","FIRST","NEXT","Str","Arr","problemsIn","RULE","CONFIG_FILE","FIRST","READ_CONCURRENCY","problemIn","Arr","RULE","READ_CONCURRENCY","commandText","Arr","Str","problemsOf","Rec","RULE","READ_CONCURRENCY","Arr","problemsOf","Arr","isText","offsetOf","entriesOf","Arr","ROOT","LOCAL","SEPARATOR","LINE","FILTER_KEYS","QUOTED","Arr","Str","directoryOf","linesOf","entriesOf","RULE","READ_CONCURRENCY","SEPARATOR","Str","Arr","isMissing","problemOf","problemsIn","START","READ_CONCURRENCY","SEPARATOR","keysOf","Arr","problemAt","entriesOf","Str","patternOf","named","namesIn","Arr","Rec","SCOPE","SEPARATOR","Str","Arr","SUBPATH_IMPORT","WILDCARD","Arr","Rec","Str","referenceOf","referencesIn","MANIFEST_FILE","EMPTY","PeerMeta","decodeManifest","Rec","Arr","MANIFEST_FILE","Num","Str","DEPENDENCIES_KEY","START","Arr","listed","Str","Num","Rec","problemsOf","workspaceProblems","MANIFEST_FILE","Str","Arr","taggedError","Str","Arr","Rec","Manifest","Arr","Rec","manifestOf","sourcesOf","declaredBy","RULE","START","Arr","Str","problemFor","RULE","BUNDLE_CONCURRENCY","START","FIRST","Arr","messageOf","keyIndex","Str","RULE","CODE","READ_CONCURRENCY","messageOf","problemsIn","Arr","problemAt","Arr","BUNDLE_CONCURRENCY","Arr","declaredBy","bundleProblem","MANIFEST_FILE","manifestOf","RULE","FIRST","parse","Arr","lineOf","Str","messageOf","RULE","problemFor","problemOf","Arr","Arr","Arr","Arr","Str","packageOf","specifierOf","Arr","RULE","Arr","problemOf","Arr","problemIn","lineOf","Arr","Str","problemAt","ownerOf","lineOf","Arr","packageOf","Arr","Arr","problemAt","Arr","childrenOf","Arr","problemAt","Arr","Arr","Str","lineOf","canDerive","Arr","Rec","Arr","Rec","problemOf","EXTENSION","SEPARATOR","ROOT","Str","Arr","Rec","problemOf","Arr","Rec","problemOf","Arr","MANIFEST","SEPARATOR","decodeManifest","Str","Arr","directoriesOf","mentions","Arr","scopeOf","RULE","messageOf","Arr","problemOf","problemAt","RULE","Arr","problemOf","problemAt","RULE","SETTINGS_FILE","GITHUB","Source","Plugins","SettingsSchema","decodeSettings","marketplace.name","marketplace.plugins","Arr","problem","Rec","RULE","SETTINGS_FILE","READ_CONCURRENCY","START","referenceOf","referencesIn","Arr","Str","problemsIn","RULE","SEPARATOR","TASK_SEPARATOR","LOCAL_PREFIX","ONE","START","Str","Arr","ancestorsOf","Rec","problemsIn","RULE","FIRST_COLUMN","Arr","taggedError","CONFIG_FILE","FIRST","Arr","READ_CONCURRENCY","RULE","MESSAGE","Arr","Str","READ_CONCURRENCY","Arr","START","QUOTED","RULE","MESSAGE","Str","Arr","problemsIn","Arr","SEPARATOR","BLANK","Str","Arr","GITHUB","INLINE_CODE","Arr","Str","commandProblems","Arr","Str","ROOT_DIRECTORY","EXCLUDED","MANIFEST_FILE","READ_CONCURRENCY","START","FIRST","decodeJson","offsetOf","Str","Rec","Arr","childrenOf","RULE","problemOf","Arr","RULE","Arr","MESSAGE","Str","commandProblems","Arr","RULE","MESSAGE","RULE","MESSAGE","Arr","RULE","FIRST","MESSAGE","Arr","RULE","MESSAGE","Arr","RULE","MESSAGE","Arr","Arr","taggedError","Str","Arr","NEXT","Arr","parseSql","Num","Str","START","Rec","Arr","Str","parseDocument","SHEBANG","READERS","Str","Arr","RULE","UNUSED_RULE","CONFIG_FILE","READ_CONCURRENCY","START","MESSAGE","taggedError","Str","Arr","problemOf","FIRST_LINE","FIRST_COLUMN","WHOLE_MATCH","Str","Arr","SPAWN_PATTERNS","COMMAND_PATTERNS","Arr","RULE","ROOT_DIRECTORY","PLUGIN_MANIFEST","MESSAGE","Arr","Str","problemsIn","offsetIn","MANIFEST_FILE","WORKSPACE_FILE","MANIFEST","FIRST_LINE","FIRST_COLUMN","READ_CONCURRENCY","decodeString","Rec","Arr","Str","referenceOf","decodeManifest","lineOf","problemAt","CONFIG_FILE","RENOVATE_FILE","PRESET","START","taggedError","problemAt","Str","Rec","Arr","RULE","SKILL_FILE","problemAt","Arr","Str","problemsIn","RULE","NAME_KEY","SEPARATOR","START","FIRST","READ_CONCURRENCY","offsetOf","Str","parse","Arr","rangeOf","linksIn","problemsIn","Rec","Arr","Str","parse","RULE","READ_CONCURRENCY","FIRST_LINE","Str","Arr","message","Rec","START","READ_CONCURRENCY","Arr","Str","problemsIn","RULE","FIRST_LINE","FIRST_COLUMN","READ_CONCURRENCY","Manifest","LAST_SEGMENT","directoryOf","Str","decodeManifest","Arr","floorOf","baseName","START","READ_CONCURRENCY","RULE","Str","problemsIn","Arr","SCOPE","RULE","WORKSPACE_FILE","SEPARATOR","Str","Arr","Rec","MANIFEST_FILE","problemAt","ownerOf","RULE","FIRST","problemFor","Arr","Arr","WORKSPACE_FILE","START","Str","Arr","RULE","EXCLUDED","START","Config","MESSAGE","problemsIn","Arr","Str","RULE","EXCLUDED","Str","Arr","offsetIn","quoted","manifestProblems","Rec","MANIFEST_FILE","RULE","START","READ_CONCURRENCY","EXCLUDED","Arr","Str","problemsIn","MANIFEST_FILE","RULE","Str","Arr","MANIFEST_FILE","RULE","ROOT_DIRECTORY","START","Str","Arr","RULE","START","Str","RULE","MANIFEST","START","Manifest","decodeManifest","Str","Arr","manifestProblems","problemsIn","MANIFEST_FILE","RULE","START","FIRST","Manifest","decodeManifest","Arr","Str","MANIFEST_FILE","RULE","Str","Arr","Rec","Arr","MANIFEST_FILE","Arr","Arr","Arr","Arr"],"sources":["../src/entities/workspace/model/run-tasks.ts","../src/entities/workspace/model/workspace-names.ts","../src/entities/workspace/model/cargo-crates.ts","../src/features/check-overrides/model/override-findings.ts","../src/entities/project/model/implementation.ts","../src/features/check-overrides/model/override-records.ts","../src/features/check-overrides/model/override-resolution.ts","../src/features/check-overrides/model/overrides.ts","../src/shared/lib/scanned-files.ts","../src/features/check-overrides/model/git-subpath.ts","../src/features/check-overrides/model/restricted-rules.ts","../src/features/check-overrides/model/type-exemptions.ts","../src/features/check-overrides/model/package-registry.ts","../src/entities/package/model/stack-catalog.ts","../src/entities/package/model/published-manifest.ts","../src/features/check-placement/model/colocated-git-patterns.ts","../src/features/check-placement/model/colocated-tests.ts","../src/shared/lib/agent-docs.ts","../src/features/check-placement/model/agent-docs-length.ts","../src/features/check-placement/model/claude-link.ts","../src/features/check-placement/model/dangling-links.ts","../src/features/check-placement/model/member-sources.ts","../src/features/check-placement/model/readme-file.ts","../src/features/check-placement/model/deployed-readme.ts","../src/features/check-placement/model/nested-docs.ts","../src/features/check-placement/model/published-readme.ts","../src/features/check-placement/model/published-tests.ts","../src/features/check-placement/model/root-docs.ts","../src/features/check-placement/model/root-readme.ts","../src/features/check-placement/model/doc-placement.ts","../src/features/check-placement/model/docs-mirror.ts","../src/features/check-placement/model/ignored-sources.ts","../src/features/check-placement/model/public-entries.ts","../src/features/check-placement/model/rust-layout.ts","../src/features/check-placement/model/rust-syntax.ts","../src/features/check-placement/model/english-verbs.json","../src/features/check-placement/model/source-names.ts","../src/features/check-placement/model/rust-modules.ts","../src/features/check-placement/model/shadcn-ui-alias.ts","../src/features/check-placement/model/source-aliases.ts","../src/features/check-placement/model/placement-checks.ts","../src/features/check-repository-layout/model/command-entries.ts","../src/features/check-repository-layout/model/path-mention.ts","../src/features/check-repository-layout/model/cargo-paths.ts","../src/features/check-repository-layout/model/path-existence.ts","../src/features/check-repository-layout/model/tsconfig-paths.ts","../src/features/check-repository-layout/model/config-paths.ts","../src/features/check-repository-layout/model/crates.ts","../src/features/check-repository-layout/model/deploy-entry-patterns.ts","../src/features/check-repository-layout/model/fallow-entries.ts","../src/features/check-repository-layout/model/root-workspace-paths.ts","../src/features/check-repository-layout/model/hidden-verify.ts","../src/features/check-repository-layout/model/shared-uncached-tasks.ts","../src/features/check-repository-layout/model/unlocked-tasks.ts","../src/features/check-repository-layout/model/task-checks.ts","../src/features/check-repository-layout/model/workflow-nodes.ts","../src/features/check-repository-layout/model/workflow-references.ts","../src/features/check-repository-layout/model/workflow-paths.ts","../src/features/check-repository-layout/model/workflow-scale.ts","../src/features/check-repository-layout/model/workspace-checks.ts","../src/shared/lib/keys.ts","../src/shared/lib/package-name.ts","../src/features/measure-install-size/model/import-graph.ts","../src/features/measure-install-size/model/installed-closure.ts","../src/features/measure-install-size/model/install-size.ts","../src/shared/lib/bundle-error.ts","../src/features/check-tree-shaking/model/consumer-bundle.ts","../src/features/check-tree-shaking/model/manifest.ts","../src/features/check-tree-shaking/model/optional-peers.ts","../src/features/check-tree-shaking/model/side-effects.ts","../src/features/check-tree-shaking/model/top-level-effects.ts","../src/features/check-tree-shaking/model/usage.ts","../src/features/check-tree-shaking/model/tree-shaking.ts","../src/features/check-typescript-generation/model/typescript-generation.ts","../src/features/check-worker-bundles/model/worker-bundles.ts","../src/app/build-checks.ts","../src/features/check-value-owners/model/slots.ts","../src/features/check-value-owners/model/flows.ts","../src/features/check-value-owners/model/free-literals.ts","../src/features/check-value-owners/model/name-lists.ts","../src/features/check-value-owners/model/outside-names.ts","../src/features/check-value-owners/model/owners.ts","../src/features/check-value-owners/model/derivation.ts","../src/features/check-value-owners/model/property-match.ts","../src/features/check-value-owners/model/shapes.ts","../src/features/check-value-owners/model/sites.ts","../src/features/check-value-owners/model/value-checks.ts","../src/features/check-value-owners/model/analysis.ts","../src/features/check-value-owners/model/cache.ts","../src/features/check-value-owners/model/duplicates.ts","../src/features/check-value-owners/model/declared-names.ts","../src/features/check-value-owners/model/listed-paths.ts","../src/features/check-value-owners/model/subset-lists.ts","../src/features/check-value-owners/model/hand-lists.ts","../src/features/check-value-owners/model/repository-names.ts","../src/features/check-value-owners/model/check.ts","../src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts","../src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts","../src/app/source-checks.ts","../src/shared/config/masseater-marketplace.json","../src/features/check-agent-settings/model/known-plugins.ts","../src/features/check-agent-settings/model/missing-hooks.ts","../src/features/check-documented-commands/model/task-graph.ts","../src/features/check-documented-commands/model/commands.ts","../src/features/check-legacy-web/model/legacy-web.ts","../src/shared/lib/section-check.ts","../src/features/check-markdown/model/markdown.ts","../src/features/check-scripts/model/shell-scripts.ts","../src/shared/lib/workflow-files.ts","../src/shared/lib/workflow-run.ts","../src/features/check-scripts/model/workflows.ts","../src/features/check-scripts/model/script-checks.ts","../src/features/check-structure/model/structure.ts","../src/features/check-vite-plus/model/command-words.ts","../src/features/check-vite-plus/model/command-problems.ts","../src/features/check-vite-plus/model/doc-sources.ts","../src/features/check-vite-plus/model/command-sources.ts","../src/features/check-vite-plus/model/package-scripts.ts","../src/features/check-vite-plus/model/vite-plus-block.ts","../src/features/check-vite-plus/model/vite-plus-checks.ts","../src/features/check-workflows/model/workflow-yaml.ts","../src/features/check-workflows/model/full-history-checkout.ts","../src/features/check-workflows/model/publish-trigger.ts","../src/features/check-workflows/model/release-please.ts","../src/features/check-workflows/model/workflow-queue.ts","../src/features/check-workflows/model/workflow-commits.ts","../src/features/check-workflows/model/workflow-lint.ts","../src/app/tool-use.ts","../src/shared/lib/comment-directives.ts","../src/features/ban-comments/model/found-comment.ts","../src/features/ban-comments/model/config-comments.ts","../src/features/ban-comments/model/comment-readers.ts","../src/features/ban-comments/model/reader-of.ts","../src/features/ban-comments/model/comments.ts","../src/features/ban-tools/model/banned-tool.ts","../src/features/ban-tools/model/docker.ts","../src/features/ban-tools/model/python.ts","../src/features/check-catalog-entries/model/uncataloged-dependencies.ts","../src/features/check-catalog-entries/model/catalog-entries.ts","../src/features/check-skills/model/skill-entry.ts","../src/features/check-skills/model/published-skills.ts","../src/features/check-skills/model/skill-files.ts","../src/features/check-version-downgrades/model/version-entries.ts","../src/features/check-version-downgrades/model/version-downgrade.ts","../src/features/check-version-downgrades/model/renovate-settings.ts","../src/features/check-version-downgrades/model/package-versions.ts","../src/features/find-invisible-characters/model/hidden-unicode.ts","../src/features/find-unneeded-files/model/applied-packages.ts","../src/features/find-unneeded-files/model/replaced-tools.ts","../src/features/find-unneeded-files/model/lockfiles.ts","../src/features/find-unneeded-files/model/unneeded-files.ts","../src/features/check-effect-diagnostics/model/effect-diagnostics.ts","../src/features/check-exact-versions/model/exact-versions.ts","../src/features/check-pack-settings/model/pack-settings.ts","../src/features/check-plugin-marketplace/model/plugin-marketplace.ts","../src/features/check-published-manifest/model/package-homepage.ts","../src/features/check-published-manifest/model/package-scope.ts","../src/features/check-published-manifest/model/published-manifests.ts","../src/features/check-runtime-version/model/node-version.ts","../src/features/check-unused-workspaces/model/unused-workspaces.ts","../src/features/check-upstream-exits/model/scattered-deviations.ts","../src/features/check-workspace-descriptions/model/workspace-descriptions.ts","../src/app/manifest-checks.ts","../src/app/tracked-text.ts","../src/app/all-checks.ts","../bin/msch.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { KeySchema, nestedValues } from \"./config-literal.ts\";\nimport { workspaceConfigOf } from \"./workspace-config-source.ts\";\nimport { RUN_TASKS } from \"./workspace-tasks.ts\";\n\nconst TaskProperty = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n start: Schema.Finite,\n});\nconst TaskObject = Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n});\n\nconst decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);\nconst decodeTaskObject = Schema.decodeUnknownOption(TaskObject);\n\nexport type RunTask = typeof TaskProperty.Type;\n\nexport interface RunTasks {\n readonly file: string;\n readonly source: string;\n readonly tasks: readonly RunTask[];\n}\n\nconst tasksIn = (program: unknown): readonly RunTask[] =>\n pipe(\n nestedValues(RUN_TASKS)(program),\n Arr.flatMap((tasks) =>\n pipe(\n decodeTaskObject(tasks),\n Option.map(({ properties }) => properties),\n Option.getOrElse((): readonly unknown[] => []),\n ),\n ),\n Arr.flatMap((property) => Option.toArray(decodeTaskProperty(property))),\n );\n\nexport const runTasksOf = Effect.fn(\"runTasksOf\")(function* runTasksOf(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n return pipe(\n config,\n Option.map(({ file, source, program }): RunTasks => ({\n file,\n source,\n tasks: tasksIn(program),\n })),\n );\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceProjects } from \"./workspace-projects.ts\";\nimport type { WorkspaceProject } from \"./workspace-projects.ts\";\n\nconst ALTERNATIVE = \"|\";\nconst SCOPE = /^@[^/]+\\//u;\nconst SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\n\nexport interface NamedWorkspace {\n readonly directory: string;\n readonly names: readonly string[];\n readonly packageName: Option.Option<string>;\n}\n\n/** @internal */\nexport const patternOf = (names: readonly string[]): RegExp => {\n const alternatives = pipe(names, Arr.map(Str.replaceAll(SPECIAL, String.raw`\\$&`)));\n return new RegExp(\n `(?<![\\\\p{L}\\\\p{N}_-])(?:${Arr.join(alternatives, ALTERNATIVE)})(?![\\\\p{L}\\\\p{N}_-])`,\n \"gu\",\n );\n};\n\nconst namedIn =\n (basename: (directory: string) => string) =>\n ({ directory, packageName }: WorkspaceProject): NamedWorkspace => {\n const unscoped = pipe(packageName, Option.map(Str.replace(SCOPE, \"\")));\n const names = pipe(\n [Option.some(directory), Option.some(basename(directory)), packageName, unscoped],\n Arr.getSomes,\n Arr.dedupe,\n );\n return { directory, names, packageName };\n };\n\n/** @internal */\nexport const namedWorkspaces = Effect.fn(\"namedWorkspaces\")(function* namedWorkspaces(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const projects = yield* workspaceProjects(root);\n return pipe(projects, Arr.map(namedIn((directory) => files.basename(directory))));\n});\n","import { Array as Arr, Effect, Option, Schema, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nconst SEPARATOR = \"/\";\nconst SUCCESS = 0;\n\nconst CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });\nconst CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });\nconst CrateEntry = Schema.Struct({\n name: Schema.String,\n version: Schema.String,\n manifest_path: Schema.String,\n targets: Schema.Array(CrateTarget),\n dependencies: Schema.Array(CrateDependency),\n});\nconst CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));\nconst decodeCrateList = Schema.decodeUnknownEffect(CrateList);\n\nexport interface Crate {\n readonly name: string;\n readonly version: string;\n readonly manifest: string;\n readonly kinds: readonly string[];\n readonly pathDependencies: readonly string[];\n}\n\nconst crateOf = (crate: typeof CrateEntry.Type): Crate => ({\n name: crate.name,\n version: crate.version,\n manifest: crate.manifest_path,\n kinds: pipe(\n crate.targets,\n Arr.flatMap(({ kind }) => kind),\n Arr.dedupe,\n ),\n pathDependencies: pipe(\n crate.dependencies,\n Arr.flatMap(({ path }) => Option.toArray(Option.fromUndefinedOr(path))),\n ),\n});\n\n/** @internal */\nexport const cratesIn = Effect.fn(\"cratesIn\")(function* cratesIn(root: string) {\n const handle = yield* ChildProcess.make(\n \"cargo\",\n [\"metadata\", \"--no-deps\", \"--format-version\", \"1\", \"--offline\"],\n { cwd: root, extendEnv: true, stdin: \"ignore\" },\n );\n const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n if (code !== SUCCESS) {\n return [];\n }\n const list = yield* decodeCrateList(output);\n return pipe(list.packages, Arr.map(crateOf));\n}, Effect.scoped);\n\n/** @internal */\nexport const owningWorkspace =\n (directories: readonly string[]) =>\n (directory: string): Option.Option<string> => {\n const owners = pipe(\n directories,\n Arr.filter(\n (workspace) =>\n directory === workspace || Str.startsWith(`${workspace}${SEPARATOR}`)(directory),\n ),\n );\n return Arr.last(Arr.sort(owners, Str.Order));\n };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.ts\";\n\nconst describeVersions = (versions: readonly string[]): string =>\n Option.getOrElse(\n Option.liftPredicate(Arr.join(versions, \",\"), (joined) => joined !== \"\"),\n () => \"-\",\n );\n\nconst describeChanges = (report: OverrideReport): string => {\n const versions = pipe(\n report.changes,\n Arr.map(\n (change) =>\n `${change.name} ${describeVersions(change.before)} -> ${describeVersions(change.after)}`,\n ),\n );\n const contexts = Arr.filter([\"the peer contexts\"], () => report.peerContextsChanged);\n return Arr.join([...versions, ...contexts], \"; \");\n};\n\nexport interface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nexport const overrideProblem =\n (located: LocatedOverride) =>\n (report: OverrideReport): Option.Option<Problem> => {\n const at = { file: located.file, line: located.line, column: located.column };\n if (report.verdict === \"unused\") {\n return Option.some({\n ...at,\n rule: \"unused-override\",\n message: `Every package resolves the same way without the override ${report.key}. Remove it.`,\n });\n }\n if (report.verdict === \"verify\") {\n return Option.some({\n ...at,\n rule: \"removable-override\",\n message: `Removing the override ${report.key} changes ${describeChanges(report)} without new peer issues or advisories. Remove it and run verify.`,\n });\n }\n return Option.none();\n };\n","import { Array as Arr, Boolean as Bool, Effect, String as Str, pipe } from \"effect\";\n\nimport { contentKey } from \"#/shared/lib/pass-records.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { installedPackages, nearestManifestDirectory } from \"./inputs.ts\";\n\nconst MANIFEST_ENTRY = \"package.json\";\nconst SOURCE_ENTRY = \"src\";\nconst LOWER_LAYERS = [\"entities\", \"shared\"] as const;\nconst PATH_SEPARATOR = \"/\";\nconst NOT_INSTALLED: readonly string[] = [];\n\nconst walked = (directory: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* walkFrom() {\n const files = yield* RepositoryFiles;\n const found = yield* files.walkDirectory(directory);\n return pipe(\n found,\n Arr.map((file) => files.join(directory, file)),\n );\n });\n\nconst sourceFiles = Effect.fn(\"sourceFiles\")(function* sourceFiles(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const source = files.join(root, SOURCE_ENTRY);\n const layers = pipe(\n LOWER_LAYERS,\n Arr.map((layer) => files.join(source, layer)),\n );\n const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, {\n concurrency: 1,\n });\n return Arr.flatten(nested);\n});\n\nconst bundleParts = Effect.fn(\"bundleParts\")(function* bundleParts(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const bundled = yield* walked(moduleDirectory);\n return { listed: [files.join(root, MANIFEST_ENTRY), ...bundled], installed: NOT_INSTALLED };\n});\n\nconst sourceParts = Effect.fn(\"sourceParts\")(function* sourceParts(\n root: string,\n moduleDirectory: string,\n) {\n const listed = yield* sourceFiles(root, moduleDirectory);\n const installed = yield* installedPackages(root, root);\n return { listed, installed };\n});\n\n/** @internal */\nexport const implementationOf = Effect.fn(\"implementationOf\")(function* implementationOf(\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const root = yield* nearestManifestDirectory(moduleDirectory);\n const fromSource = Str.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(\n moduleDirectory,\n );\n const parts = yield* Bool.match(fromSource, {\n onFalse: () => bundleParts(root, moduleDirectory),\n onTrue: () => sourceParts(root, moduleDirectory),\n });\n return {\n files: pipe(\n Arr.sort(parts.listed, Str.Order),\n Arr.map((file) => [files.relative(root, file), file] as const),\n ),\n installed: parts.installed,\n };\n});\n\nexport const implementationFingerprint = Effect.fn(\"implementationFingerprint\")(\n function* implementationFingerprint(moduleDirectory: string) {\n const implementation = yield* implementationOf(moduleDirectory);\n return yield* contentKey(implementation.installed, implementation.files);\n },\n);\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport { implementationFingerprint } from \"#/entities/project/index.ts\";\nimport { contentKey, keepOnly, recordsIn } from \"#/shared/lib/pass-records.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RECORDS = [NODE_MODULES, \".cache\", \"msch\", \"overrides\"] as const;\nconst NO_PROBLEMS: readonly Problem[] = [];\n\nconst keyOf = Effect.fn(\"keyOf\")(function* keyOf(root: string, inputs: readonly string[]) {\n const files = yield* RepositoryFiles;\n const implementation = yield* implementationFingerprint(import.meta.dirname);\n return yield* contentKey(\n [implementation],\n pipe(\n inputs,\n Arr.map((file) => [file, files.join(root, file)] as const),\n ),\n );\n});\n\nexport const unlessPassed = Effect.fn(\"unlessPassed\")(function* unlessPassed<Failure, Services>(\n root: string,\n inputs: readonly string[],\n check: Effect.Effect<readonly Problem[], Failure, Services>,\n) {\n const files = yield* RepositoryFiles;\n const key = yield* keyOf(root, inputs);\n const records = yield* recordsIn(files.join(root, ...RECORDS));\n if (Arr.contains(records.passed, key)) {\n yield* Effect.annotateCurrentSpan({ \"msch.overrides.recorded\": true });\n return NO_PROBLEMS;\n }\n const problems = yield* check;\n if (Arr.isReadonlyArrayEmpty(problems)) {\n yield* keepOnly(records, [key]);\n }\n return problems;\n});\n","import { Array as Arr, Option, Order, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst VerdictSchema = Schema.Literals([\"unused\", \"keep\", \"verify\"]);\n\nconst PackageChangeSchema = Schema.Struct({\n name: Schema.String,\n before: Schema.Array(Schema.String),\n after: Schema.Array(Schema.String),\n});\n\nconst OverrideReportSchema = Schema.Struct({\n key: Schema.String,\n verdict: VerdictSchema,\n changes: Schema.Array(PackageChangeSchema),\n peerContextsChanged: Schema.Boolean,\n peerIssues: Schema.Array(Schema.String),\n advisories: Schema.Array(Schema.String),\n});\n\nexport type OverrideReport = typeof OverrideReportSchema.Type;\ntype PackageChange = typeof PackageChangeSchema.Type;\n\nconst PeerParentSchema = Schema.Struct({ name: Schema.String, version: Schema.String });\n\nconst PeerIssueSchema = Schema.Struct({\n parents: Schema.Array(PeerParentSchema),\n wantedRange: Schema.String,\n foundVersion: Schema.optionalKey(Schema.String),\n});\n\ntype PeerIssue = typeof PeerIssueSchema.Type;\n\nconst ProjectPeerIssuesSchema = Schema.Struct({\n bad: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n missing: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n conflicts: Schema.Array(Schema.String),\n});\n\ntype ProjectPeerIssues = typeof ProjectPeerIssuesSchema.Type;\n\nconst PeerIssuesLog = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.Literal(\"pnpm:peer-dependency-issues\"),\n issuesByProjects: Schema.Record(Schema.String, ProjectPeerIssuesSchema),\n }),\n);\n\nexport interface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\nexport interface Resolution extends Findings {\n readonly versions: Readonly<Record<string, readonly string[]>>;\n readonly snapshots: readonly string[];\n}\n\nconst AdvisorySchema = Schema.Struct({\n module_name: Schema.String,\n github_advisory_id: Schema.String,\n});\n\nconst AuditReport = Schema.fromJsonString(\n Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }),\n);\n\nconst SCOPE_PREFIX = \"@\";\nconst NAME_START = 0;\nconst SEPARATOR_LENGTH = 1;\nconst PEER_CONTEXT_START = \"(\";\n\nconst sorted = (values: readonly string[]): readonly string[] =>\n Arr.sort(Arr.dedupe(values), Order.String);\n\nconst describeIssue =\n (project: string, kind: string) =>\n ([peer, issues]: readonly [string, readonly PeerIssue[]]): readonly string[] =>\n pipe(\n issues,\n Arr.map((issue) => {\n const dependent = Option.match(Arr.last(issue.parents), {\n onNone: () => project,\n onSome: (parent) => `${parent.name}@${parent.version}`,\n });\n const found = Option.getOrElse(Option.fromUndefinedOr(issue.foundVersion), () => \"none\");\n return `${project}: ${kind} peer ${peer}@${issue.wantedRange} of ${dependent}, found ${found}`;\n }),\n );\n\nconst issuesOfProject = ([project, issues]: readonly [\n string,\n ProjectPeerIssues,\n]): readonly string[] => [\n ...pipe(Rec.toEntries(issues.bad), Arr.flatMap(describeIssue(project, \"unmet\"))),\n ...pipe(Rec.toEntries(issues.missing), Arr.flatMap(describeIssue(project, \"missing\"))),\n ...pipe(\n issues.conflicts,\n Arr.map((peer) => `${project}: conflicting peer ${peer}`),\n ),\n];\n\nexport const peerIssuesIn = (output: string): readonly string[] =>\n sorted(\n pipe(\n Str.split(output, \"\\n\"),\n Arr.map((line) => Schema.decodeOption(PeerIssuesLog)(line)),\n Arr.getSomes,\n Arr.flatMap((log) => pipe(Rec.toEntries(log.issuesByProjects), Arr.flatMap(issuesOfProject))),\n ),\n );\n\nexport const advisoriesIn = (output: string): readonly string[] =>\n Option.match(Schema.decodeOption(AuditReport)(output), {\n onNone: () => [],\n onSome: (report) =>\n sorted(\n pipe(\n Rec.values(report.advisories),\n Arr.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`),\n ),\n ),\n });\n\nconst separatorOf = (key: string): Option.Option<number> => {\n if (!Str.startsWith(SCOPE_PREFIX)(key)) {\n return Str.indexOf(SCOPE_PREFIX)(key);\n }\n return pipe(\n Str.slice(SEPARATOR_LENGTH)(key),\n Str.indexOf(SCOPE_PREFIX),\n Option.map((index) => index + SEPARATOR_LENGTH),\n );\n};\n\nconst withoutPeerContext = (version: string): string =>\n Option.match(Str.indexOf(PEER_CONTEXT_START)(version), {\n onNone: () => version,\n onSome: (start) => Str.slice(NAME_START, start)(version),\n });\n\nconst packageOf = (key: string): Option.Option<readonly [string, string]> =>\n Option.map(separatorOf(key), (separator) => [\n Str.slice(NAME_START, separator)(key),\n withoutPeerContext(Str.slice(separator + SEPARATOR_LENGTH)(key)),\n ]);\n\nexport const resolutionOf =\n (findings: Findings) =>\n (depPaths: readonly string[]): Resolution => {\n const packages = Arr.getSomes(\n pipe(\n depPaths,\n Arr.map((key) => packageOf(key)),\n ),\n );\n const versions = Rec.map(\n Arr.groupBy(packages, ([name]) => name),\n (entries) =>\n sorted(\n pipe(\n entries,\n Arr.map(([, version]) => version),\n ),\n ),\n );\n return { ...findings, versions, snapshots: sorted(depPaths) };\n };\n\nconst changesBetween = (baseline: Resolution, candidate: Resolution): readonly PackageChange[] =>\n pipe(\n sorted([...Rec.keys(baseline.versions), ...Rec.keys(candidate.versions)]),\n Arr.map((name) => ({\n name,\n before: baseline.versions[name] ?? [],\n after: candidate.versions[name] ?? [],\n })),\n Arr.filter((change) => Arr.join(change.before, \" \") !== Arr.join(change.after, \" \")),\n );\n\nconst growsThePackageSet = (change: PackageChange): boolean =>\n change.after.length > change.before.length;\n\nconst needsTheOverride = (\n found: Pick<OverrideReport, \"changes\" | \"peerIssues\" | \"advisories\">,\n): boolean =>\n pipe(\n found.changes,\n Arr.some((change) => growsThePackageSet(change)),\n ) ||\n Arr.isReadonlyArrayNonEmpty(found.peerIssues) ||\n Arr.isReadonlyArrayNonEmpty(found.advisories);\n\nexport const judge =\n (baseline: Resolution) =>\n (key: string, candidate: Resolution): OverrideReport => {\n const changes = changesBetween(baseline, candidate);\n const peerIssues = Arr.difference(candidate.peerIssues, baseline.peerIssues);\n const advisories = Arr.difference(candidate.advisories, baseline.advisories);\n const peerContextsChanged =\n Arr.join(baseline.snapshots, \" \") !== Arr.join(candidate.snapshots, \" \");\n const found = { key, changes, peerContextsChanged, peerIssues, advisories };\n if (!Arr.isReadonlyArrayNonEmpty(changes) && !peerContextsChanged) {\n return { ...found, verdict: \"unused\" };\n }\n if (needsTheOverride(found)) {\n return { ...found, verdict: \"keep\" };\n }\n return { ...found, verdict: \"verify\" };\n };\n\nexport const BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\nconst QUOTES = ['\"', \"'\"];\nconst PREVIOUS = 1;\n\nexport type Overrides = Readonly<Record<string, string>>;\n\nexport interface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst keyStart =\n (source: string) =>\n (index: number): number => {\n const before = Str.slice(index - PREVIOUS, index)(source);\n return index - Number(Arr.contains(QUOTES, before)) * PREVIOUS;\n };\n\nexport const overrideKeysOf =\n (source: string) =>\n (overrides: Overrides): readonly OverrideKey[] => {\n const at = positionOf(source);\n return pipe(\n Rec.keys(overrides),\n Arr.flatMap((key) =>\n pipe(\n Str.indexOf(key)(source),\n Option.map((index) => ({ key, ...at(keyStart(source)(index)) })),\n Option.toArray,\n ),\n ),\n );\n };\n\nexport const withoutOverride =\n (key: string) =>\n (overrides: Overrides): Overrides =>\n Rec.remove(overrides, key);\n\nexport const withBaselineProbe = (overrides: Overrides): Overrides => ({\n ...overrides,\n [BASELINE_PROBE]: REMOVED_DEPENDENCY,\n});\n","import { updateWorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-writer\";\nimport {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { lockedPackages, workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { overrideProblem } from \"./override-findings.ts\";\nimport { unlessPassed } from \"./override-records.ts\";\nimport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n} from \"./override-resolution.ts\";\nimport type { OverrideKey, Overrides } from \"./override-resolution.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst RESOLUTION_FILES = [\"*package.json\", WORKSPACE_FILE, LOCKFILE, \".npmrc\", \"patches/*\"];\nconst RESOLUTION_CONCURRENCY = 2;\nconst SUCCEEDED = 0;\n\nconst taggedError = Schema.TaggedError;\n\nclass OverrideResolutionFailed extends taggedError<\n OverrideResolutionFailed,\n { readonly brand: unique symbol }\n>()(\"OverrideResolutionFailed\", { override: Schema.String, output: Schema.String }) {}\n\ntype CandidateFailure = OverrideResolutionFailed | PlatformError.PlatformError;\ntype CandidateServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\ninterface Workspace {\n readonly root: string;\n readonly files: readonly string[];\n readonly overrides: Overrides;\n}\n\nconst textOf = <Failure>(\n stream: Stream.Stream<Uint8Array, Failure>,\n): Effect.Effect<string, Failure> => stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst resolveIn = Effect.fn(\"resolveIn\")(function* resolveIn(directory: string, override: string) {\n const handle = yield* ChildProcess.make(\n \"vp\",\n [\"install\", \"--lockfile-only\", \"--ignore-scripts\", \"--\", \"--reporter=ndjson\"],\n { cwd: directory, env: { CI: \"true\" }, extendEnv: true, stdin: \"ignore\" },\n );\n const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n if (Number(status) !== SUCCEEDED) {\n return yield* OverrideResolutionFailed.make({ override, output });\n }\n return output;\n});\n\nconst auditIn = Effect.fn(\"auditIn\")(function* auditIn(directory: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"pm\", \"audit\", \"--json\"], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n return advisoriesIn(report);\n}, Effect.scoped);\n\nconst trackedResolutionFiles = Effect.fn(\"trackedResolutionFiles\")(function* trackedFiles(\n root: string,\n) {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", \"--\", ...RESOLUTION_FILES], {\n cwd: root,\n });\n const listed = yield* textOf(handle.stdout);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n}, Effect.scoped);\n\nconst copyFiles = Effect.fn(\"copyFiles\")(function* copyFiles(\n workspace: Workspace,\n directory: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const copyOne = (file: string): Effect.Effect<void, PlatformError.PlatformError> => {\n const source = path.join(workspace.root, file);\n const target = path.join(directory, file);\n const copy = fs.copyFile(source, target);\n const write = fs\n .makeDirectory(path.dirname(target), { recursive: true })\n .pipe(Effect.andThen(copy));\n return Effect.when(write, fs.exists(source));\n };\n yield* Effect.forEach(workspace.files, copyOne, { concurrency: 1, discard: true });\n});\n\nconst depPathsIn = (\n directory: string,\n override: string,\n): Effect.Effect<readonly string[], OverrideResolutionFailed> =>\n lockedPackages(directory).pipe(\n Effect.mapBoth({\n onSuccess: Option.getOrElse((): readonly string[] => []),\n onFailure: ({ reason }) => OverrideResolutionFailed.make({ override, output: reason }),\n }),\n );\n\nconst resolutionWith = Effect.fn(\"resolutionWith\")(function* resolutionWith(\n workspace: Workspace,\n override: string,\n overrides: Overrides,\n) {\n const fs = yield* FileSystem.FileSystem;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-overrides-\" });\n yield* copyFiles(workspace, directory);\n yield* Effect.tryPromise({\n try: () =>\n updateWorkspaceManifest(directory, { updatedFields: { overrides: { ...overrides } } }),\n catch: (cause) => OverrideResolutionFailed.make({ override, output: String(cause) }),\n });\n const output = yield* resolveIn(directory, override);\n const depPaths = yield* depPathsIn(directory, override);\n yield* Effect.annotateCurrentSpan({ \"msch.override\": override });\n const advisories = yield* auditIn(directory);\n return resolutionOf({ peerIssues: peerIssuesIn(output), advisories })(depPaths);\n}, Effect.scoped);\n\nconst problemsFor = Effect.fn(\"problemsFor\")(function* problemsFor(\n workspace: Workspace,\n keys: readonly OverrideKey[],\n) {\n const path = yield* Path.Path;\n const { root, overrides } = workspace;\n const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));\n const judgeAgainstBaseline = judge(baseline);\n const file = path.join(root, WORKSPACE_FILE);\n const problemOf = (\n located: OverrideKey,\n ): Effect.Effect<Option.Option<Problem>, CandidateFailure, CandidateServices> =>\n resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(\n Effect.map((candidate) =>\n overrideProblem({ ...located, file })(judgeAgainstBaseline(located.key, candidate)),\n ),\n );\n const problems = yield* Effect.forEach(keys, problemOf, {\n concurrency: RESOLUTION_CONCURRENCY,\n });\n return Arr.getSomes(problems);\n});\n\n/** @internal */\nexport const checkOverrides = Effect.fn(\"checkOverrides\")(function* checkOverrides(root: string) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE)).pipe(Effect.option);\n const manifest = yield* workspaceManifest(root);\n const overrides: Overrides = pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)),\n Option.getOrElse((): Overrides => ({})),\n );\n const keys = pipe(\n source,\n Option.map((text) => overrideKeysOf(text)(overrides)),\n Option.getOrElse((): readonly OverrideKey[] => []),\n );\n if (!Arr.isReadonlyArrayNonEmpty(keys)) {\n return [];\n }\n const files = yield* trackedResolutionFiles(root);\n return yield* unlessPassed(root, files, problemsFor({ root, files, overrides }, keys));\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst READ_CONCURRENCY = 64;\n\nexport interface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nexport const isScannedText = ({ name }: Listed): boolean =>\n SCANNED_FILE.test(name) && !LOCKFILE.test(name);\n\nexport const isToolVersions = ({ name }: Listed): boolean => TOOL_VERSIONS.test(name);\n\n/** @internal */\nexport const listedFiles = Effect.fn(\"listedFiles\")(function* listedFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n return pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n});\n\n/** @internal */\nexport const presentFiles = Effect.fn(\"presentFiles\")(function* presentFiles(\n listed: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n listed,\n Effect.filter(({ file }) => files.exists(file)),\n );\n});\n\n/** @internal */\nexport const scanText = Effect.fn(\"scanText\")(function* scanText(\n listed: readonly Listed[],\n problemsIn: (entry: Listed, source: string) => readonly Problem[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n listed,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst DEPENDENCY_FILE = /(?:^|\\/)(?:package\\.json|pnpm-workspace\\.ya?ml)$/u;\nconst GIT_SUBPATH = /(?<![^\\s\"':])[^\\s\"'#]+#(?:[^\\s\"'&]*&)*path:[^\\s\"']*/gu;\nconst RULE: RuleName = \"git-subpath-dependency\";\nconst WHOLE_MATCH = 0;\n\nconst problemAt =\n ({ file }: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: RULE,\n message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \\`${Str.trim(found[WHOLE_MATCH])}\\`.`,\n });\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(Arr.fromIterable(Str.matchAll(GIT_SUBPATH)(source)), Arr.map(problemAt(entry, source)));\n\nconst isDependencyFile = ({ name }: Listed): boolean => DEPENDENCY_FILE.test(name);\n\n/** @internal */\nexport const checkGitSubpath = Effect.fn(\"checkGitSubpath\")(function* checkGitSubpath(\n root: string,\n) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isDependencyFile)), problemsIn);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { isScannedText, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"unnamed-restriction\";\nconst WHOLE_MATCH = 0;\nconst RESTRICTED = \"no-restricted-\";\nconst UNNAMED = new RegExp(`(?:[\\\\w@-]+/)?${RESTRICTED}(?:imports|properties)\\\\b`, \"gu\");\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(UNNAMED)(source)),\n Arr.map((found): Problem => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: RULE,\n message: `${found[WHOLE_MATCH]} 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.`,\n })),\n );\n\n/** @internal */\nexport const checkRestrictedRules = Effect.fn(\"checkRestrictedRules\")(\n function* checkRestrictedRules(root: string) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScannedText)), problemsIn);\n },\n);\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { isScannedText, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"named-type-exemption\";\nconst WHOLE_MATCH = 0;\nconst ORIGINS = \"file|lib|package\";\nconst SPECIFIER = new RegExp(`[\"']?\\\\bfrom[\"']?\\\\s*:\\\\s*[\"'](?:${ORIGINS})[\"']`, \"gu\");\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(SPECIFIER)(source)),\n Arr.map((found): Problem => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: RULE,\n message:\n \"exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration.\",\n })),\n );\n\n/** @internal */\nexport const checkTypeExemptions = Effect.fn(\"checkTypeExemptions\")(function* checkTypeExemptions(\n root: string,\n) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScannedText)), problemsIn);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"package-registry\";\nconst REGISTRY = \"https://npm.flatt.tech/\";\nconst TRAILING_SLASH = /\\/$/u;\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst NPMRC = /(?:^|\\/)\\.npmrc$/u;\nconst WORKSPACE_REGISTRY = /^registry:/mu;\nconst NPMRC_REGISTRY = /^[ \\t]*registry[ \\t]*=[ \\t]*(?<value>\\S*)/gmu;\nconst START = 0;\nconst REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;\n\nconst decodeRegistry = Schema.decodeUnknownOption(\n Schema.Struct({ registry: Schema.optional(Schema.String) }),\n);\n\nconst registryOf = (manifest: unknown): Option.Option<string> =>\n pipe(\n decodeRegistry(manifest),\n Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)),\n );\n\nconst withoutSlash = Str.replace(TRAILING_SLASH, \"\");\n\nconst isGuarded = (registry: string): boolean => withoutSlash(registry) === withoutSlash(REGISTRY);\n\nconst offsetIn = (found: RegExpExecArray | null): number =>\n pipe(\n Option.fromNullishOr(found),\n Option.map(({ index }) => index),\n Option.getOrElse(() => START),\n );\n\nconst workspaceProblem = (\n file: string,\n source: string,\n registry: Option.Option<string>,\n): Problem => ({\n file,\n ...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),\n rule: RULE,\n message: Option.match(registry, {\n onNone: () => `${REASON} Set \\`registry: ${REGISTRY}\\` in ${WORKSPACE_FILE}.`,\n onSome: (value) => `${REASON} \\`registry\\` is ${value}. Set it to ${REGISTRY}.`,\n }),\n});\n\nconst npmrcProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(NPMRC_REGISTRY)(source)),\n Arr.filter((found) => !Option.exists(groupOf(\"value\")(found), isGuarded)),\n Arr.map((found) => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `${REASON} This .npmrc overrides it with \\`${Str.trim(found[START])}\\`. Remove the line.`,\n })),\n );\n\nconst checkWorkspace = Effect.fn(\"checkWorkspace\")(function* checkWorkspace(root: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* workspaceManifest(root);\n if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) {\n return [];\n }\n const registry = registryOf(manifest.value);\n const file = files.join(root, WORKSPACE_FILE);\n const read = yield* files.readFile(file);\n const source = Option.getOrElse(read, () => \"\");\n return [workspaceProblem(file, source, registry)];\n});\n\n/** @internal */\nexport const checkPackageRegistry = Effect.fn(\"checkPackageRegistry\")(\n function* checkPackageRegistry(root: string) {\n const listed = yield* listedFiles(root);\n const overrides = yield* scanText(\n pipe(\n listed,\n Arr.filter(({ name }) => NPMRC.test(name)),\n ),\n npmrcProblems,\n );\n const workspace = yield* checkWorkspace(root);\n return [...workspace, ...overrides];\n },\n);\n","export const STACK_CATALOG = \"catalog:stack\";\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\n\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst PublishedManifestSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n private: Schema.optional(Schema.Boolean),\n publishConfig: Schema.optional(Schema.Unknown),\n homepage: Schema.optional(Schema.Unknown),\n repository: Schema.optional(Schema.Unknown),\n});\n\nexport type PublishedManifest = typeof PublishedManifestSchema.Type;\n\nexport interface PublishedFile {\n readonly entry: Listed;\n readonly source: string;\n readonly manifest: PublishedManifest;\n}\n\nexport interface PublishedFile {\n readonly entry: Listed;\n readonly source: string;\n readonly manifest: PublishedManifest;\n}\n\nconst decodePublishedManifest = Schema.decodeUnknownOption(\n Schema.fromJsonString(PublishedManifestSchema),\n);\n\nconst isPublished = (manifest: PublishedManifest): boolean =>\n manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);\n\nexport const publishedManifestOf = (\n source: Option.Option<string>,\n): Option.Option<PublishedManifest> =>\n pipe(source, Option.flatMap(decodePublishedManifest), Option.filter(isPublished));\n\n/** @internal */\nexport const scanPublishedManifests = Effect.fn(\"scanPublishedManifests\")(\n function* scanPublishedManifests(\n root: string,\n problemsIn: (found: PublishedFile) => readonly Problem[],\n ) {\n const files = yield* RepositoryFiles;\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n return yield* scanText(\n pipe(\n manifests,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n (entry, source) =>\n pipe(\n publishedManifestOf(Option.some(source)),\n Option.map((manifest) => problemsIn({ entry, source, manifest })),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n );\n },\n);\n","import { SEPARATOR, isInside } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"colocated-git-patterns\";\nconst PATTERN_FILES = [\":(glob)**/.gitignore\", \":(glob)**/.gitattributes\"] as const;\nconst ROOT = \".\";\nconst NEGATION = \"!\";\nconst COMMENT = \"#\";\nconst ANY_DEPTH = \"**\";\nconst FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR}`;\nconst LEADING_SLASHES = /^\\/+/u;\nconst TRAILING_SLASHES = /\\/+$/u;\nconst SPACES = /\\s+/u;\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\n\ninterface PatternEntry {\n readonly file: string;\n readonly kind: string;\n readonly directory: string;\n readonly line: number;\n readonly pattern: string;\n readonly values: string;\n}\n\nconst withoutPrefix = (prefix: string, text: string): string => {\n if (Str.startsWith(prefix)(text)) {\n return Str.slice(prefix.length)(text);\n }\n return text;\n};\n\nconst isAnchored = (pattern: string): boolean => {\n const body = withoutPrefix(NEGATION, pattern);\n return pipe(body, Str.replace(TRAILING_SLASHES, \"\"), Str.includes(SEPARATOR));\n};\n\nconst segmentsOf = ({ directory, pattern }: PatternEntry): readonly string[] => {\n const body = withoutPrefix(NEGATION, pattern);\n const trimmed = pipe(body, Str.replace(LEADING_SLASHES, \"\"), Str.replace(TRAILING_SLASHES, \"\"));\n const own = Str.split(SEPARATOR)(trimmed);\n if (directory === ROOT) {\n return own;\n }\n return [...Str.split(SEPARATOR)(directory), ...own];\n};\n\nconst depthOf = (directory: string): number => Str.split(SEPARATOR)(directory).length;\n\nconst entryOf =\n (file: string, kind: string, directory: string) =>\n (line: string, index: number): Option.Option<PatternEntry> => {\n const [pattern, ...values] = pipe(Str.trim(line), Str.split(SPACES));\n if (Str.isEmpty(pattern) || Str.startsWith(COMMENT)(pattern)) {\n return Option.none();\n }\n return Option.some({\n file,\n kind,\n directory,\n line: index + FIRST,\n pattern,\n values: Arr.join(values, \" \"),\n });\n };\n\nconst entriesIn = Effect.fn(\"entriesIn\")(function* entriesIn(root: string, file: string) {\n const files = yield* RepositoryFiles;\n const absolute = files.join(root, file);\n const text = yield* files.readFile(absolute);\n const toEntry = entryOf(absolute, files.basename(file), files.dirname(file));\n return pipe(\n Option.getOrElse(text, () => \"\"),\n Str.split(\"\\n\"),\n Arr.map(toEntry),\n Arr.getSomes,\n );\n});\n\nconst patternProblem = (entry: PatternEntry, message: string): Problem =>\n problemAtPosition(RULE)(entry.file, { line: entry.line, column: FIRST }, message);\n\nconst misplacedMessage = (kind: string, workspaces: readonly string[]): string => {\n if (workspaces.length === FIRST) {\n const workspace = Arr.join(workspaces, \"\");\n return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;\n }\n return `matches paths inside the workspaces ${Arr.join(workspaces, \", \")}. Move it to the ${kind} of each workspace that needs it, or start it with **/ when it belongs to a tool any workspace can use.`;\n};\n\nconst matchedAtDepth = Effect.fn(\"matchedAtDepth\")(function* matchedAtDepth(\n root: string,\n segments: readonly string[],\n depth: number,\n) {\n const files = yield* RepositoryFiles;\n const leading = Arr.take(segments, depth);\n if (Arr.contains(leading, ANY_DEPTH)) {\n return [];\n }\n const manifests = yield* files.matchingFiles(root, [\n `:(glob)${Arr.join(leading, SEPARATOR)}${SEPARATOR}${MANIFEST_FILE}`,\n ]);\n return pipe(\n manifests,\n Arr.map((manifest) => files.dirname(manifest)),\n );\n});\n\nconst deepestOf = (inner: readonly string[]): readonly string[] =>\n pipe(\n inner,\n Arr.filter((workspace) => !pipe(inner, Arr.some(isInside(workspace)))),\n );\n\nconst matchedWorkspaces = Effect.fn(\"matchedWorkspaces\")(function* matchedWorkspaces(\n root: string,\n workspaces: readonly string[],\n entry: PatternEntry,\n) {\n const segments = segmentsOf(entry);\n const candidates = pipe(\n workspaces,\n Arr.filter(isInside(entry.directory)),\n Arr.filter((workspace) => depthOf(workspace) < segments.length),\n );\n const depths = pipe(candidates, Arr.map(depthOf), Arr.dedupe);\n const matched = yield* Effect.forEach(depths, (depth) => matchedAtDepth(root, segments, depth), {\n concurrency: 1,\n });\n const flat = Arr.flatten(matched);\n return pipe(\n candidates,\n Arr.filter((workspace) => Arr.contains(flat, workspace)),\n deepestOf,\n );\n});\n\nconst misplaced = Effect.fn(\"misplaced\")(function* misplaced(\n root: string,\n workspaces: readonly string[],\n entry: PatternEntry,\n) {\n if (!isAnchored(entry.pattern)) {\n return Option.none<Problem>();\n }\n const deepest = yield* matchedWorkspaces(root, workspaces, entry);\n if (Arr.isReadonlyArrayEmpty(deepest)) {\n return Option.none<Problem>();\n }\n return Option.some(patternProblem(entry, misplacedMessage(entry.kind, deepest)));\n});\n\nconst isFloating = (pattern: string): boolean =>\n !Str.startsWith(NEGATION)(pattern) &&\n (!isAnchored(pattern) || Str.startsWith(FLOATING_PREFIX)(pattern));\n\nconst ownLevelName = (pattern: string): Option.Option<string> => {\n if (isFloating(pattern)) {\n return Option.some(pattern);\n }\n const name = withoutPrefix(SEPARATOR, pattern);\n return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));\n};\n\nconst sameName = (outer: string, name: string): boolean => {\n if (outer === name) {\n return true;\n }\n return Str.endsWith(SEPARATOR)(name) && `${outer}${SEPARATOR}` === name;\n};\n\nconst coveredBy =\n (entry: PatternEntry, name: string) =>\n (outer: PatternEntry): boolean =>\n outer.kind === entry.kind &&\n outer.values === entry.values &&\n isFloating(outer.pattern) &&\n isInside(outer.directory)(entry.directory) &&\n sameName(outer.pattern, name);\n\nconst outerName = ({ directory, kind }: PatternEntry): string => {\n if (directory === ROOT) {\n return `the root ${kind}`;\n }\n return `${directory}/${kind}`;\n};\n\nconst repeated =\n (entries: readonly PatternEntry[]) =>\n (entry: PatternEntry): Option.Option<Problem> => {\n const outer = pipe(\n ownLevelName(entry.pattern),\n Option.flatMap((name) => pipe(entries, Arr.findFirst(coveredBy(entry, name)))),\n );\n return pipe(\n outer,\n Option.map((found) =>\n patternProblem(\n entry,\n `repeats ${found.pattern} from ${outerName(found)}, which already applies here. Delete it.`,\n ),\n ),\n );\n };\n\n/** @internal */\nexport const checkColocatedGitPatterns = Effect.fn(\"checkColocatedGitPatterns\")(\n function* checkColocatedGitPatterns(root: string) {\n const files = yield* RepositoryFiles;\n const patternFiles = yield* files.matchingFiles(root, PATTERN_FILES);\n const read = yield* Effect.forEach(patternFiles, (file) => entriesIn(root, file), {\n concurrency: READ_CONCURRENCY,\n });\n const entries = Arr.flatten(read);\n const workspaces = yield* workspaceDirectories(root);\n const misplacedFound = yield* Effect.forEach(\n entries,\n (entry) => misplaced(root, workspaces, entry),\n { concurrency: READ_CONCURRENCY },\n );\n const repeatedFound = pipe(entries, Arr.map(repeated(entries)));\n return Arr.getSomes([...misplacedFound, ...repeatedFound]);\n },\n);\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, publicEntriesOf } from \"#/entities/package/index.ts\";\nimport type { EntryManifest } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"colocated-test\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst ROOT_SUBPATH = \".\";\nconst NAME_GROUP = \"name\";\nconst SPECIFIER_GROUP = \"specifier\";\nconst SCRIPT = /\\.[cm]?[jt]sx?$/u;\nconst TEST_FILE = /\\.test\\.[cm]?[jt]sx?$/u;\nconst MANIFEST_NAME = /package\\.json$/u;\nconst SEPARATE_TEST_DIRECTORY = /(?:^|\\/)(?:__tests__|__mocks__|tests?)\\//u;\nconst SPEC_DIRECTORY = /(?:^|\\/)specs?\\//u;\nconst SPEC_FILE = /\\.spec\\.[cm]?[jt]sx?$/u;\nconst RELATIVE_REFERENCE = /[\"'`]\\.\\/(?<name>[^/\"'`]+)/gu;\nconst DIRNAME_REFERENCE = /import\\.meta\\.dirname\\s*,\\s*[\"'](?<name>[^/\"']+)[\"']/gu;\nconst MODULE_SPECIFIER =\n /(?:\\bfrom\\s+|\\bimport\\s*\\(\\s*|\\bimport\\s+|\\bvi\\.mock\\(\\s*)[\"'](?<specifier>[^\"'.#][^\"']*)[\"']/gu;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst DIRECTORY_MESSAGE =\n \"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.\";\nconst SIBLING_MESSAGE =\n \"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>.\";\n\nconst Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface TestFile {\n readonly name: string;\n readonly base: string;\n readonly file: string;\n readonly directory: string;\n}\n\ninterface Context {\n readonly root: string;\n readonly packages: readonly string[];\n}\n\ninterface Beside {\n readonly join: (target: string) => string;\n readonly dirname: (file: string) => string;\n readonly directory: string;\n}\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nconst problemFor = (test: TestFile, message: string): Problem => ({\n file: test.file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${test.base} ${message}`,\n});\n\nconst groupsOf = (source: string, pattern: RegExp, group: string): readonly string[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((match) =>\n pipe(\n Option.fromUndefinedOr(match.groups),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])),\n ),\n ),\n Arr.getSomes,\n );\n\nconst namesSibling = (source: string): boolean =>\n pipe(\n [\n ...groupsOf(source, RELATIVE_REFERENCE, NAME_GROUP),\n ...groupsOf(source, DIRNAME_REFERENCE, NAME_GROUP),\n ],\n Arr.some((name) => !TEST_FILE.test(name)),\n );\n\nconst ownerOf = (packages: readonly string[], name: string): Option.Option<string> => {\n const owners = pipe(\n packages,\n Arr.filter((directory) => Str.startsWith(directory)(name)),\n );\n return Arr.last(Arr.sort(owners, byLength));\n};\n\nconst specifiersBeside =\n ({ join, dirname, directory }: Beside) =>\n (manifest: EntryManifest): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(manifest.name),\n Option.map((name) =>\n pipe(\n publicEntriesOf({ manifest, join, packEntries: [] }),\n Arr.filter(({ source }) => dirname(source) === directory),\n Arr.map(({ label }) => Str.replace(ROOT_SUBPATH, name)(label)),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst ownSpecifiers = Effect.fn(\"ownSpecifiers\")(function* ownSpecifiers(\n context: Context,\n test: TestFile,\n) {\n const files = yield* RepositoryFiles;\n const owner = ownerOf(context.packages, test.name);\n if (Option.isNone(owner)) {\n return [];\n }\n const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));\n const join = (target: string): string => files.join(context.root, owner.value, target);\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(specifiersBeside({ join, dirname: files.dirname, directory: test.directory })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst refersToOwnDirectory = Effect.fn(\"refersToOwnDirectory\")(function* refersToOwnDirectory(\n context: Context,\n test: TestFile,\n source: string,\n) {\n if (namesSibling(source)) {\n return true;\n }\n const specifiers = groupsOf(source, MODULE_SPECIFIER, SPECIFIER_GROUP);\n if (Arr.isReadonlyArrayEmpty(specifiers)) {\n return false;\n }\n const own = yield* ownSpecifiers(context, test);\n return pipe(\n specifiers,\n Arr.some((specifier) => pipe(own, Arr.contains(specifier))),\n );\n});\n\nconst refersIn = Effect.fn(\"refersIn\")(function* refersIn(context: Context, test: TestFile) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(test.file);\n if (Option.isNone(source)) {\n return true;\n }\n return yield* refersToOwnDirectory(context, test, source.value);\n});\n\nconst inSeparateTestDirectory = (name: string): boolean =>\n SEPARATE_TEST_DIRECTORY.test(name) || (SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name));\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(context: Context, test: TestFile) {\n if (inSeparateTestDirectory(test.name)) {\n return Option.some(problemFor(test, DIRECTORY_MESSAGE));\n }\n if (!TEST_FILE.test(test.name)) {\n return Option.none<Problem>();\n }\n const refers = yield* refersIn(context, test);\n if (refers) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(test, SIBLING_MESSAGE));\n});\n\n/** @internal */\nexport const checkColocatedTests = Effect.fn(\"checkColocatedTests\")(function* checkColocatedTests(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n const names = pipe(listed, Arr.filter(Str.isNonEmpty));\n const context: Context = {\n root,\n packages: pipe(\n names,\n Arr.filter((name) => files.basename(name) === MANIFEST_FILE),\n Arr.map(Str.replace(MANIFEST_NAME, \"\")),\n ),\n };\n const tests = pipe(\n names,\n Arr.filter((name) => SCRIPT.test(name)),\n Arr.map((name): TestFile => {\n const file = files.join(root, name);\n return { name, base: files.basename(name), file, directory: files.dirname(file) };\n }),\n );\n const found = yield* Effect.forEach(tests, (test) => problemIn(context, test), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst AGENT_DOC = /(?:^|\\/)(?:AGENTS|CLAUDE)\\.md$/u;\nconst READ_CONCURRENCY = 16;\n\nexport const agentDocProblems = Effect.fn(\"agentDocProblems\")(function* agentDocProblems(\n root: string,\n problemIn: (file: string) => (source: string) => Option.Option<Problem>,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const docs = pipe(\n listed,\n Arr.filter((name) => AGENT_DOC.test(name)),\n );\n const found = yield* Effect.forEach(\n docs,\n (name) => {\n const file = files.join(root, name);\n const problemOf = Option.flatMap(problemIn(file));\n return files.readFile(file).pipe(Effect.map(problemOf));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n});\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport { agentDocProblems } from \"#/shared/lib/agent-docs.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nconst RECOMMENDED_LINES = 200;\nconst FIRST = 1;\nconst RULE: RuleName = \"agent-docs-length\";\n\nconst lineCount = (source: string): number => pipe(Str.trimEnd(source), Str.split(\"\\n\")).length;\n\nconst problemFor =\n (file: string) =>\n (lines: number): Option.Option<Problem> => {\n if (lines <= RECOMMENDED_LINES) {\n return Option.none();\n }\n return Option.some({\n file,\n line: RECOMMENDED_LINES + FIRST,\n column: FIRST,\n rule: RULE,\n 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.`,\n });\n };\n\n/** @internal */\nexport const checkAgentDocsLength = (root: string): ReturnType<typeof agentDocProblems> =>\n agentDocProblems(root, (file) => (source) => problemFor(file)(lineCount(source)));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"claude-md-link\";\nconst CLAUDE = \"CLAUDE.md\";\nconst AGENTS = \"AGENTS.md\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\nconst MESSAGE = \"CLAUDE.md must be a symbolic link to AGENTS.md\";\n\n/** @internal */\nexport const checkClaudeLinks = Effect.fn(\"checkClaudeLinks\")(function* checkClaudeLinks(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const [listed, links] = yield* Effect.all([files.listedFiles(root), files.linkedFiles(root)], {\n concurrency: \"unbounded\",\n });\n const problemOf = Effect.fn(\"problemOf\")(function* problemOf(name: string) {\n const file = files.join(root, name);\n const target = yield* files.readLink(file);\n const isLink = pipe(links, Arr.contains(name));\n const pointsElsewhere = pipe(\n target,\n Option.exists((value) => value !== AGENTS),\n );\n return pipe(\n Option.liftPredicate(file, () => !isLink || pointsElsewhere),\n Option.map((path): Problem => ({\n file: path,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n })),\n );\n });\n const claude = pipe(\n listed,\n Arr.filter((name) => files.basename(name) === CLAUDE),\n );\n const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"dangling-link\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\n\nconst holds =\n (target: string) =>\n (name: string): boolean =>\n name === target || Str.startsWith(`${target}${SEPARATOR}`)(name);\n\n/** @internal */\nexport const checkDanglingLinks = Effect.fn(\"checkDanglingLinks\")(function* checkDanglingLinks(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const [links, listed] = yield* Effect.all([files.linkedFiles(root), files.listedFiles(root)], {\n concurrency: \"unbounded\",\n });\n const problemOf = Effect.fn(\"problemOf\")(function* problemOf(name: string) {\n const file = files.join(root, name);\n const link = yield* files.readLink(file);\n return pipe(\n link,\n Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))),\n Option.filter((target) => !pipe(listed, Arr.some(holds(target)))),\n Option.map((target): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n 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.`,\n })),\n );\n });\n const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst ROOT_WORKSPACE = \".\";\nconst FIRST = 1;\nconst SEPARATOR = \"/\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n \":(exclude,attr:linguist-documentation)\",\n];\n\nexport const memberWorkspaces = Effect.fn(\"memberWorkspaces\")(function* memberWorkspaces(\n root: string,\n) {\n const declared = yield* workspaceDirectories(root);\n return pipe(\n declared,\n Arr.filter((workspace) => workspace !== ROOT_WORKSPACE),\n );\n});\n\nexport const memberSources = Effect.fn(\"memberSources\")(function* memberSources(root: string) {\n const files = yield* RepositoryFiles;\n const workspaces = yield* memberWorkspaces(root);\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n return { workspaces, listed };\n});\n\nexport interface Owned {\n readonly workspace: string;\n readonly inner: string;\n}\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nexport const fileProblem = ({\n file,\n rule,\n message,\n}: Readonly<{ file: string; rule: RuleName; message: string }>): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule,\n message,\n});\n\nexport const ownerOf =\n (workspaces: readonly string[]) =>\n (name: string): Option.Option<Owned> =>\n pipe(\n workspaces,\n Arr.filter((workspace) => Str.startsWith(`${workspace}${SEPARATOR}`)(name)),\n (owners) => Arr.last(Arr.sort(owners, byLength)),\n Option.map((workspace) => ({\n workspace,\n inner: Str.slice(workspace.length + SEPARATOR.length)(name),\n })),\n );\n","import { Effect, Option, Result, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { fileProblem } from \"./member-sources.ts\";\n\nconst README_FILE = \"README.md\";\n\ninterface Readme {\n readonly file: string;\n readonly source: string;\n}\n\nexport const readReadme = Effect.fn(\"readReadme\")(function* readReadme({\n root,\n directory,\n rule,\n missingMessage,\n}: Readonly<{ root: string; directory: string; rule: RuleName; missingMessage: string }>) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, README_FILE);\n const text = yield* files.readFile(file);\n return pipe(\n text,\n Option.match({\n onNone: (): Result.Result<Readme, Problem> =>\n Result.fail(fileProblem({ file, rule, message: missingMessage })),\n onSome: (source): Result.Result<Readme, Problem> => Result.succeed({ file, source }),\n }),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Result, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport {\n KeySchema,\n childrenOf,\n keyName,\n owningWorkspace,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { fileProblem } from \"./member-sources.ts\";\nimport { readReadme } from \"./readme-file.ts\";\n\nconst RULE: RuleName = \"deployed-readme\";\nconst ROOT_DIRECTORY = \"\";\nconst READ_CONCURRENCY = 16;\nconst MISSING_MESSAGE =\n \"is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.\";\nconst NO_URL_MESSAGE =\n \"has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.\";\nconst ADDRESS_KEYS = [\"domain\", \"domains\", \"routes\", \"hostname\"];\nconst URL_KEY = \"url\";\nconst STACK_FILE = /(?:^|\\/)alchemy\\.(?![^/]*\\.test\\.)[^/]+\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst URL_PATTERN = /https:\\/\\/[^\\s)>\\]]+/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\n\nconst propertyNamed =\n (names: readonly string[]) =>\n (node: unknown): boolean =>\n Predicate.isReadonlyObject(node) &&\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => Arr.contains(names, keyName(key))),\n );\n\nconst isAddressProperty = propertyNamed(ADDRESS_KEYS);\nconst isUrlProperty = propertyNamed([URL_KEY]);\n\nconst ReturnedObject = Schema.Struct({\n type: Schema.Literal(\"ReturnStatement\"),\n argument: Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n});\n\nconst decodeReturnedObject = Schema.decodeUnknownOption(ReturnedObject);\n\nconst returnsUrl = (node: unknown): boolean =>\n pipe(\n decodeReturnedObject(node),\n Option.exists(({ argument }) => pipe(argument.properties, Arr.some(isUrlProperty))),\n );\n\nconst servesAddress = (node: unknown): boolean =>\n isAddressProperty(node) || returnsUrl(node) || pipe(childrenOf(node), Arr.some(servesAddress));\n\nconst deploysTo = Effect.fn(\"deploysTo\")(function* deploysTo(root: string, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value)) {\n return false;\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return servesAddress(parsed.program);\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, directory: string) {\n const readme = yield* readReadme({\n root,\n directory,\n rule: RULE,\n missingMessage: MISSING_MESSAGE,\n });\n return Result.match(readme, {\n onFailure: Option.some,\n onSuccess: ({ file, source }) =>\n pipe(\n Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)),\n Option.map(() => fileProblem({ file, rule: RULE, message: NO_URL_MESSAGE })),\n ),\n });\n});\n\n/** @internal */\nexport const checkDeployedReadme = Effect.fn(\"checkDeployedReadme\")(function* checkDeployedReadme(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const directories = yield* workspaceDirectories(root);\n const candidates = pipe(\n listed,\n Arr.filter((file) => STACK_FILE.test(file)),\n );\n const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), {\n concurrency: READ_CONCURRENCY,\n });\n const owners = pipe(\n deploying,\n Arr.map((file) =>\n pipe(\n owningWorkspace(directories)(files.dirname(file)),\n Option.getOrElse(() => ROOT_DIRECTORY),\n ),\n ),\n Arr.dedupe,\n );\n const found = yield* Effect.forEach(owners, (directory) => problemIn(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, HashSet, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst WORKSPACE_AGENT_DOC = \"AGENTS.md\";\nconst README = /^README(?:\\.[^/]+)?$/iu;\nconst MANIFEST = \"package.json\";\nconst MISSING_RULE: RuleName = \"workspace-agents-md\";\n\nconst RootConfig = Schema.Struct({\n msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }),\n});\n\nconst taggedError = Schema.TaggedError;\n\nclass RootConfigUnreadable extends taggedError<\n RootConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"RootConfigUnreadable\", { file: Schema.String }) {}\n\nconst isNested = (name: string): boolean => Str.includes(SEPARATOR)(name);\n\nconst problemFor = problemInFile(RULE);\n\nconst AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.\";\nconst WORKSPACE_AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.\";\nconst MISSING_MESSAGE =\n \"has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.\";\nconst README_MESSAGE =\n \"is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.\";\n\ninterface Allowed {\n readonly workspaces: HashSet.HashSet<string>;\n readonly workspaceAgentDocs: boolean;\n}\n\ninterface NestedDoc {\n readonly file: string;\n readonly base: string;\n readonly directory: string;\n}\n\nconst agentDocProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!allowed.workspaceAgentDocs) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));\n};\n\nconst readmeProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n};\n\ninterface Workspaces {\n readonly required: boolean;\n readonly directories: readonly string[];\n readonly present: HashSet.HashSet<string>;\n readonly join: (...parts: readonly string[]) => string;\n}\n\nconst missingProblems = ({\n required,\n directories,\n present,\n join,\n}: Workspaces): readonly Problem[] =>\n pipe(\n directories,\n Arr.filter(\n (directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC)),\n ),\n Arr.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST), MISSING_MESSAGE)),\n );\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n allowed: Allowed,\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const doc: NestedDoc = { file, base: files.basename(name), directory: files.dirname(file) };\n if (AGENT_DOCS.test(doc.base)) {\n return agentDocProblem(doc, allowed);\n }\n return readmeProblem(doc, allowed);\n});\n\nconst allowsWorkspaceAgentDocs = Effect.fn(\"allowsWorkspaceAgentDocs\")(\n function* allowsWorkspaceAgentDocs(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return false;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => RootConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(RootConfig)), Option.isSome);\n },\n);\n\n/** @internal */\nexport const checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);\n const directories = yield* workspaceDirectories(root);\n const allowed: Allowed = {\n workspaces: pipe(\n directories,\n Arr.map((directory) => files.join(root, directory)),\n HashSet.fromIterable,\n ),\n workspaceAgentDocs,\n };\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, allowed, name), {\n concurrency: READ_CONCURRENCY,\n });\n const missing = missingProblems({\n required: workspaceAgentDocs,\n directories: pipe(\n directories,\n Arr.map((directory) => files.join(root, directory)),\n ),\n present: pipe(\n names,\n Arr.map((name) => files.join(root, name)),\n HashSet.fromIterable,\n ),\n join: files.join,\n });\n return [...Arr.getSomes(found), ...missing];\n});\n","import { Array as Arr, Effect, Option, Result, pipe } from \"effect\";\n\nimport { publishedProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport { JAPANESE } from \"#/shared/config/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { readReadme } from \"./readme-file.ts\";\n\nconst RULE: RuleName = \"published-readme\";\nconst READ_CONCURRENCY = 16;\nconst MESSAGE =\n \"contains Japanese. This package is published to npm, so write its README in English.\";\nconst MISSING_MESSAGE =\n \"is missing. This package is published to npm, so give it an English README.md.\";\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n { directory }: WorkspaceProject,\n) {\n const readme = yield* readReadme({\n root,\n directory,\n rule: RULE,\n missingMessage: MISSING_MESSAGE,\n });\n return Result.match(readme, {\n onFailure: Option.some,\n onSuccess: ({ file, source }) =>\n pipe(\n Option.fromNullishOr(JAPANESE.exec(source)),\n Option.map((found): Problem => {\n const { line, column } = positionOf(source)(found.index);\n return { file, line, column, rule: RULE, message: MESSAGE };\n }),\n ),\n });\n});\n\n/** @internal */\nexport const checkPublishedReadme = Effect.fn(\"checkPublishedReadme\")(\n function* checkPublishedReadme(root: string) {\n const projects = yield* publishedProjects(root);\n const found = yield* Effect.forEach(projects, (project) => problemIn(root, project), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n },\n);\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { publishedProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"published-tests\";\nconst MANIFEST_FILE = \"package.json\";\nconst FILE_START = 1;\nconst TEST_FILE = /\\.test\\.[cm]?[jt]sx?$/u;\nconst MESSAGE =\n \"belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.\";\n\nconst testedIn =\n (listed: readonly string[]) =>\n (prefix: string): boolean =>\n pipe(\n listed,\n Arr.some((file) => Str.startsWith(prefix)(file) && TEST_FILE.test(file)),\n );\n\nconst problemFor = Effect.fn(\"problemFor\")(function* problemFor(\n root: string,\n listed: readonly string[],\n { directory }: WorkspaceProject,\n) {\n const files = yield* RepositoryFiles;\n const absolute = files.join(root, directory);\n const prefix = `${absolute}/`;\n if (testedIn(listed)(prefix)) {\n return Option.none<Problem>();\n }\n return Option.some<Problem>({\n file: files.join(absolute, MANIFEST_FILE),\n line: FILE_START,\n column: FILE_START,\n rule: RULE,\n message: MESSAGE,\n });\n});\n\n/** @internal */\nexport const checkPublishedTests = Effect.fn(\"checkPublishedTests\")(function* checkPublishedTests(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const projects = yield* publishedProjects(root);\n const listed = yield* files.listedFiles(root);\n const absolute = pipe(\n listed,\n Arr.map((file) => files.join(root, file)),\n );\n const found = yield* Effect.forEach(projects, (project) => problemFor(root, absolute, project), {\n concurrency: 1,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"root-docs\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst MARKDOWN = /\\.(?:md|mdx|markdown)$/iu;\nconst ALLOWED =\n /^(?:README(?:\\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\\.(?:md|mdx|markdown)$/iu;\nconst MESSAGE =\n \"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.\";\n\nconst isStrayRootDoc = (name: string): boolean =>\n !Str.includes(SEPARATOR)(name) && MARKDOWN.test(name) && !ALLOWED.test(name);\n\n/** @internal */\nexport const checkRootDocs = Effect.fn(\"checkRootDocs\")(function* checkRootDocs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.filter(isStrayRootDoc),\n Arr.map((name): Problem => ({\n file: files.join(root, name),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${name} ${MESSAGE}`,\n })),\n );\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { namedWorkspaces, patternOf } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-readme\";\nconst ROOT_DOC = /^(?:README(?:\\.[^/]+)?|AGENTS\\.md|CLAUDE\\.md)$/iu;\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst CHECK_POLICY = \"@r_masseater/msch\";\nconst MARKETPLACE = \".claude-plugin/marketplace.json\";\nconst RELATIVE = /^\\.\\//u;\nconst MarketplacePlugin = Schema.Struct({\n name: Schema.optional(Schema.String),\n source: Schema.Unknown,\n});\nconst Marketplace = Schema.fromJsonString(\n Schema.Struct({ plugins: Schema.Array(MarketplacePlugin) }),\n);\n\ninterface Plugins {\n readonly directories: readonly string[];\n readonly names: readonly string[];\n}\n\nconst NO_PLUGINS: Plugins = { directories: [], names: [] };\n\nconst isCheckPolicy = ({ packageName }: NamedWorkspace): boolean =>\n Option.contains(packageName, CHECK_POLICY);\n\nconst messageFor = (directory: string): string =>\n `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.`;\n\nconst pluginsOf = (plugins: readonly (typeof MarketplacePlugin.Type)[]): Plugins => {\n const directories = pipe(\n plugins,\n Arr.map(({ source }) => source),\n Arr.filter(Predicate.isString),\n Arr.map(Str.replace(RELATIVE, \"\")),\n );\n const segments = pipe(directories, Arr.map(baseName));\n const names = pipe(\n plugins,\n Arr.map(({ name }) => name),\n Arr.filter(Predicate.isString),\n Arr.appendAll(segments),\n Arr.dedupe,\n );\n return { directories, names };\n};\n\nconst marketplacePlugins = Effect.fn(\"marketplacePlugins\")(function* marketplacePlugins(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, MARKETPLACE));\n return pipe(\n text,\n Option.flatMap(Schema.decodeOption(Marketplace)),\n Option.map(({ plugins }) => pluginsOf(plugins)),\n Option.getOrElse(() => NO_PLUGINS),\n );\n});\n\nconst isPluginName =\n (plugins: Plugins) =>\n (name: string): boolean =>\n Arr.contains(plugins.names, name);\n\nconst ownNames = (plugins: Plugins, names: readonly string[]): readonly string[] => {\n const ownName = Predicate.not(isPluginName(plugins));\n return pipe(names, Arr.filter(ownName));\n};\n\nconst patternFor =\n (plugins: Plugins) =>\n ({ directory, names }: NamedWorkspace): RegExp =>\n patternOf(\n Option.match(\n Arr.findFirst(plugins.directories, (plugin) => plugin === directory),\n {\n onNone: () => ownNames(plugins, names),\n onSome: () => [directory],\n },\n ),\n );\n\nconst problemsIn =\n (file: string, source: string, plugins: Plugins) =>\n (workspace: NamedWorkspace): readonly Problem[] => {\n const message = messageFor(workspace.directory);\n const at = positionOf(source);\n const pattern = patternFor(plugins)(workspace);\n return pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((found) => problemAtPosition(RULE)(file, at(found.index ?? START), message)),\n );\n };\n\nconst problemsInReadme = Effect.fn(\"problemsInReadme\")(function* problemsInReadme(\n file: string,\n workspaces: readonly NamedWorkspace[],\n plugins: Plugins,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n return pipe(\n text,\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => pipe(workspaces, Arr.flatMap(problemsIn(file, source, plugins))),\n }),\n );\n});\n\n/** @internal */\nexport const checkRootReadme = Effect.fn(\"checkRootReadme\")(function* checkRootReadme(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const readmes = pipe(\n names,\n Arr.filter((name) => ROOT_DOC.test(name)),\n );\n const named = yield* namedWorkspaces(root);\n const workspaces = pipe(\n named,\n Arr.filter((workspace) => !isCheckPolicy(workspace)),\n );\n const plugins = yield* marketplacePlugins(root);\n const found = yield* Effect.forEach(\n readmes,\n (name) => problemsInReadme(files.join(root, name), workspaces, plugins),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkAgentDocsLength } from \"./agent-docs-length.ts\";\nimport { checkClaudeLinks } from \"./claude-link.ts\";\nimport { checkDanglingLinks } from \"./dangling-links.ts\";\nimport { checkDeployedReadme } from \"./deployed-readme.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkPublishedReadme } from \"./published-readme.ts\";\nimport { checkPublishedTests } from \"./published-tests.ts\";\nimport { checkRootDocs } from \"./root-docs.ts\";\nimport { checkRootReadme } from \"./root-readme.ts\";\n\n/** @internal */\nexport const checkDocPlacement = Effect.fn(\"checkDocPlacement\")(function* checkDocPlacement(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkNestedDocs(root),\n checkClaudeLinks(root),\n checkRootReadme(root),\n checkRootDocs(root),\n checkAgentDocsLength(root),\n checkDanglingLinks(root),\n checkPublishedReadme(root),\n checkDeployedReadme(root),\n checkPublishedTests(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { readManifest } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"docs-mirror\";\nconst DOC = /(?:^|\\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\\.md$/u;\nconst MIRROR_LIMIT = 3;\nconst READ_CONCURRENCY = 16;\n\ninterface Workspace {\n readonly directory: string;\n readonly names: readonly string[];\n}\n\ninterface Mention {\n readonly directory: string;\n readonly offset: number;\n}\n\nconst SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\nconst BEFORE = String.raw`(?<![\\w@/.-])`;\nconst AFTER = String.raw`(?![\\w@.-])`;\n\nconst patternOf = (name: string): RegExp =>\n new RegExp(`${BEFORE}${Str.replaceAll(SPECIAL, String.raw`\\$&`)(name)}${AFTER}`, \"u\");\n\nconst byOffset = Order.mapInput(Order.Number, (mention: Mention) => mention.offset);\n\nconst mentionOf =\n (source: string, directory: string) =>\n (name: string): readonly Mention[] =>\n pipe(\n Option.fromNullishOr(patternOf(name).exec(source)),\n Option.map(({ index }) => ({ directory, offset: index })),\n Option.toArray,\n );\n\nconst firstMention = (source: string, workspace: Workspace): Option.Option<Mention> => {\n const mentions = pipe(workspace.names, Arr.flatMap(mentionOf(source, workspace.directory)));\n return Arr.head(Arr.sort(mentions, byOffset));\n};\n\nconst ownerOf =\n (doc: string) =>\n (workspace: Workspace): boolean =>\n Str.startsWith(`${workspace.directory}/`)(doc);\n\nconst describe = (mentions: readonly Mention[]): string =>\n pipe(\n mentions,\n Arr.map(({ directory }) => `\\`${directory}\\``),\n Arr.join(\", \"),\n );\n\nconst problemFor = (\n file: string,\n source: string,\n mentions: readonly Mention[],\n): readonly Problem[] =>\n pipe(\n Arr.head(mentions),\n Option.filter(() => mentions.length >= MIRROR_LIMIT),\n Option.map(({ offset }): Problem => {\n const { line, column } = positionOf(source)(offset);\n return {\n file,\n line,\n column,\n rule: RULE,\n message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`,\n };\n }),\n Option.toArray,\n );\n\nconst othersIn = (doc: string, workspaces: readonly Workspace[]): readonly Workspace[] =>\n pipe(\n workspaces,\n Arr.filter((workspace) => !ownerOf(doc)(workspace)),\n );\n\nconst problemIn =\n (workspaces: readonly Workspace[]) =>\n (doc: string, file: string, source: string): readonly Problem[] => {\n const mentions = pipe(\n othersIn(doc, workspaces),\n Arr.flatMap((workspace) => Option.toArray(firstMention(source, workspace))),\n );\n return problemFor(file, source, Arr.sort(mentions, byOffset));\n };\n\nconst workspacesOf = Effect.fn(\"workspacesOf\")(function* workspacesOf(root: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(root);\n return yield* Effect.forEach(\n directories,\n (directory) =>\n readManifest(files.join(root, directory)).pipe(\n Effect.map((manifest): Workspace => ({\n directory,\n names: [\n directory,\n ...pipe(\n manifest,\n Option.flatMap(({ name }) => Option.fromUndefinedOr(name)),\n Option.toArray,\n ),\n ],\n })),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n});\n\n/** @internal */\nexport const checkDocsMirror = Effect.fn(\"checkDocsMirror\")(function* checkDocsMirror(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const workspaces = yield* workspacesOf(root);\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((name) => DOC.test(name)),\n ),\n (doc) => {\n const file = files.join(root, doc);\n return files.readFile(file).pipe(\n Effect.map((source) =>\n Option.match(source, {\n onNone: () => [],\n onSome: (text) => problemIn(workspaces)(doc, file, text),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"ignored-sources\";\nconst SOURCES = [\":(glob)**/src/**\", \":(exclude,glob)**/node_modules/**\"];\nconst FIRST = 1;\nconst MESSAGE =\n \"is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.\";\n\n/** @internal */\nexport const checkIgnoredSources = Effect.fn(\"checkIgnoredSources\")(function* checkIgnoredSources(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredFiles(root, SOURCES);\n return pipe(\n ignored,\n Arr.map((file): Problem => ({\n file: files.join(root, file),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n })),\n );\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, EntryManifestJson, publicEntriesOf } from \"#/entities/package/index.ts\";\nimport type { PublicEntry } from \"#/entities/package/index.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { fileProblem as problemAt, memberWorkspaces } from \"./member-sources.ts\";\n\nconst ENTRY_RULE: RuleName = \"public-entry\";\nconst PUBLIC_ENTRY =\n /^(?:bin\\/[^/]+|src\\/(?:app\\/[^/]+|(?:pages|widgets|features|entities)\\/[^/]+\\/index(?:\\.[a-z]+)*\\.tsx?|shared\\/[^/]+\\/index(?:\\.[a-z]+)*\\.tsx?|shared\\/(?:ui|lib)\\/.+))$/u;\n\nconst ENTRY_MESSAGE =\n \"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.\";\n\nconst decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);\n\nconst entryProblems = Effect.fn(\"entryProblems\")(function* entryProblems(\n root: string,\n workspace: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = files.join(root, workspace);\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const join = (target: string): string => files.join(directory, target);\n return pipe(\n text,\n Option.flatMap(decodeEntryManifest),\n Option.map((manifest) => publicEntriesOf({ manifest, join, packEntries: [] })),\n Option.getOrElse((): readonly PublicEntry[] => []),\n Arr.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))),\n Arr.map(({ label, source }) =>\n problemAt({ file: source, rule: ENTRY_RULE, message: `${label} ${ENTRY_MESSAGE}` }),\n ),\n );\n});\n\n/** @internal */\nexport const checkPublicEntries = Effect.fn(\"checkPublicEntries\")(function* checkPublicEntries(\n root: string,\n) {\n const workspaces = yield* memberWorkspaces(root);\n const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems(root, workspace), {\n concurrency: 1,\n });\n return Arr.flatten(entries);\n});\n","import { Array as Arr, Option, Order, String as Str, pipe } from \"effect\";\n\nexport const LAYERS: readonly string[] = [\n \"app\",\n \"pages\",\n \"widgets\",\n \"features\",\n \"entities\",\n \"shared\",\n];\nexport const SEPARATOR = \"/\";\nexport const SOURCE_DIRECTORY = \"src\";\nexport const RUST_FILE = /\\.rs$/u;\nexport const BINARY = /^src\\/bin\\/[^/]+\\.rs$/u;\nexport const SLICE_DEPTH = 2;\nexport const NEXT = 1;\n\nconst MANIFEST = /(?:^|\\/)Cargo\\.toml$/u;\nconst MODULE_INDEX = \"mod\";\nconst CRATE_ROOTS: readonly string[] = [\"src/lib.rs\", \"src/main.rs\"];\nconst OUTSIDE_ALLOWED = /^(?:build\\.rs|benches\\/.+)$/u;\nconst SEPARATE_TEST = /^tests\\/.+$/u;\nconst SLICED_LAYERS: readonly string[] = [\"pages\", \"widgets\", \"features\", \"entities\", \"shared\"];\nconst LAYER_DEPTH = 1;\nconst SOURCE_PREFIX = `${SOURCE_DIRECTORY}${SEPARATOR}`;\nconst ROOT_CRATE = \"\";\n\nexport interface RustSource {\n readonly crate: string;\n readonly inner: string;\n readonly file: string;\n}\n\nexport type Kind = \"root\" | \"layer\" | \"module\" | \"test\" | \"skipped\" | \"misplaced\";\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nexport const crateDirectories = (listed: readonly string[]): readonly string[] =>\n pipe(\n listed,\n Arr.filter((name) => MANIFEST.test(name)),\n Arr.map((name) => Str.replace(MANIFEST, \"\")(name)),\n );\n\nconst ownedBy = (crate: string, name: string): Omit<RustSource, \"file\"> => {\n if (crate === ROOT_CRATE) {\n return { crate, inner: name };\n }\n return { crate, inner: Str.slice(crate.length + SEPARATOR.length)(name) };\n};\n\nexport const crateOf =\n (crates: readonly string[]) =>\n (name: string): Option.Option<Omit<RustSource, \"file\">> =>\n pipe(\n crates,\n Arr.filter((crate) => crate === ROOT_CRATE || Str.startsWith(`${crate}${SEPARATOR}`)(name)),\n Arr.match({\n onEmpty: () => Option.none<string>(),\n onNonEmpty: (owners) => Option.some(Arr.max(owners, byLength)),\n }),\n Option.map((crate) => ownedBy(crate, name)),\n );\n\nexport const modulePathOf = (inner: string): readonly string[] => {\n const parts = Str.split(\n Str.replace(RUST_FILE, \"\")(Str.slice(SOURCE_PREFIX.length)(inner)),\n SEPARATOR,\n );\n if (Option.contains(Arr.last(parts), MODULE_INDEX)) {\n return Arr.dropRight(parts, NEXT);\n }\n return parts;\n};\n\nconst sourceKindOf = (inner: string): Kind => {\n const path = modulePathOf(inner);\n if (!Option.exists(Arr.head(path), (layer) => Arr.contains(LAYERS, layer))) {\n return \"misplaced\";\n }\n if (path.length === LAYER_DEPTH) {\n return \"layer\";\n }\n return \"module\";\n};\n\nexport const kindOf = (inner: string): Kind => {\n if (Arr.contains(CRATE_ROOTS, inner) || BINARY.test(inner)) {\n return \"root\";\n }\n if (SEPARATE_TEST.test(inner)) {\n return \"test\";\n }\n if (OUTSIDE_ALLOWED.test(inner)) {\n return \"skipped\";\n }\n if (!Str.startsWith(SOURCE_PREFIX)(inner)) {\n return \"misplaced\";\n }\n return sourceKindOf(inner);\n};\n\nexport const isSliceIndex = (modulePath: readonly string[]): boolean =>\n modulePath.length === SLICE_DEPTH &&\n Option.exists(Arr.head(modulePath), (layer) => Arr.contains(SLICED_LAYERS, layer));\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { SyntaxNode } from \"#/shared/lib/tree-sitter.ts\";\n\nexport interface RustItem {\n readonly kind: string;\n readonly name: Option.Option<string>;\n readonly inline: boolean;\n readonly visible: boolean;\n readonly line: number;\n readonly column: number;\n}\n\nexport interface RustFile {\n readonly items: readonly RustItem[];\n readonly replacesAllocator: boolean;\n}\n\nconst IGNORED_ITEMS: readonly string[] = [\"line_comment\", \"block_comment\"];\nconst NEXT = 1;\nconst ALLOCATOR = \"global_allocator\";\n\nconst field = (node: SyntaxNode, name: string): Option.Option<SyntaxNode> =>\n Option.fromNullishOr(node.childForFieldName(name));\n\nconst namedChildren = (node: SyntaxNode): readonly SyntaxNode[] =>\n pipe(\n node.namedChildren,\n Arr.flatMap((child) => Option.toArray(Option.fromNullishOr(child))),\n );\n\nconst itemOf = (node: SyntaxNode): RustItem => ({\n kind: node.type,\n name: Option.map(field(node, \"name\"), (name) => name.text),\n inline: Option.isSome(field(node, \"body\")),\n visible: Arr.some(namedChildren(node), (child) => child.type === \"visibility_modifier\"),\n line: node.startPosition.row + NEXT,\n column: node.startPosition.column + NEXT,\n});\n\nconst replacesAllocator = (root: SyntaxNode): boolean =>\n pipe(\n root.descendantsOfType(\"attribute\"),\n Arr.flatMap((node) => Option.toArray(Option.fromNullishOr(node))),\n Arr.some((attribute) =>\n Option.exists(Arr.head(namedChildren(attribute)), (name) => name.text === ALLOCATOR),\n ),\n );\n\nexport const readRustFile = (root: SyntaxNode): RustFile => ({\n items: pipe(\n namedChildren(root),\n Arr.filter((node) => !Arr.contains(IGNORED_ITEMS, node.type)),\n Arr.map(itemOf),\n ),\n replacesAllocator: replacesAllocator(root),\n});\n","","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport englishVerbs from \"./english-verbs.json\" with { type: \"json\" };\nimport { fileProblem, memberSources, ownerOf } from \"./member-sources.ts\";\nimport type { Owned } from \"./member-sources.ts\";\n\nconst SLICE_RULE: RuleName = \"feature-slice-name\";\nconst ENTRY_RULE: RuleName = \"deploy-entry-name\";\nconst SEGMENT_RULE: RuleName = \"slice-segment-name\";\nconst SEPARATOR = \"/\";\nconst NEXT = 1;\nconst WORD_SEPARATOR = \"-\";\nconst MINIMUM_WORDS = 2;\nconst FEATURES = \"src/features/\";\nconst SOURCE = \"src/\";\nconst SEGMENTS: ReadonlySet<string> = new Set([\"ui\", \"model\", \"api\", \"lib\", \"config\", \"@x\"]);\nconst DEPLOY_MARKER = /(?:^|[.-])entrypoints?(?=[.-]|$)|\\.worker(?=\\.)/iu;\nconst INDEX = /\\/index(?:\\.[a-z]+)*\\.[cm]?[jt]sx?$/u;\nconst SCRIPT = /\\.[cm]?[jt]sx?$/u;\nconst VERBS: ReadonlySet<string> = new Set(englishVerbs);\n\nconst SLICE_MESSAGE =\n \"is not named <verb>-<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check-layout, sync-manuscripts).\";\nconst SEGMENT_MESSAGE =\n \"is a folder in a slice that is not one of the segments ui, model, api, lib or config. Name the segment after its purpose and put the code in one of them; a segment that grows holds folders of its own.\";\nconst ENTRY_MESSAGE =\n \"is named after where it is deployed. Name it after what the code does; the Alchemy resource that deploys it decides which file is the entry.\";\n\nexport const isVerbObjectBy =\n (separator: string) =>\n (slice: string): boolean => {\n const words = Str.split(slice, separator);\n return (\n words.length >= MINIMUM_WORDS && Option.exists(Arr.head(words), (word) => VERBS.has(word))\n );\n };\n\nconst isVerbObject = isVerbObjectBy(WORD_SEPARATOR);\n\nconst misnamedSlice = ({ workspace, inner }: Owned): Option.Option<string> =>\n pipe(\n Option.liftPredicate(inner, (path) => Str.startsWith(FEATURES)(path) && SCRIPT.test(path)),\n Option.flatMap((path) => Arr.head(Str.split(Str.slice(FEATURES.length)(path), SEPARATOR))),\n Option.filter((slice) => !isVerbObject(slice)),\n Option.map((slice) => `${workspace}${SEPARATOR}${FEATURES}${slice}`),\n );\n\nconst SLICE_LAYERS: readonly string[] = [\"features\", \"entities\", \"widgets\", \"pages\"];\nconst SLICE_DEPTH = 3;\nconst GROUPED_SLICE_DEPTH = 4;\nconst SLICE_DEPTHS: readonly number[] = [SLICE_DEPTH, GROUPED_SLICE_DEPTH];\n\nconst pathPrefix = (parts: readonly string[], depth: number): string =>\n Arr.join(Arr.take(parts, depth), SEPARATOR);\n\nconst isInSliceLayer = (parts: readonly string[]): boolean => {\n const [source, layer] = parts;\n return `${source}${SEPARATOR}` === SOURCE && Arr.contains(SLICE_LAYERS, layer ?? \"\");\n};\n\nconst indexedSlice = (owned: Owned): Option.Option<string> => {\n const parts = Str.split(owned.inner, SEPARATOR);\n const depth = parts.length - NEXT;\n return pipe(\n Option.liftPredicate(\n depth,\n () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Arr.contains(SLICE_DEPTHS, depth),\n ),\n Option.map(() => `${owned.workspace}${SEPARATOR}${pathPrefix(parts, depth)}`),\n );\n};\n\nconst misnamedSegment =\n (slices: ReadonlySet<string>) =>\n ({ workspace, inner }: Owned): Option.Option<string> => {\n const parts = Str.split(inner, SEPARATOR);\n const insideSlice = (depth: number): boolean =>\n slices.has(`${workspace}${SEPARATOR}${pathPrefix(parts, depth)}`);\n const isSegmentFolder = (depth: number): boolean =>\n parts.length > depth + NEXT && SCRIPT.test(inner) && !SEGMENTS.has(parts[depth] ?? \"\");\n return pipe(\n SLICE_DEPTHS,\n Arr.findFirst(insideSlice),\n Option.filter(isSegmentFolder),\n Option.map((depth) => `${workspace}${SEPARATOR}${pathPrefix(parts, depth + NEXT)}`),\n );\n };\n\nconst deployNamed = ({ workspace, inner }: Owned): Option.Option<string> => {\n if (!Str.startsWith(SOURCE)(inner)) {\n return Option.none();\n }\n const segments = Str.split(inner, SEPARATOR);\n return pipe(\n Arr.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)),\n Option.map(\n (index) => `${workspace}${SEPARATOR}${Arr.join(Arr.take(segments, index + NEXT), SEPARATOR)}`,\n ),\n );\n};\n\n/** @internal */\nexport const checkSourceNames = Effect.fn(\"checkSourceNames\")(function* checkSourceNames(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const { workspaces, listed } = yield* memberSources(root);\n const owned = pipe(listed, Arr.map(ownerOf(workspaces)), Arr.getSomes);\n const slices: ReadonlySet<string> = new Set(pipe(owned, Arr.map(indexedSlice), Arr.getSomes));\n const report =\n (rule: RuleName, message: string) =>\n (found: readonly string[]): readonly Problem[] =>\n pipe(\n Arr.dedupe(found),\n Arr.map((name) => fileProblem({ file: files.join(root, name), rule, message })),\n );\n const misnamedSlices = pipe(owned, Arr.map(misnamedSlice), Arr.getSomes);\n const misnamedSegments = pipe(owned, Arr.map(misnamedSegment(slices)), Arr.getSomes);\n const deployNames = pipe(owned, Arr.map(deployNamed), Arr.getSomes);\n return [\n ...report(SLICE_RULE, SLICE_MESSAGE)(misnamedSlices),\n ...report(SEGMENT_RULE, SEGMENT_MESSAGE)(misnamedSegments),\n ...report(ENTRY_RULE, ENTRY_MESSAGE)(deployNames),\n ];\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Position, Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { Language } from \"#/shared/lib/tree-sitter.ts\";\n\nimport { fileProblem } from \"./member-sources.ts\";\nimport {\n BINARY,\n LAYERS,\n RUST_FILE,\n SLICE_DEPTH,\n SOURCE_DIRECTORY,\n crateDirectories,\n crateOf,\n isSliceIndex,\n kindOf,\n modulePathOf,\n} from \"./rust-layout.ts\";\nimport type { Kind, RustSource } from \"./rust-layout.ts\";\nimport { readRustFile } from \"./rust-syntax.ts\";\nimport type { RustFile, RustItem } from \"./rust-syntax.ts\";\nimport { isVerbObjectBy } from \"./source-names.ts\";\n\nconst LAYERED_RULE: RuleName = \"layered-source\";\nconst ENTRY_RULE: RuleName = \"public-entry\";\nconst TEST_RULE: RuleName = \"colocated-test\";\nconst SLICE_RULE: RuleName = \"feature-slice-name\";\nconst GRAMMAR = \"rust\";\nconst WORD_SEPARATOR = \"_\";\nconst FEATURES = \"features\";\nconst MAIN = \"main\";\nconst MAIN_FILE = \"src/main.rs\";\nconst ROOT_ITEMS: readonly string[] = [\n \"use_declaration\",\n \"attribute_item\",\n \"inner_attribute_item\",\n \"extern_crate_declaration\",\n];\nconst LAYER_ITEMS: readonly string[] = [\n \"use_declaration\",\n \"attribute_item\",\n \"inner_attribute_item\",\n];\nconst READ_CONCURRENCY = 64;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst NONE: readonly Problem[] = [];\n\nconst ROOT_MESSAGE =\n \"defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.\";\nconst LAYER_INDEX_MESSAGE =\n \"defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.\";\nconst ENTRY_MESSAGE =\n \"makes an inner module of a slice public. Declare it with plain mod and re-export what other slices use with pub use from the slice module.\";\nconst TEST_MESSAGE =\n \"sits in a separate test directory. Put the test next to the code it tests as a #[cfg(test)] module; only a test that replaces the global allocator needs its own binary in tests/.\";\nconst SLICE_MESSAGE =\n \"is not named <verb>_<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check_layout, sync_manuscripts).\";\n\nconst isFeatureName = isVerbObjectBy(WORD_SEPARATOR);\n\ntype Join = (...segments: readonly string[]) => string;\n\ninterface Read {\n readonly source: RustSource;\n readonly parsed: RustFile;\n}\n\nconst itemProblem =\n (file: string, rule: RuleName, message: string) =>\n (position: Readonly<Position>): Problem =>\n problemAtPosition(rule)(file, position, message);\n\nconst isRootItem =\n (inner: string) =>\n (item: RustItem): boolean => {\n if (Arr.contains(ROOT_ITEMS, item.kind)) {\n return true;\n }\n if (item.kind === \"mod_item\") {\n return !item.inline && Option.exists(item.name, (name) => Arr.contains(LAYERS, name));\n }\n return (\n item.kind === \"function_item\" &&\n (inner === MAIN_FILE || BINARY.test(inner)) &&\n Option.contains(item.name, MAIN)\n );\n };\n\nconst isLayerItem = (item: RustItem): boolean =>\n Arr.contains(LAYER_ITEMS, item.kind) || (item.kind === \"mod_item\" && !item.inline);\n\nconst entryProblems = (\n file: string,\n modulePath: readonly string[],\n parsed: RustFile,\n): readonly Problem[] => {\n if (!isSliceIndex(modulePath)) {\n return NONE;\n }\n return pipe(\n parsed.items,\n Arr.filter((item) => item.kind === \"mod_item\" && item.visible),\n Arr.map(itemProblem(file, ENTRY_RULE, ENTRY_MESSAGE)),\n );\n};\n\nconst moduleProblems = ({ source, parsed }: Read): readonly Problem[] =>\n entryProblems(source.file, modulePathOf(source.inner), parsed);\n\nconst testProblems = ({ source, parsed }: Read): readonly Problem[] => {\n if (parsed.replacesAllocator) {\n return NONE;\n }\n return [fileProblem({ file: source.file, rule: TEST_RULE, message: TEST_MESSAGE })];\n};\n\nconst strayItems = (\n { source, parsed }: Read,\n allowed: (item: RustItem) => boolean,\n message: string,\n): readonly Problem[] =>\n pipe(\n parsed.items,\n Arr.filter((item) => !allowed(item)),\n Arr.map(itemProblem(source.file, LAYERED_RULE, message)),\n );\n\nconst PROBLEMS: Readonly<Record<Kind, (read: Read) => readonly Problem[]>> = {\n root: (read) => strayItems(read, isRootItem(read.source.inner), ROOT_MESSAGE),\n layer: (read) => strayItems(read, isLayerItem, LAYER_INDEX_MESSAGE),\n test: testProblems,\n module: moduleProblems,\n skipped: () => NONE,\n misplaced: () => NONE,\n};\n\nconst problemsOf = (read: Read): readonly Problem[] => PROBLEMS[kindOf(read.source.inner)](read);\n\nconst misnamedSlice = (\n { crate, inner }: RustSource,\n root: string,\n join: Join,\n): Option.Option<string> => {\n const modulePath = modulePathOf(inner);\n return pipe(\n Option.liftPredicate(modulePath, (path) => path.length >= SLICE_DEPTH),\n Option.filter((path) => Option.contains(Arr.head(path), FEATURES)),\n Option.flatMap((path) => Arr.last(Arr.take(path, SLICE_DEPTH))),\n Option.filter((slice) => !isFeatureName(slice)),\n Option.map((slice) => join(root, crate, SOURCE_DIRECTORY, FEATURES, slice)),\n );\n};\n\nconst sliceNameProblems = (\n root: string,\n join: Join,\n sources: readonly RustSource[],\n): readonly Problem[] =>\n pipe(\n sources,\n Arr.filter(({ inner }) => kindOf(inner) === \"module\"),\n Arr.flatMap((source) => Option.toArray(misnamedSlice(source, root, join))),\n Arr.dedupe,\n Arr.map((file) => fileProblem({ file, rule: SLICE_RULE, message: SLICE_MESSAGE })),\n );\n\nconst parsedWith =\n (language: Language) =>\n (source: RustSource, text: string): Option.Option<Read> =>\n Option.map(readTree({ language, source: text, read: readRustFile }), (parsed) => ({\n source,\n parsed,\n }));\n\nconst isRead = ({ inner }: RustSource): boolean => {\n const kind = kindOf(inner);\n return kind !== \"misplaced\" && kind !== \"skipped\";\n};\n\nconst rustSources = Effect.fn(\"rustSources\")(function* rustSources(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n const owner = crateOf(crateDirectories(listed));\n return pipe(\n listed,\n Arr.filter((name) => RUST_FILE.test(name)),\n Arr.flatMap((name) =>\n Option.toArray(\n Option.map(owner(name), (owned) => ({ ...owned, file: files.join(root, name) })),\n ),\n ),\n );\n});\n\n/** @internal */\nexport const checkRustModules = Effect.fn(\"checkRustModules\")(function* checkRustModules(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const sources = yield* rustSources(root);\n if (!Arr.isReadonlyArrayNonEmpty(sources)) {\n return NONE;\n }\n const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);\n const parse = parsedWith(language);\n const read = yield* Effect.forEach(\n pipe(sources, Arr.filter(isRead)),\n (source) =>\n files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))),\n { concurrency: READ_CONCURRENCY },\n );\n return [\n ...sliceNameProblems(root, files.join, sources),\n ...Arr.flatMap(Arr.getSomes(read), problemsOf),\n ];\n});\n","import { Array as Arr, Effect, Option } from \"effect\";\n\nimport { shadcnUiOf } from \"#/entities/workspace/index.ts\";\nimport type { ShadcnUi } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"shadcn-ui-alias\";\nconst FIRST = 1;\n\nconst problemOf = (directory: string, { file, alias }: ShadcnUi): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `aliases.ui \"${alias}\" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a \"#/\" import, such as \"#/shared/ui\", and map \"#/*\" to \"./src/*\".`,\n});\n\n/** @internal */\nexport const shadcnAliasProblems = Effect.fn(\"shadcnAliasProblems\")(function* shadcnAliasProblems(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const found = yield* shadcnUiOf(root, directory);\n if (Option.isNone(found)) {\n return Arr.empty<Problem>();\n }\n const resolved = yield* Option.match(found.value.target, {\n onNone: () => Effect.succeed(false),\n onSome: (target) =>\n files\n .isDirectory(files.join(root, directory, target))\n .pipe(Effect.map(Option.getOrElse(() => false))),\n });\n if (resolved) {\n return Arr.empty<Problem>();\n }\n return [problemOf(directory, found.value)];\n});\n","import { Array as Arr, Effect, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { memberWorkspaces } from \"./member-sources.ts\";\nimport { shadcnAliasProblems } from \"./shadcn-ui-alias.ts\";\n\nconst ALIAS_RULE: RuleName = \"source-alias\";\nconst SOURCE_ALIAS = \"#/*\";\nconst SOURCE_TARGET = \"./src/*\";\nconst SOURCE_PREFIX = /^\\.\\/src(?:\\/|$)/u;\n\nconst 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.`;\n\nconst Manifest = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\nconst targetsOf = (target: unknown): readonly string[] => {\n if (Predicate.isString(target)) {\n return [target];\n }\n if (Predicate.isObject(target)) {\n return pipe(Rec.values(target), Arr.flatMap(targetsOf));\n }\n return [];\n};\n\nconst intoSource = ([key, target]: readonly [string, unknown]): boolean =>\n !(\n key === SOURCE_ALIAS &&\n pipe(\n targetsOf(target),\n Arr.every((path) => path === SOURCE_TARGET),\n )\n ) &&\n pipe(\n targetsOf(target),\n Arr.some((path) => SOURCE_PREFIX.test(path)),\n );\n\nconst aliasProblems = Effect.fn(\"aliasProblems\")(function* aliasProblems(\n root: string,\n workspace: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = files.join(root, workspace, MANIFEST_FILE);\n const text = yield* files.readFile(manifest);\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)),\n Option.map((imports): readonly (readonly [string, unknown])[] => Rec.toEntries(imports)),\n Option.getOrElse((): readonly (readonly [string, unknown])[] => Arr.empty()),\n Arr.filter(intoSource),\n Arr.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `\"${key}\" ${ALIAS_MESSAGE}`)),\n );\n});\n\n/** @internal */\nexport const checkSourceAliases = Effect.fn(\"checkSourceAliases\")(function* checkSourceAliases(\n root: string,\n) {\n const workspaces = yield* memberWorkspaces(root);\n const found = yield* Effect.forEach(\n workspaces,\n (workspace) =>\n Effect.all([aliasProblems(root, workspace), shadcnAliasProblems(root, workspace)], {\n concurrency: 1,\n }),\n { concurrency: 1 },\n );\n return pipe(found, Arr.flatten, Arr.flatten);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkColocatedGitPatterns } from \"./colocated-git-patterns.ts\";\nimport { checkColocatedTests } from \"./colocated-tests.ts\";\nimport { checkDocPlacement } from \"./doc-placement.ts\";\nimport { checkDocsMirror } from \"./docs-mirror.ts\";\nimport { checkIgnoredSources } from \"./ignored-sources.ts\";\nimport { checkPublicEntries } from \"./public-entries.ts\";\nimport { checkRustModules } from \"./rust-modules.ts\";\nimport { checkSourceAliases } from \"./source-aliases.ts\";\nimport { checkSourceNames } from \"./source-names.ts\";\n\n/** @internal */\nexport const checkPlacement = Effect.fn(\"checkPlacement\")(function* checkPlacement(root: string) {\n const found = yield* Effect.all(\n [\n checkDocPlacement(root),\n checkColocatedTests(root),\n checkPublicEntries(root),\n checkRustModules(root),\n checkSourceAliases(root),\n checkSourceNames(root),\n checkColocatedGitPatterns(root),\n checkIgnoredSources(root),\n checkDocsMirror(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, targetsIn } from \"#/entities/package/index.ts\";\nimport {\n nestedValues,\n RUN_TASKS,\n stringsIn,\n workspaceConfigOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { FoundString } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst OUTSIDE_BIN: RuleName = \"command-outside-bin\";\nconst UNRUN: RuleName = \"unrun-command\";\nconst SCRIPTS: RuleName = \"scripts-directory\";\nconst BIN = \"bin\";\nconst SCRIPTS_DIRECTORY = \"scripts\";\nconst WORKFLOW_DIRECTORY = \".github/\";\nconst SEPARATOR = \"/\";\nconst CURRENT = \"./\";\nconst READ_CONCURRENCY = 8;\nconst FIRST = 1;\nconst RUN_FILE =\n /(?:^|[\\s;&|(])(?:node|vpx|tsx|bun|deno)\\s+(?:-\\S+\\s+)*(?<file>[^\\s;&|)]+\\.[cm]?[jt]s)\\b/gu;\nconst COMMAND = /^bin\\/[^/]+\\.[cm]?ts$/u;\nconst NOT_COMMAND = /\\.(?:test|d|test\\.support)\\.[cm]?ts$/u;\n\nconst Manifest = Schema.Struct({\n bin: Schema.optional(Schema.Unknown),\n main: Schema.optional(Schema.Unknown),\n exports: Schema.optional(Schema.Unknown),\n});\n\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface CommandRun {\n readonly path: string;\n readonly start: number;\n}\n\ninterface Entries {\n readonly all: readonly string[];\n readonly bins: readonly string[];\n}\n\nconst NO_ENTRIES: Entries = { all: [], bins: [] };\n\nconst withoutCurrent = (path: string): string =>\n Str.replace(new RegExp(`^${CURRENT}`, \"u\"), \"\")(path);\n\nconst runsIn = ({ text, start }: FoundString): readonly CommandRun[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(RUN_FILE)(text)),\n Arr.flatMap((found) =>\n pipe(\n Option.fromUndefinedOr(found.groups),\n Option.flatMap(Rec.get(\"file\")),\n Option.map((path) => ({ path: withoutCurrent(path), start })),\n Option.toArray,\n ),\n ),\n );\n\nconst targetPaths = (held: unknown): readonly string[] =>\n pipe(targetsIn(held), Arr.map(withoutCurrent));\n\nconst entriesOf = (manifest: typeof Manifest.Type): Entries => {\n const bins = targetPaths(manifest.bin);\n return { all: [...bins, ...targetPaths(manifest.main), ...targetPaths(manifest.exports)], bins };\n};\n\nconst declaredEntries = Effect.fn(\"declaredEntries\")(function* declaredEntries(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(entriesOf),\n Option.getOrElse(() => NO_ENTRIES),\n );\n});\n\nconst isCommand = (path: string): boolean => COMMAND.test(path) && !NOT_COMMAND.test(path);\n\nconst commandFilesIn = Effect.fn(\"commandFilesIn\")(function* commandFilesIn(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(files.join(root, directory, BIN));\n return pipe(\n names,\n Arr.map((name) => `${BIN}${SEPARATOR}${name}`),\n Arr.filter(isCommand),\n );\n});\n\nconst workflowText = Effect.fn(\"workflowText\")(function* workflowText(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const workflows = pipe(listed, Arr.filter(Str.startsWith(WORKFLOW_DIRECTORY)));\n const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(Arr.getSomes(texts), Arr.join(\"\\n\"));\n});\n\nconst workspacePath = (directory: string, path: string): string =>\n pipe([directory, path], Arr.filter(Str.isNonEmpty), Arr.join(SEPARATOR));\n\ninterface OutsideInput {\n readonly file: string;\n readonly source: string;\n readonly runs: readonly CommandRun[];\n readonly entries: Entries;\n}\n\nconst outsideProblems = ({ file, source, runs, entries }: OutsideInput): readonly Problem[] =>\n pipe(\n runs,\n Arr.filter(({ path }) => !COMMAND.test(path) && !Arr.contains(entries.all, path)),\n Arr.map(({ path, start }): Problem => ({\n file,\n ...positionOf(source)(start),\n rule: OUTSIDE_BIN,\n message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`,\n })),\n );\n\nconst runsOf = (program: unknown): readonly CommandRun[] =>\n pipe(nestedValues(RUN_TASKS)(program), Arr.flatMap(stringsIn), Arr.flatMap(runsIn));\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n directory: string,\n workflows: string,\n) {\n const files = yield* RepositoryFiles;\n const config = yield* workspaceConfigOf(root, directory);\n const entries = yield* declaredEntries(root, directory);\n const commands = yield* commandFilesIn(root, directory);\n const runs = pipe(\n config,\n Option.map(({ program }) => runsOf(program)),\n Option.getOrElse((): readonly CommandRun[] => []),\n );\n const runPaths = pipe(\n runs,\n Arr.map(({ path }) => path),\n );\n const outside = pipe(\n config,\n Option.map(({ file, source }) => outsideProblems({ file, source, runs, entries })),\n Option.getOrElse((): readonly Problem[] => []),\n );\n const isRun = (path: string): boolean =>\n Arr.contains(runPaths, path) ||\n Arr.contains(entries.bins, path) ||\n Str.includes(workspacePath(directory, path))(workflows);\n const unrun = pipe(\n commands,\n Arr.filter((path) => !isRun(path)),\n Arr.map((path): Problem => ({\n file: files.join(root, directory, path),\n line: FIRST,\n column: FIRST,\n rule: UNRUN,\n message: `No task, package.json bin or workflow runs ${workspacePath(directory, path)}. Files in ${BIN}/ are entry points for fallow, so an unused one is never reported. Run it from a task or delete it.`,\n })),\n );\n return [...outside, ...unrun];\n});\n\nconst scriptsProblem = Effect.fn(\"scriptsProblem\")(function* scriptsProblem(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SCRIPTS_DIRECTORY);\n const isDirectory = yield* files.isDirectory(file);\n return pipe(\n isDirectory,\n Option.filter(Boolean),\n Option.map((): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: SCRIPTS,\n message: `${workspacePath(directory, SCRIPTS_DIRECTORY)} is a scripts directory. Put each command at ${BIN}/<name>.ts and the code that it shares in the package's own source, so that every workspace runs its commands the same way.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkCommandEntries = Effect.fn(\"checkCommandEntries\")(function* checkCommandEntries(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const all = [\"\", ...directories];\n const workflows = yield* workflowText(root);\n const found = yield* Effect.forEach(all, (directory) => problemsIn(root, directory, workflows), {\n concurrency: READ_CONCURRENCY,\n });\n const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return [...Arr.flatten(found), ...Arr.getSomes(scripts)];\n});\n","import { Array as Arr, Option, Order, String as Str, pipe } from \"effect\";\n\nexport interface PathMention {\n readonly field: string;\n readonly text: string;\n readonly candidates: readonly string[];\n readonly index: number;\n}\n\nconst START = 0;\nconst QUOTES = ['\"', \"'\"];\n\nconst firstIndex = (source: string, needles: readonly string[]): Option.Option<number> => {\n const found = pipe(\n needles,\n Arr.flatMap((needle) => Option.toArray(Str.indexOf(needle)(source))),\n );\n return Arr.head(Arr.sort(found, Order.Number));\n};\n\nconst quoted = (text: string): readonly string[] =>\n pipe(\n QUOTES,\n Arr.map((quote) => `${quote}${text}${quote}`),\n );\n\nexport const indexOfText =\n (source: string) =>\n (text: string): number =>\n pipe(\n firstIndex(source, quoted(text)),\n Option.orElse(() => firstIndex(source, [text])),\n Option.getOrElse(() => START),\n );\n","import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\n\nimport { indexOfText } from \"./path-mention.ts\";\nimport type { PathMention } from \"./path-mention.ts\";\n\nconst MEMBER_LISTS = [\"members\", \"exclude\", \"default-members\"];\nconst DEPENDENCY_TABLES = [\"dependencies\", \"dev-dependencies\", \"build-dependencies\"];\nconst WORKSPACE = \"workspace\";\nconst PATCH = \"patch\";\nconst PATCH_DEPTH = 2;\nconst WORKSPACE_DEPTH = 1;\nconst START = 0;\nconst WILDCARD = /[*?[]/u;\nconst KEY_SEPARATOR = \".\";\n\nconst decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));\nconst decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));\nconst decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));\n\ninterface NamedPath {\n readonly field: string;\n readonly target: string;\n}\n\nconst declaresPath = (trail: readonly string[]): boolean =>\n pipe(\n Arr.last(trail),\n Option.exists((name) => Arr.contains(DEPENDENCY_TABLES, name)),\n ) ||\n (trail.length === PATCH_DEPTH &&\n Arr.get(trail, START).pipe(Option.exists((name) => name === PATCH)));\n\nconst listsMembers = (trail: readonly string[], key: string): boolean =>\n trail.length === WORKSPACE_DEPTH &&\n Arr.get(trail, START).pipe(Option.exists((name) => name === WORKSPACE)) &&\n Arr.contains(MEMBER_LISTS, key);\n\nconst namedPaths = (\n trail: readonly string[],\n key: string,\n value: unknown,\n): readonly NamedPath[] => {\n const field = Arr.join([...trail, key], KEY_SEPARATOR);\n if (listsMembers(trail, key)) {\n return pipe(\n decodeStrings(value),\n Option.getOrElse((): readonly string[] => []),\n Arr.filter((member) => !WILDCARD.test(member)),\n Arr.map((member) => ({ field, target: member })),\n );\n }\n if (declaresPath(trail)) {\n return pipe(\n decodePath(value),\n Option.toArray,\n Arr.map(({ path }) => ({ field: `${field}${KEY_SEPARATOR}path`, target: path })),\n );\n }\n return [];\n};\n\nconst pathsIn =\n (trail: readonly string[]) =>\n (value: unknown): readonly NamedPath[] =>\n pipe(\n decodeTable(value),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, unknown])[] => []),\n Arr.flatMap(([key, child]) => [\n ...namedPaths(trail, key, child),\n ...pathsIn([...trail, key])(child),\n ]),\n );\n\n/** @internal */\nexport const cargoMentions = (source: string): readonly PathMention[] =>\n pipe(\n Option.liftThrowable(() => getStaticTOMLValue(parseTOML(source)))(),\n Option.toArray,\n Arr.flatMap(pathsIn([])),\n Arr.filter(({ target }) => Str.isNonEmpty(target)),\n Arr.map(({ field, target }) => ({\n field,\n text: target,\n candidates: [target],\n index: indexOfText(source)(target),\n })),\n );\n","import { Array as Arr, Effect, Option, String as Str } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst WILDCARD = /[*?[]/u;\nconst SEPARATOR = \"/\";\nconst FIRST = 0;\n\n/** @internal */\nexport const existsAt = Effect.fn(\"existsAt\")(function* existsAt(root: string, path: string) {\n const files = yield* RepositoryFiles;\n return yield* files.exists(files.join(root, path));\n});\n\n/** @internal */\nexport const isDirectoryAt = Effect.fn(\"isDirectoryAt\")(function* isDirectoryAt(\n root: string,\n path: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* files.isDirectory(files.join(root, path));\n return Option.getOrElse(directory, () => false);\n});\n\n/** @internal */\nexport const staticPrefix = (path: string): string => {\n const prefix = Arr.headNonEmpty(Str.split(path, WILDCARD));\n if (Str.endsWith(SEPARATOR)(prefix)) {\n return Str.slice(FIRST, -SEPARATOR.length)(prefix);\n }\n return prefix;\n};\n\n/** @internal */\nexport const isIgnored = Effect.fn(\"isIgnored\")(function* isIgnored(root: string, path: string) {\n const prefix = staticPrefix(path);\n if (Str.isEmpty(prefix)) {\n return false;\n }\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredPaths(root, [prefix, `${prefix}${SEPARATOR}`]);\n return Arr.isReadonlyArrayNonEmpty(ignored);\n});\n","import { Array as Arr, Effect, Option, Predicate, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { childrenOf, propertyValue, stringsIn } from \"#/entities/workspace/index.ts\";\nimport type { FoundString } from \"#/entities/workspace/index.ts\";\n\nimport type { PathMention } from \"./path-mention.ts\";\n\nconst WRAP_OFFSET = 1;\nconst WILDCARD = /[*?[{]/u;\nconst SEPARATOR = \"/\";\nconst RELATIVE = \".\";\nconst JSON_EXTENSION = \".json\";\n\nconst isObject = (node: unknown): boolean =>\n Predicate.isReadonlyObject(node) && node[\"type\"] === \"ObjectExpression\";\n\nconst firstObject = (node: unknown): Option.Option<unknown> => {\n if (isObject(node)) {\n return Option.some(node);\n }\n return pipe(childrenOf(node), Arr.findFirst(firstObject));\n};\n\nconst leadingDirectory = (pattern: string): string =>\n pipe(\n Str.split(pattern, SEPARATOR),\n Arr.takeWhile((segment) => !WILDCARD.test(segment)),\n Arr.join(SEPARATOR),\n );\n\nconst listed =\n (root: unknown) =>\n (\n name: string,\n candidatesOf: (text: string) => readonly string[],\n valuesOf: (value: unknown) => readonly FoundString[] = stringsIn,\n ): readonly PathMention[] =>\n pipe(\n propertyValue(name)(root),\n Option.toArray,\n Arr.flatMap(valuesOf),\n Arr.map(({ text, start }: FoundString): PathMention => ({\n field: name,\n text,\n candidates: candidatesOf(text),\n index: start - WRAP_OFFSET,\n })),\n Arr.filter(({ candidates }) => Arr.isReadonlyArrayNonEmpty(candidates)),\n );\n\nconst objectsIn = (node: unknown): readonly unknown[] => [\n ...Arr.filter([node], isObject),\n ...pipe(childrenOf(node), Arr.flatMap(objectsIn)),\n];\n\nconst referencedPaths = (references: unknown): readonly FoundString[] =>\n pipe(\n objectsIn(references),\n Arr.flatMap((reference) => Option.toArray(propertyValue(\"path\")(reference))),\n Arr.flatMap(stringsIn),\n );\n\nconst exactly = (text: string): readonly string[] => [text];\nconst relativeConfig = (text: string): readonly string[] => {\n if (Str.startsWith(RELATIVE)(text)) {\n return [text, `${text}${JSON_EXTENSION}`];\n }\n return [];\n};\nconst patternRoot = (text: string): readonly string[] =>\n pipe([leadingDirectory(text)], Arr.filter(Str.isNonEmpty));\n\n/** @internal */\nexport const tsconfigMentions = Effect.fn(\"tsconfigMentions\")(function* tsconfigMentions(\n file: string,\n source: string,\n) {\n const parsed = yield* Effect.promise(() => parse(`${file}.ts`, `(${source})`, { lang: \"ts\" }));\n const program: unknown = parsed.program;\n const root = firstObject(program);\n return pipe(\n root,\n Option.toArray,\n Arr.flatMap((object) =>\n Arr.flatten([\n listed(object)(\"references\", exactly, referencedPaths),\n listed(object)(\"extends\", relativeConfig),\n listed(object)(\"files\", exactly),\n listed(object)(\"include\", patternRoot),\n ]),\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { unmatchedWorkspacePatterns } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { cargoMentions } from \"./cargo-paths.ts\";\nimport { existsAt, isIgnored } from \"./path-existence.ts\";\nimport { indexOfText } from \"./path-mention.ts\";\nimport type { PathMention } from \"./path-mention.ts\";\nimport { tsconfigMentions } from \"./tsconfig-paths.ts\";\n\nconst RULE: RuleName = \"config-path\";\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst CARGO_MANIFEST = /(?:^|\\/)Cargo\\.toml$/u;\nconst TSCONFIG = /(?:^|\\/)tsconfig(?:\\.[\\w-]+)?\\.json$/u;\nconst OUTSIDE = \"..\";\nconst READ_CONCURRENCY = 8;\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n file: string,\n mention: PathMention,\n) {\n const files = yield* RepositoryFiles;\n const relatives = pipe(\n mention.candidates,\n Arr.map((candidate) => files.relative(root, files.resolve(files.dirname(file), candidate))),\n Arr.filter((relative) => !Str.startsWith(OUTSIDE)(relative)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(relatives)) {\n return false;\n }\n const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), {\n concurrency: READ_CONCURRENCY,\n });\n if (pipe(present, Arr.some(Boolean))) {\n return false;\n }\n const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), {\n concurrency: READ_CONCURRENCY,\n });\n return !pipe(ignored, Arr.some(Boolean));\n});\n\nconst byIndex = Order.mapInput(Order.Number, ({ index }: PathMention) => index);\n\nconst problemOf =\n (file: string, source: string) =>\n (mention: PathMention): Problem => ({\n file,\n ...positionOf(source)(mention.index),\n rule: RULE,\n message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`,\n });\n\nconst mentionsIn = Effect.fn(\"mentionsIn\")(function* mentionsIn(file: string, source: string) {\n if (CARGO_MANIFEST.test(file)) {\n return cargoMentions(source);\n }\n return yield* tsconfigMentions(file, source);\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const mentions = yield* mentionsIn(file, source.value);\n const missing = yield* Effect.filter(mentions, (mention) => isMissing(root, file, mention), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(Arr.sort(missing, byIndex), Arr.map(problemOf(file, source.value)));\n});\n\nconst unmatchedPatterns = Effect.fn(\"unmatchedPatterns\")(function* unmatchedPatterns(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, WORKSPACE_FILE);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const patterns = yield* unmatchedWorkspacePatterns(root);\n return pipe(\n patterns,\n Arr.map((pattern): Problem => ({\n file,\n ...positionOf(source.value)(indexOfText(source.value)(pattern)),\n rule: RULE,\n message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkConfigPaths = Effect.fn(\"checkConfigPaths\")(function* checkConfigPaths(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const owned = yield* files.ownedFiles(root);\n const configs = pipe(\n owned,\n Arr.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)),\n );\n const [found, patterns] = yield* Effect.all(\n [\n Effect.forEach(configs, (name) => problemsIn(root, name), { concurrency: READ_CONCURRENCY }),\n unmatchedPatterns(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return [...Arr.flatten(found), ...patterns];\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n cratesIn,\n hasVerifyTask,\n owningWorkspace,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Crate } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unverified-crate\";\nconst VERSION_RULE: RuleName = \"release-version\";\nconst MANIFEST_FILE = \"package.json\";\nconst APP_DIRECTORIES: readonly string[] = [\"\", \"src-tauri\"];\nconst CARGO_FILE = \"Cargo.toml\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));\n\nconst problemFor = (crate: Crate, message: string): Problem => ({\n file: crate.manifest,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `crate ${crate.name} ${message}, so vp run verify never checks it.`,\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n directories: readonly string[],\n crate: Crate,\n) {\n const files = yield* RepositoryFiles;\n const workspace = owningWorkspace(directories)(\n files.relative(root, files.dirname(crate.manifest)),\n );\n if (Option.isNone(workspace)) {\n return Option.some(problemFor(crate, \"is outside every workspace package\"));\n }\n const verified = yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE));\n if (verified) {\n return Option.none<Problem>();\n }\n return Option.some(\n problemFor(crate, `is in ${workspace.value}, whose ${CONFIG_FILE} has no verify task`),\n );\n});\n\nconst versionProblemIn = Effect.fn(\"versionProblemIn\")(function* versionProblemIn(\n root: string,\n directories: readonly string[],\n crate: Crate,\n) {\n const files = yield* RepositoryFiles;\n const directory = files.relative(root, files.dirname(crate.manifest));\n const workspace = pipe(\n directories,\n Arr.findFirst((candidate) =>\n pipe(\n APP_DIRECTORIES,\n Arr.map((inner) =>\n pipe([candidate, inner], Arr.filter(Str.isNonEmpty), Arr.join(SEPARATOR)),\n ),\n Arr.contains(directory),\n ),\n ),\n );\n if (Option.isNone(workspace)) {\n return Option.none<Problem>();\n }\n const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE));\n const version = pipe(\n text,\n Option.flatMap(Schema.decodeOption(PackageVersion)),\n Option.map((manifest) => manifest.version),\n );\n if (Option.isNone(version) || version.value === crate.version) {\n return Option.none<Problem>();\n }\n return Option.some<Problem>({\n file: crate.manifest,\n line: FIRST,\n column: FIRST,\n rule: VERSION_RULE,\n message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`,\n });\n});\n\n/** @internal */\nexport const checkCrates = Effect.fn(\"checkCrates\")(function* checkCrates(root: string) {\n const files = yield* RepositoryFiles;\n const cargo = yield* files.exists(files.join(root, CARGO_FILE));\n if (!cargo) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const crates = yield* cratesIn(root);\n const found = yield* Effect.forEach(\n crates,\n (crate) =>\n Effect.all(\n [problemIn(root, directories, crate), versionProblemIn(root, directories, crate)],\n {\n concurrency: \"unbounded\",\n },\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(Arr.flatten(found));\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport {\n childrenOf,\n deployEntries,\n keyName,\n KeySchema,\n stringsIn,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"deploy-entry-pattern\";\nconst FALLOW_KEYS = [\"entry\", \"entryPoints\", \"supportEntry\", \"dynamicallyLoaded\", \"alwaysUsed\"];\nconst VITE_KEYS = [\"files\"];\nconst FALLOW_CONFIG = /(?:^|\\/)(?:\\.fallowrc\\.jsonc?|fallow-plugin-[^/]+\\.jsonc?)$/u;\nconst VITE_CONFIG = /(?:^|\\/)vite\\.config\\.[cm]?ts$/u;\nconst BRACE_GROUP = /\\{(?<options>[^{}]*)\\}/u;\nconst OPTION_SEPARATOR = \",\";\nconst PAIR = 2;\nconst NEGATED = \"!\";\nconst ROOT_WORKSPACE = \".\";\nconst WRAP_OFFSET = 1;\nconst NO_OFFSET = 0;\nconst READ_CONCURRENCY = 8;\nconst MESSAGE =\n \"selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.\";\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\n\ninterface Pattern {\n readonly text: string;\n readonly start: number;\n}\n\ninterface ConfigKind {\n readonly keys: readonly string[];\n readonly offset: number;\n readonly sourceOf: (text: string) => string;\n readonly bases: (directory: string, workspaces: readonly string[]) => readonly string[];\n}\n\nconst FALLOW: ConfigKind = {\n keys: FALLOW_KEYS,\n offset: WRAP_OFFSET,\n sourceOf: (text) => `(${text})`,\n bases: (directory, workspaces) => [directory, ...workspaces],\n};\n\nconst VITE: ConfigKind = {\n keys: VITE_KEYS,\n offset: NO_OFFSET,\n sourceOf: (text) => text,\n bases: (directory) => [directory],\n};\n\nconst isPatternProperty =\n (keys: readonly string[]) =>\n (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => Arr.contains(keys, keyName(key))),\n );\n\nconst patternsIn =\n (keys: readonly string[]) =>\n (node: unknown): readonly Pattern[] => {\n if (Predicate.isReadonlyObject(node) && isPatternProperty(keys)(node)) {\n return stringsIn(node[\"value\"]);\n }\n return pipe(childrenOf(node), Arr.flatMap(patternsIn(keys)));\n };\n\nconst choicesOf = ([literal = \"\", options]: readonly string[]): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(options),\n Option.map(Str.split(OPTION_SEPARATOR)),\n Option.getOrElse((): readonly string[] => [\"\"]),\n Arr.map((option) => `${literal}${option}`),\n );\n\nconst combined = (chunks: readonly (readonly string[])[]): readonly string[] =>\n Arr.matchLeft(chunks, {\n onEmpty: (): readonly string[] => [\"\"],\n onNonEmpty: (head, tail) =>\n pipe(\n choicesOf(head),\n Arr.flatMap((choice) =>\n pipe(\n combined(tail),\n Arr.map((rest) => `${choice}${rest}`),\n ),\n ),\n ),\n });\n\nconst expanded = (pattern: string): readonly string[] =>\n combined(Arr.chunksOf(Str.split(pattern, BRACE_GROUP), PAIR));\n\ninterface Selection {\n readonly root: string;\n readonly bases: readonly string[];\n readonly entries: readonly string[];\n}\n\nconst selectsOnlyDeployEntries = Effect.fn(\"selectsOnlyDeployEntries\")(\n function* selectsOnlyDeployEntries({ root, bases, entries }: Selection, pattern: Pattern) {\n const files = yield* RepositoryFiles;\n const pathspecs = pipe(\n bases,\n Arr.flatMap((base) =>\n pipe(\n expanded(pattern.text),\n Arr.map((spec) => `:(glob)${files.join(base, spec)}`),\n ),\n ),\n );\n const matched = yield* files.matchingFiles(root, pathspecs);\n const selects =\n Arr.isReadonlyArrayNonEmpty(matched) &&\n pipe(\n matched,\n Arr.every((file) => Arr.contains(entries, file)),\n );\n return Option.liftPredicate(pattern, () => selects);\n },\n);\n\ninterface ConfigRequest {\n readonly root: string;\n readonly file: string;\n readonly kind: ConfigKind;\n readonly workspaces: readonly string[];\n readonly entries: readonly string[];\n}\n\nconst patternsOf = Effect.fn(\"patternsOf\")(function* patternsOf(\n file: string,\n text: string,\n kind: ConfigKind,\n) {\n const parsed = yield* Effect.promise(() =>\n parse(`${file}.ts`, kind.sourceOf(text), { lang: \"ts\" }),\n );\n return pipe(\n patternsIn(kind.keys)(parsed.program),\n Arr.filter(({ text: pattern }) => !Str.startsWith(NEGATED)(pattern)),\n );\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(request: ConfigRequest) {\n const { root, file, kind, workspaces, entries } = request;\n const files = yield* RepositoryFiles;\n const path = files.join(root, file);\n const text = yield* files.readFile(path);\n if (Option.isNone(text)) {\n return [];\n }\n const patterns = yield* patternsOf(file, text.value, kind);\n const selection = { root, bases: kind.bases(files.dirname(file), workspaces), entries };\n const flagged = yield* Effect.forEach(\n patterns,\n (pattern) => selectsOnlyDeployEntries(selection, pattern),\n {\n concurrency: 1,\n },\n );\n return pipe(\n Arr.getSomes(flagged),\n Arr.map(({ text: pattern, start }): Problem => ({\n file: path,\n ...positionOf(text.value)(start - kind.offset),\n rule: RULE,\n message: `${pattern} ${MESSAGE}`,\n })),\n );\n});\n\n/** @internal */\nexport const checkDeployEntryPatterns = Effect.fn(\"checkDeployEntryPatterns\")(\n function* checkDeployEntryPatterns(root: string) {\n const files = yield* RepositoryFiles;\n const entries = yield* deployEntries(root);\n if (!Arr.isReadonlyArrayNonEmpty(entries)) {\n return [];\n }\n const listed = yield* files.listedFiles(root);\n const declared = yield* workspaceDirectories(root);\n const workspaces = pipe(\n declared,\n Arr.filter((workspace) => workspace !== ROOT_WORKSPACE),\n );\n const configs = pipe(\n listed,\n Arr.flatMap((file) => {\n if (FALLOW_CONFIG.test(file)) {\n return [{ file, kind: FALLOW }];\n }\n if (VITE_CONFIG.test(file)) {\n return [{ file, kind: VITE }];\n }\n return [];\n }),\n );\n const found = yield* Effect.forEach(\n configs,\n ({ file, kind }) => problemsIn({ root, file, kind, workspaces, entries }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport {\n childrenOf,\n keyName,\n KeySchema,\n stringsIn,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"listed-entry\";\nconst ENTRY_KEYS = [\"entry\", \"entryPoints\", \"supportEntry\"];\nconst FALLOW_CONFIG =\n /(?:^|\\/)(?:\\.fallowrc\\.jsonc?|fallow-plugin-[^/]+\\.jsonc?|\\.fallow\\/plugins\\/[^/]+\\.jsonc?)$/u;\nconst WILDCARD = /[*?{[]/u;\nconst SEPARATOR = \"/\";\nconst WRAP_OFFSET = 1;\nconst READ_CONCURRENCY = 8;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\n\ninterface Pattern {\n readonly text: string;\n readonly start: number;\n}\n\nconst isEntryProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => Arr.contains(ENTRY_KEYS, keyName(key))),\n );\n\nconst entryPatternsIn = (node: unknown): readonly Pattern[] => {\n if (Predicate.isReadonlyObject(node) && isEntryProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.map(({ text, start }) => ({ text, start: start - WRAP_OFFSET })),\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(entryPatternsIn));\n};\n\nconst namesOneFile =\n (directories: readonly string[]) =>\n ({ text }: Pattern): boolean =>\n pipe(\n directories,\n Arr.some((directory) => Str.startsWith(`${directory}${SEPARATOR}`)(text)),\n ) ||\n (Str.includes(SEPARATOR)(text) && !WILDCARD.test(text));\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n file: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const path = files.join(root, file);\n const text = yield* files.readFile(path);\n if (Option.isNone(text)) {\n return [];\n }\n const parsed = yield* Effect.promise(() =>\n parse(`${file}.ts`, `(${text.value})`, { lang: \"ts\" }),\n );\n return pipe(\n entryPatternsIn(parsed.program),\n Arr.filter(namesOneFile(directories)),\n Arr.map(({ text: pattern, start }): Problem => ({\n file: path,\n ...positionOf(text.value)(start),\n rule: RULE,\n message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkFallowEntries = Effect.fn(\"checkFallowEntries\")(function* checkFallowEntries(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((file) => FALLOW_CONFIG.test(file)),\n ),\n (file) => problemsIn(root, file, directories),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { stringsIn, workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { FoundString } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-workspace-path\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst PATH_CHARACTER = /[\\w.@/-]/u;\nconst NAME_CHARACTER = /[\\w.@-]/u;\nconst FIRST = 0;\nconst NEXT = 1;\n\nconst isBoundary = (character: string, allowed: RegExp): boolean =>\n character === \"\" || !allowed.test(character);\n\nconst mentions =\n (directory: string) =>\n (text: string): boolean => {\n const parts = Str.split(text, directory);\n return pipe(\n Arr.drop(parts, NEXT),\n Arr.some((after, index) => {\n const before = parts[index] ?? \"\";\n const previous = Str.slice(before.length - NEXT)(before);\n const following = Str.slice(FIRST, NEXT)(after);\n return (\n isBoundary(previous, PATH_CHARACTER) &&\n (following === \"/\" || isBoundary(following, NAME_CHARACTER))\n );\n }),\n );\n };\n\nconst problemsIn =\n (file: string, source: string, directories: readonly string[]) =>\n (found: FoundString): readonly Problem[] =>\n pipe(\n directories,\n Arr.filter((directory) => mentions(directory)(found.text)),\n Arr.map((directory): Problem => ({\n file,\n ...positionOf(source)(found.start),\n rule: RULE,\n message: `${directory} is a workspace. The root ${CONFIG_FILE} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE}: msch.lint, msch.devDependencies or its verify task.`,\n })),\n );\n\n/** @internal */\nexport const checkRootWorkspacePaths = Effect.fn(\"checkRootWorkspacePaths\")(\n function* checkRootWorkspacePaths(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: \"ts\" }));\n return pipe(\n stringsIn(parsed.program),\n Arr.flatMap(problemsIn(file, source.value, directories)),\n );\n },\n);\n","import { Array as Arr, Effect, Option } from \"effect\";\n\nimport {\n workspaceConfigOf,\n workspaceDirectories,\n VERIFY_TASK,\n definesTask,\n hasVerifyTask,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nconst RULE: RuleName = \"hidden-verify\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, directory: string) {\n const config = yield* workspaceConfigOf(root, directory);\n if (Option.isNone(config)) {\n return Option.none<Problem>();\n }\n const { file, program } = config.value;\n if (definesTask(VERIFY_TASK)(program)) {\n return Option.none<Problem>();\n }\n const verified = yield* hasVerifyTask(file);\n return Option.some<Problem>({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${directory} gets its verify task from code outside ${CONFIG_FILE}. The root verify reads ${CONFIG_FILE} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE}.`,\n }).pipe(Option.filter(() => verified));\n});\n\n/** @internal */\nexport const checkHiddenVerify = Effect.fn(\"checkHiddenVerify\")(function* checkHiddenVerify(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(directories, (directory) => problemIn(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n keyName,\n literalOf,\n runTasksOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RunTask } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"shared-uncached-task\";\nconst READ_CONCURRENCY = 8;\nconst SHARED = 2;\nconst OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\\//u;\n\nconst UncachedTask = Schema.Struct({\n cache: Schema.Literal(false),\n command: Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]),\n});\n\nconst decodeUncachedTask = Schema.decodeUnknownOption(UncachedTask);\nconst encodeDefinition = Schema.encodeOption(Schema.fromJsonString(Schema.Unknown));\n\ninterface UncachedDefinition {\n readonly directory: string;\n readonly file: string;\n readonly position: Pick<Problem, \"line\" | \"column\">;\n readonly name: string;\n readonly command: string;\n readonly definition: string;\n}\n\nconst commandText = (command: typeof UncachedTask.Type.command): string =>\n Arr.join(Arr.ensure(command), \" && \");\n\nconst runsOwnProgram = (command: string): boolean =>\n pipe(\n Str.trim(command),\n Str.split(/\\s+/u),\n Arr.head,\n Option.exists((program) => OWN_PROGRAM.test(program)),\n );\n\ninterface ConfigFile {\n readonly directory: string;\n readonly file: string;\n readonly source: string;\n}\n\nconst definitionOf =\n ({ directory, file, source }: ConfigFile) =>\n (task: RunTask): Option.Option<UncachedDefinition> =>\n Option.gen(function* uncachedDefinition() {\n const literal = yield* literalOf(task.value);\n const { command } = yield* decodeUncachedTask(literal);\n const text = commandText(command);\n if (runsOwnProgram(text)) {\n return yield* Option.none();\n }\n const definition = yield* encodeDefinition(literal);\n return {\n directory,\n file,\n position: positionOf(source)(task.start),\n name: keyName(task.key),\n command: text,\n definition,\n };\n });\n\nconst definitionsIn = Effect.fn(\"definitionsIn\")(function* definitionsIn(\n root: string,\n directory: string,\n) {\n const found = yield* runTasksOf(root, directory);\n if (Option.isNone(found)) {\n return [];\n }\n const { file, source, tasks } = found.value;\n return pipe(\n tasks,\n Arr.flatMap((task) => Option.toArray(definitionOf({ directory, file, source })(task))),\n );\n});\n\nconst problemsOf = (definitions: readonly UncachedDefinition[]): readonly Problem[] => {\n const directories = pipe(\n definitions,\n Arr.map(({ directory }) => directory),\n Arr.dedupe,\n );\n if (directories.length < SHARED) {\n return [];\n }\n return pipe(\n definitions,\n Arr.map(({ file, position, name, command }): Problem => ({\n file,\n ...position,\n rule: RULE,\n message: `The uncached task ${name} (${command}) is written the same way in ${Arr.join(directories, \", \")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`,\n })),\n );\n};\n\n/** @internal */\nexport const checkSharedUncachedTasks = Effect.fn(\"checkSharedUncachedTasks\")(\n function* checkSharedUncachedTasks(root: string) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(\n directories,\n (directory) => definitionsIn(root, directory),\n { concurrency: READ_CONCURRENCY },\n );\n return pipe(\n Arr.flatten(found),\n Arr.groupBy(({ name, definition }) => `${name}\\u0000${definition}`),\n Rec.values,\n Arr.flatMap(problemsOf),\n );\n },\n);\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport {\n keyName,\n literalOf,\n propertyValue,\n runTasksOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RunTask, RunTasks } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"unlocked-task\";\nconst READ_CONCURRENCY = 8;\nconst READS_DEPENDENCIES = /^vp (?:test|pack|build)\\b/u;\n\nconst decodeCommand = Schema.decodeUnknownOption(\n Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]),\n);\n\nconst commandOf = (task: RunTask): Option.Option<string> =>\n pipe(\n propertyValue(\"command\")(task.value),\n Option.getOrElse(() => task.value),\n literalOf,\n Option.flatMap(decodeCommand),\n Option.flatMap((command) =>\n Arr.findFirst(Arr.ensure(command), (line) => READS_DEPENDENCIES.test(line)),\n ),\n );\n\nconst tracksLockfiles = (task: RunTask): boolean =>\n pipe(\n propertyValue(\"cache\")(task.value),\n Option.flatMap(literalOf),\n Option.match({\n onNone: () => Option.isNone(propertyValue(\"cache\")(task.value)),\n onSome: (cache) => cache !== false,\n }),\n );\n\nconst problemsOf = ({ file, source, tasks }: RunTasks): readonly Problem[] =>\n pipe(\n tasks,\n Arr.filter(tracksLockfiles),\n Arr.flatMap((task) =>\n pipe(\n commandOf(task),\n Option.map((command): Problem => ({\n file,\n ...positionOf(source)(task.start),\n rule: RULE,\n message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`,\n })),\n Option.toArray,\n ),\n ),\n );\n\n/** @internal */\nexport const checkUnlockedTasks = Effect.fn(\"checkUnlockedTasks\")(function* checkUnlockedTasks(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(Arr.getSomes(found), Arr.flatMap(problemsOf));\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkHiddenVerify } from \"./hidden-verify.ts\";\nimport { checkSharedUncachedTasks } from \"./shared-uncached-tasks.ts\";\nimport { checkUnlockedTasks } from \"./unlocked-tasks.ts\";\n\n/** @internal */\nexport const checkTasks = Effect.fn(\"checkTasks\")(function* checkTasks(root: string) {\n const found = yield* Effect.all(\n [checkHiddenVerify(root), checkSharedUncachedTasks(root), checkUnlockedTasks(root)],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, isSeq, parseDocument, visit } from \"yaml\";\nimport type { Pair, Scalar, YAMLMap, YAMLSeq } from \"yaml\";\n\nconst MISSING_OFFSET = 0;\n\n/** @internal */\nexport interface Located {\n readonly text: string;\n readonly offset: number;\n}\n\n/** @internal */\nexport type Entry = readonly [string, unknown];\n\ntype Ranged = Scalar | YAMLMap | YAMLSeq;\n\nconst isRanged = (node: unknown): node is Ranged => isScalar(node) || isMap(node) || isSeq(node);\n\n/** @internal */\nexport const isText = (node: unknown): node is Scalar<string> =>\n isScalar(node) && typeof node.value === \"string\";\n\nconst isTextPair = (pair: unknown): pair is Pair<Scalar<string>> =>\n isPair(pair) && isText(pair.key);\n\nconst offsetOf = (node: unknown): number =>\n pipe(\n Option.liftPredicate(node, isRanged),\n Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)),\n Option.map(([start]) => start),\n Option.getOrElse(() => MISSING_OFFSET),\n );\n\n/** @internal */\nexport const stringOf = (node: unknown): Option.Option<Located> =>\n pipe(\n Option.liftPredicate(node, isText),\n Option.map((scalar) => ({ text: scalar.value, offset: offsetOf(scalar) })),\n );\n\n/** @internal */\nexport const childOf =\n (key: string) =>\n (node: unknown): unknown =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): unknown => map.get(key, true)),\n Option.getOrUndefined,\n );\n\n/** @internal */\nexport const workingDirectoryOf = (owner: unknown): Option.Option<Located> => {\n const run = childOf(\"run\")(childOf(\"defaults\")(owner));\n return stringOf(childOf(\"working-directory\")(run));\n};\n\n/** @internal */\nexport const itemsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isSeq),\n Option.map((seq): readonly unknown[] => seq.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\nconst pairsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): readonly unknown[] => map.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\n/** @internal */\nexport const entriesOf = (node: unknown): readonly Entry[] =>\n pipe(\n pairsOf(node),\n Arr.filter(isTextPair),\n Arr.map((pair): Entry => [pair.key.value, pair.value]),\n );\n\n/** @internal */\nexport const scalarsIn = (source: string): readonly Located[] => {\n const found: Located[] = [];\n visit(parseDocument(source), {\n Scalar: (_key, node) => {\n found.push(...Option.toArray(stringOf(node)));\n },\n });\n return found;\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport { parseDocument } from \"yaml\";\n\nimport {\n childOf,\n entriesOf,\n itemsOf,\n scalarsIn,\n stringOf,\n workingDirectoryOf,\n} from \"./workflow-nodes.ts\";\nimport type { Entry, Located } from \"./workflow-nodes.ts\";\n\nconst ROOT = \".\";\nconst LOCAL = \"./\";\nconst NEGATION = \"!\";\nconst SEPARATOR = \"/\";\nconst LINE = \"\\n\";\nconst UNRESOLVED_MARKERS = [\"${{\", \"$\", \"{\"];\nconst ABSOLUTE_MARKERS = [\"/\", \"~\"];\nconst FILE_INPUT_SUFFIX = \"-file\";\nconst DEPENDENCY_PATH_INPUT = \"cache-dependency-path\";\nconst FILTER_KEYS = [\"paths\", \"paths-ignore\"];\nconst HASH_FILES = /hashFiles\\((?<arguments>[^)]*)\\)/gu;\nconst QUOTED = /'(?<path>[^']*)'/gu;\nconst SCRIPT = /^[\\w.@/-]+\\.(?:ts|mts|cts|sh)$/u;\nconst TOKEN_SEPARATOR = /[\\s;&|()<>\"'`=]+/u;\n\n/** @internal */\nexport const ACTION_DEFINITIONS: readonly string[] = [\"action.yml\", \"action.yaml\"];\n\n/** @internal */\nexport type ReferenceKind = \"glob\" | \"file\" | \"script\" | \"directory\" | \"action\";\n\n/** @internal */\nexport interface WorkflowReference {\n readonly kind: ReferenceKind;\n readonly field: string;\n readonly path: string;\n readonly offset: number;\n}\n\nconst containsAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.includes(marker)(path)),\n );\n\nconst startsWithAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.startsWith(marker)(path)),\n );\n\nconst isLiteralPath = (path: string): boolean =>\n Str.isNonEmpty(path) &&\n !containsAny(UNRESOLVED_MARKERS)(path) &&\n !startsWithAny(ABSOLUTE_MARKERS)(path);\n\nconst withoutLocal = (path: string): string => {\n if (Str.startsWith(LOCAL)(path)) {\n return Str.slice(LOCAL.length)(path);\n }\n return path;\n};\n\nconst joinPath = (base: string, path: string): string => {\n const relative = withoutLocal(Str.trim(path));\n if (base === ROOT) {\n return relative;\n }\n return `${base}${SEPARATOR}${relative}`;\n};\n\nconst reference =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n ({ text, offset }: Located): readonly WorkflowReference[] => {\n const path = Str.trim(text);\n if (!isLiteralPath(path) || !isLiteralPath(base)) {\n return [];\n }\n return [{ kind, field, path: joinPath(base, path), offset }];\n };\n\nconst isPositive = ({ text }: Located): boolean => !Str.startsWith(NEGATION)(Str.trim(text));\n\nconst globsIn = (field: string, node: unknown): readonly WorkflowReference[] =>\n pipe(\n itemsOf(node),\n Arr.flatMap((item) => Option.toArray(stringOf(item))),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", field)),\n );\n\nconst filtersOf = ([event, filters]: Entry): readonly WorkflowReference[] =>\n pipe(\n FILTER_KEYS,\n Arr.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))),\n );\n\nconst directoryOf = (located: Option.Option<Located>, base: string): string =>\n pipe(\n located,\n Option.map(({ text }) => joinPath(ROOT, text)),\n Option.getOrElse(() => base),\n );\n\nconst located =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n (found: Option.Option<Located>): readonly WorkflowReference[] =>\n pipe(found, Option.toArray, Arr.flatMap(reference(kind, field, base)));\n\nconst localUses = (node: unknown): Option.Option<Located> =>\n pipe(\n stringOf(childOf(\"uses\")(node)),\n Option.filter(({ text }) => Str.startsWith(LOCAL)(text)),\n );\n\nconst scriptsIn =\n (field: string, base: string) =>\n ({ text, offset }: Located): readonly WorkflowReference[] =>\n pipe(\n Str.split(text, TOKEN_SEPARATOR),\n Arr.filter((token) => SCRIPT.test(token)),\n Arr.dedupe,\n Arr.flatMap((token) => reference(\"script\", field, base)({ text: token, offset })),\n );\n\nconst isFileInput = ([key]: Entry): boolean =>\n Str.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;\n\nconst linesOf = ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Str.split(text, LINE),\n Arr.map((line) => ({ text: line, offset })),\n );\n\nconst fileInputOf =\n (field: string) =>\n ([key, value]: Entry): readonly WorkflowReference[] =>\n pipe(\n stringOf(value),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.flatMap(reference(\"glob\", `${field}.with.${key}`)),\n );\n\nconst fileInputsIn = (field: string, step: unknown): readonly WorkflowReference[] =>\n pipe(entriesOf(childOf(\"with\")(step)), Arr.filter(isFileInput), Arr.flatMap(fileInputOf(field)));\n\nconst stepReferences =\n (job: string, base: string) =>\n (step: unknown, index: number): readonly WorkflowReference[] => {\n const field = `jobs.${job}.steps[${index}]`;\n const own = stringOf(childOf(\"working-directory\")(step));\n const directory = directoryOf(own, base);\n return [\n ...located(\"action\", `${field}.uses`)(localUses(step)),\n ...located(\"directory\", `${field}.working-directory`)(own),\n ...pipe(\n stringOf(childOf(\"run\")(step)),\n Option.toArray,\n Arr.flatMap(scriptsIn(`${field}.run`, directory)),\n ),\n ...fileInputsIn(field, step),\n ];\n };\n\nconst jobReferences =\n (base: string) =>\n ([job, node]: Entry): readonly WorkflowReference[] => {\n const own = workingDirectoryOf(node);\n const steps = itemsOf(childOf(\"steps\")(node));\n const directory = directoryOf(own, base);\n return [\n ...located(\"file\", `jobs.${job}.uses`)(localUses(node)),\n ...located(\"directory\", `jobs.${job}.defaults.run.working-directory`)(own),\n ...pipe(steps, Arr.flatMap(stepReferences(job, directory))),\n ];\n };\n\nconst groupsOf =\n (pattern: RegExp, group: string) =>\n ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[group])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, offset })),\n );\n\nconst hashFilesIn = (source: string): readonly WorkflowReference[] =>\n pipe(\n scalarsIn(source),\n Arr.flatMap(groupsOf(HASH_FILES, \"arguments\")),\n Arr.flatMap(groupsOf(QUOTED, \"path\")),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", \"hashFiles\")),\n );\n\nconst jobsOf = (source: string): readonly Entry[] =>\n entriesOf(childOf(\"jobs\")(parseDocument(source).contents));\n\n/** @internal */\nexport const workflowReferences = (source: string): readonly WorkflowReference[] => {\n const root = parseDocument(source).contents;\n const workflowDefault = workingDirectoryOf(root);\n const base = directoryOf(workflowDefault, ROOT);\n return [\n ...pipe(entriesOf(childOf(\"on\")(root)), Arr.flatMap(filtersOf)),\n ...located(\"directory\", \"defaults.run.working-directory\")(workflowDefault),\n ...pipe(jobsOf(source), Arr.flatMap(jobReferences(base))),\n ...hashFilesIn(source),\n ];\n};\n\nconst pathInputOf = (step: unknown): unknown => childOf(\"path\")(childOf(\"with\")(step));\n\nconst outputPathsOf = (step: unknown): readonly string[] =>\n pipe(\n stringOf(pathInputOf(step)),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.map(({ text }) => joinPath(ROOT, text)),\n Arr.filter(isLiteralPath),\n );\n\n/** @internal */\nexport const producedPaths = (source: string): readonly string[] =>\n pipe(\n jobsOf(source),\n Arr.flatMap(([, job]) => itemsOf(childOf(\"steps\")(job))),\n Arr.flatMap(outputPathsOf),\n );\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { existsAt, isDirectoryAt, isIgnored, staticPrefix } from \"./path-existence.ts\";\nimport { ACTION_DEFINITIONS, producedPaths, workflowReferences } from \"./workflow-references.ts\";\nimport type { ReferenceKind, WorkflowReference } from \"./workflow-references.ts\";\n\nconst RULE: RuleName = \"workflow-path\";\nconst WORKFLOW_DIRECTORY = \".github/workflows/\";\nconst WORKFLOW_EXTENSIONS = [\".yml\", \".yaml\"];\nconst READ_CONCURRENCY = 8;\nconst SEPARATOR = \"/\";\n\nconst EXPECTED: Readonly<Record<ReferenceKind, string>> = {\n action: \"a directory with action.yml\",\n directory: \"a directory\",\n file: \"a file\",\n glob: \"a pattern that matches a tracked file\",\n script: \"a file\",\n};\n\ntype Resolver = (root: string, path: string) => Effect.Effect<boolean, never, RepositoryFiles>;\n\nconst isWorkflow = (file: string): boolean =>\n Str.startsWith(WORKFLOW_DIRECTORY)(file) &&\n pipe(\n WORKFLOW_EXTENSIONS,\n Arr.some((extension) => Str.endsWith(extension)(file)),\n );\n\nconst matchesAny = Effect.fn(\"matchesAny\")(function* matchesAny(\n root: string,\n pathspecs: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const matched = yield* files.matchingFiles(root, pathspecs);\n return Arr.isReadonlyArrayNonEmpty(matched);\n});\n\nconst matchesGlob: Resolver = (root, path) => matchesAny(root, [`:(glob)${path}`]);\n\nconst hasAction: Resolver = Effect.fn(\"hasAction\")(function* hasAction(root: string, path: string) {\n const found = yield* Effect.forEach(\n ACTION_DEFINITIONS,\n (name) => existsAt(root, `${path}${SEPARATOR}${name}`),\n {\n concurrency: 1,\n },\n );\n return pipe(found, Arr.some(Boolean));\n});\n\nconst suffixAt =\n (segments: readonly string[]) =>\n (index: number): string =>\n `:(glob)**/${pipe(segments, Arr.drop(index), Arr.join(SEPARATOR))}`;\n\nconst findsScript: Resolver = Effect.fn(\"findsScript\")(function* findsScript(\n root: string,\n path: string,\n) {\n if (yield* existsAt(root, path)) {\n return true;\n }\n const segments = Str.split(path, SEPARATOR);\n return yield* matchesAny(root, Arr.makeBy(segments.length, suffixAt(segments)));\n});\n\nconst RESOLVERS: Readonly<Record<ReferenceKind, Resolver>> = {\n action: hasAction,\n directory: isDirectoryAt,\n file: existsAt,\n glob: matchesGlob,\n script: findsScript,\n};\n\nconst overlaps =\n (path: string) =>\n (produced: string): boolean =>\n produced === path ||\n Str.startsWith(`${path}${SEPARATOR}`)(produced) ||\n Str.startsWith(`${produced}${SEPARATOR}`)(path);\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n produced: readonly string[],\n found: WorkflowReference,\n) {\n const prefix = staticPrefix(found.path);\n if (pipe(produced, Arr.some(overlaps(prefix)))) {\n return false;\n }\n if (yield* RESOLVERS[found.kind](root, found.path)) {\n return false;\n }\n return !(yield* isIgnored(root, found.path));\n});\n\nconst problemOf =\n (file: string, source: string) =>\n (found: WorkflowReference): Problem => ({\n file,\n ...positionOf(source)(found.offset),\n rule: RULE,\n message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`,\n });\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(root: string, workflow: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, workflow);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const produced = producedPaths(source.value);\n const missing = yield* Effect.filter(workflowReferences(source.value), (found) =>\n isMissing(root, produced, found),\n );\n return pipe(missing, Arr.map(problemOf(file, source.value)));\n});\n\n/** @internal */\nexport const checkWorkflowPaths = Effect.fn(\"checkWorkflowPaths\")(function* checkWorkflowPaths(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(listed, Arr.filter(isWorkflow)),\n (workflow) => problemsIn(root, workflow),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport { isMap, isPair, parseDocument } from \"yaml\";\n\nimport { namedWorkspaces, patternOf } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { childOf, entriesOf, scalarsIn, stringOf } from \"./workflow-nodes.ts\";\nimport type { Located } from \"./workflow-nodes.ts\";\nimport { workflowReferences } from \"./workflow-references.ts\";\n\nconst PATH_FILTER: RuleName = \"workflow-path-filter\";\nconst PACKAGE: RuleName = \"workflow-package\";\nconst WORKFLOW = /^\\.github\\/workflows\\/(?<name>[^/]+)\\.ya?ml$/u;\nconst ACTION = /^\\.github\\/actions\\/(?<name>[^/]+)\\/action\\.ya?ml$/u;\nconst FILTER_KEYS: readonly string[] = [\"paths\", \"paths-ignore\"];\nconst PATHS_FILTER_ACTION = /(?:^|\\/)paths-filter@/u;\nconst PACKAGE_FILTER =\n /(?:^|\\s)(?:--filter|-F)(?:\\s+|=)(?<quote>[\"']?)(?<value>[^\\s\"'$][^\\s\"']*)\\k<quote>/gu;\nconst START = 0;\nconst READ_CONCURRENCY = 8;\nconst SEPARATOR = \"/\";\nconst WORD_SEPARATORS = /[-_]/gu;\nconst SPACE = \" \";\n\nconst FILTER_MESSAGE =\n \"A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.\";\n\nconst packageMessage = (what: string, directory: string): string =>\n `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;\n\nconst keysOf = (node: unknown): readonly Located[] =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): readonly unknown[] => map.items),\n Option.getOrElse((): readonly unknown[] => []),\n Arr.filter(isPair),\n Arr.flatMap(({ key }) => Option.toArray(stringOf(key))),\n );\n\ntype Where = Readonly<{ file: string; source: string }>;\n\nconst problemAt =\n ({ file, source }: Where, rule: RuleName, message: string) =>\n (offset: number): Problem => ({\n file,\n ...positionOf(source)(offset),\n rule,\n message,\n });\n\nconst pathFiltersIn = (file: string, source: string): readonly Problem[] => {\n const root = parseDocument(source).contents;\n const triggers = pipe(\n entriesOf(childOf(\"on\")(root)),\n Arr.flatMap(([, trigger]) => keysOf(trigger)),\n Arr.filter(({ text }) => Arr.contains(FILTER_KEYS, text)),\n );\n const actions = pipe(\n scalarsIn(source),\n Arr.filter(({ text }) => PATHS_FILTER_ACTION.test(text)),\n );\n return pipe(\n [...triggers, ...actions],\n Arr.map(({ offset }) => problemAt({ file, source }, PATH_FILTER, FILTER_MESSAGE)(offset)),\n );\n};\n\nconst matching = (workspaces: readonly NamedWorkspace[], text: string): Option.Option<string> =>\n pipe(\n workspaces,\n Arr.findFirst(\n ({ names }) =>\n Arr.isReadonlyArrayNonEmpty(names) && Option.isSome(Str.match(patternOf(names))(text)),\n ),\n Option.map(({ directory }) => directory),\n );\n\nconst named = (workspaces: readonly NamedWorkspace[], text: string): Option.Option<string> =>\n Option.orElse(matching(workspaces, text), () =>\n matching(workspaces, Str.replaceAll(WORD_SEPARATORS, SPACE)(text)),\n );\n\nconst containing = (workspaces: readonly NamedWorkspace[], path: string): Option.Option<string> =>\n pipe(\n workspaces,\n Arr.findFirst(\n ({ directory }) => path === directory || Str.startsWith(`${directory}${SEPARATOR}`)(path),\n ),\n Option.map(({ directory }) => directory),\n );\n\nconst namesIn = (name: string, source: string): readonly Located[] => {\n const root = parseDocument(source).contents;\n return [\n { text: name, offset: START },\n ...Option.toArray(stringOf(childOf(\"name\")(root))),\n ...keysOf(childOf(\"jobs\")(root)),\n ];\n};\n\nconst filtersIn = (source: string): readonly Located[] =>\n pipe(\n scalarsIn(source),\n Arr.flatMap(({ text, offset }) =>\n pipe(\n Arr.fromIterable(Str.matchAll(PACKAGE_FILTER)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[\"value\"])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, offset })),\n ),\n ),\n );\n\nconst reported =\n (where: Where, offset: number, what: string) =>\n (found: Option.Option<string>): readonly Problem[] =>\n pipe(\n found,\n Option.map((directory) => problemAt(where, PACKAGE, packageMessage(what, directory))(offset)),\n Option.toArray,\n );\n\nconst packagesIn = (\n workspaces: readonly NamedWorkspace[],\n { file, name, source }: Readonly<{ file: string; name: string; source: string }>,\n): readonly Problem[] => {\n const where = { file, source };\n const fromNames = pipe(\n namesIn(name, source),\n Arr.flatMap(({ text, offset }) =>\n reported(where, offset, `\"${text}\"`)(named(workspaces, text)),\n ),\n );\n const referenced = pipe(\n workflowReferences(source),\n Arr.filter(({ field }) => !Str.startsWith(\"on.\")(field)),\n Arr.flatMap(({ field, path, offset }) =>\n reported(where, offset, field)(containing(workspaces, path)),\n ),\n );\n const filtered = pipe(\n filtersIn(source),\n Arr.flatMap(({ text, offset }) =>\n reported(where, offset, `--filter ${text}`)(matching(workspaces, text)),\n ),\n );\n return [...fromNames, ...referenced, ...filtered];\n};\n\nconst actionProblems = (\n workspaces: readonly NamedWorkspace[],\n file: string,\n name: string,\n): readonly Problem[] =>\n pipe(\n named(workspaces, name),\n Option.map((directory): Problem => ({\n file,\n line: 1,\n column: 1,\n rule: PACKAGE,\n message: packageMessage(`The action ${name}`, directory),\n })),\n Option.toArray,\n );\n\n/** @internal */\nexport const checkWorkflowScale = Effect.fn(\"checkWorkflowScale\")(function* checkWorkflowScale(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const workspaces = yield* namedWorkspaces(root);\n const workflows = pipe(\n listed,\n Arr.flatMap((name) =>\n pipe(\n groupOf(\"name\")(WORKFLOW.exec(name)),\n Option.map((stem) => ({ name, stem })),\n Option.toArray,\n ),\n ),\n );\n const found = yield* Effect.forEach(\n workflows,\n ({ name, stem }) =>\n Effect.gen(function* problemsOf() {\n const file = files.join(root, name);\n const source = yield* files.readFile(file);\n return pipe(\n source,\n Option.map((text) => [\n ...pathFiltersIn(file, text),\n ...packagesIn(workspaces, { file, name: stem, source: text }),\n ]),\n Option.getOrElse((): readonly Problem[] => []),\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n const actions = pipe(\n listed,\n Arr.flatMap((name) =>\n pipe(\n groupOf(\"name\")(ACTION.exec(name)),\n Option.map((action) => actionProblems(workspaces, files.join(root, name), action)),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n ),\n );\n return [...Arr.flatten(found), ...actions];\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkCommandEntries } from \"./command-entries.ts\";\nimport { checkConfigPaths } from \"./config-paths.ts\";\nimport { checkCrates } from \"./crates.ts\";\nimport { checkDeployEntryPatterns } from \"./deploy-entry-patterns.ts\";\nimport { checkFallowEntries } from \"./fallow-entries.ts\";\nimport { checkRootWorkspacePaths } from \"./root-workspace-paths.ts\";\nimport { checkTasks } from \"./task-checks.ts\";\nimport { checkWorkflowPaths } from \"./workflow-paths.ts\";\nimport { checkWorkflowScale } from \"./workflow-scale.ts\";\n\n/** @internal */\nexport const checkWorkspaces = Effect.fn(\"checkWorkspaces\")(function* checkWorkspaces(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkCommandEntries(root),\n checkConfigPaths(root),\n checkCrates(root),\n checkDeployEntryPatterns(root),\n checkFallowEntries(root),\n checkRootWorkspacePaths(root),\n checkTasks(root),\n checkWorkflowPaths(root),\n checkWorkflowScale(root),\n ],\n {\n concurrency: \"unbounded\",\n },\n );\n return Arr.flatten(found);\n});\n","import { Option, Record as Rec, pipe } from \"effect\";\n\n/** @internal */\nexport const keysOf = (map: Readonly<Record<string, string>> | undefined): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(map),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n","import { Array as Arr, String as Str, pipe } from \"effect\";\n\nconst SCOPE = \"@\";\nconst SEPARATOR = \"/\";\nconst SCOPED_SEGMENTS = 2;\nconst PLAIN_SEGMENTS = 1;\n\nconst segmentCount = (specifier: string): number => {\n if (Str.startsWith(SCOPE)(specifier)) {\n return SCOPED_SEGMENTS;\n }\n return PLAIN_SEGMENTS;\n};\n\nexport const packageNameOf = (specifier: string): string =>\n pipe(Str.split(specifier, SEPARATOR), Arr.take(segmentCount(specifier)), Arr.join(SEPARATOR));\n","import {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Record as Rec,\n Result,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n SyntaxKind,\n isExportDeclaration,\n isImportDeclaration,\n isStringLiteral,\n} from \"#/shared/lib/compiler.ts\";\nimport type { API, Node } from \"#/shared/lib/compiler.ts\";\nimport { packageNameOf } from \"#/shared/lib/package-name.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RELATIVE = /^\\.\\.?(?:\\/|$)/u;\nconst SUBPATH_IMPORT = \"#\";\nconst WILDCARD = \"*\";\nconst SOURCE_SUFFIXES = [\"\", \".ts\", \".tsx\", \"/index.ts\"] as const;\n\nconst ImportsField = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\n\nconst decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));\n\ninterface Graph {\n readonly api: API;\n readonly directory: string;\n readonly imports: Readonly<Record<string, string>>;\n}\n\ninterface Walk {\n readonly pending: readonly string[];\n readonly visited: HashSet.HashSet<string>;\n readonly packages: HashSet.HashSet<string>;\n}\n\ntype Reference = Result.Result<string, string>;\n\nconst literalText = (specifier: Node): Option.Option<string> =>\n pipe(\n Option.liftPredicate(specifier, isStringLiteral),\n Option.map((literal) => literal.text),\n );\n\nconst runtimeSpecifierOf = (statement: Node): Option.Option<string> => {\n if (isImportDeclaration(statement)) {\n const typeOnly = pipe(\n Option.fromUndefinedOr(statement.importClause),\n Option.exists((clause) => clause.phaseModifier === SyntaxKind.TypeKeyword),\n );\n return Option.filter(literalText(statement.moduleSpecifier), () => !typeOnly);\n }\n if (isExportDeclaration(statement) && !statement.isTypeOnly) {\n return Option.flatMap(Option.fromUndefinedOr(statement.moduleSpecifier), literalText);\n }\n return Option.none();\n};\n\nconst specifiersIn = (api: API, file: string, text: string): readonly string[] => {\n const retained = api.createSourceFile(file, text);\n const found = pipe(retained.sourceFile.statements, Arr.fromIterable, Arr.map(runtimeSpecifierOf));\n retained.dispose();\n return Arr.getSomes(found);\n};\n\nconst subpathTarget = (\n imports: Readonly<Record<string, string>>,\n specifier: string,\n): Option.Option<string> =>\n pipe(\n Rec.toEntries(imports),\n Arr.findFirst(([pattern, target]) => {\n if (!Str.endsWith(WILDCARD)(pattern)) {\n return Option.liftPredicate(target, () => pattern === specifier);\n }\n const prefix = Str.replace(WILDCARD, \"\")(pattern);\n return Option.liftPredicate(\n Str.replace(WILDCARD, Str.replace(prefix, \"\")(specifier))(target),\n () => Str.startsWith(prefix)(specifier),\n );\n }),\n );\n\nconst existingSource = Effect.fn(\"existingSource\")(function* existingSource(base: string) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n SOURCE_SUFFIXES,\n (suffix) => {\n const candidate = `${base}${suffix}`;\n return files\n .isDirectory(candidate)\n .pipe(\n Effect.map((directory) =>\n Option.liftPredicate(candidate, () =>\n Option.exists(directory, (isDirectory) => !isDirectory),\n ),\n ),\n );\n },\n { concurrency: 1 },\n );\n return Arr.head(Arr.getSomes(found));\n});\n\nconst localFile = Effect.fn(\"localFile\")(function* localFile(\n { directory, imports }: Graph,\n from: string,\n specifier: string,\n) {\n const files = yield* RepositoryFiles;\n if (RELATIVE.test(specifier)) {\n return yield* existingSource(files.resolve(files.dirname(from), specifier));\n }\n const target = subpathTarget(imports, specifier);\n if (Option.isNone(target)) {\n return Option.none<string>();\n }\n return yield* existingSource(files.resolve(directory, target.value));\n});\n\nconst referenceOf = (\n graph: Graph,\n from: string,\n specifier: string,\n): Effect.Effect<Option.Option<Reference>, never, RepositoryFiles> => {\n if (RELATIVE.test(specifier) || Str.startsWith(SUBPATH_IMPORT)(specifier)) {\n return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));\n }\n const name = packageNameOf(specifier);\n return Effect.succeedSome(Result.fail(name));\n};\n\nconst referencesIn = Effect.fn(\"referencesIn\")(function* referencesIn(graph: Graph, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const specifiers = Option.match(text, {\n onNone: (): readonly string[] => [],\n onSome: (source) => specifiersIn(graph.api, file, source),\n });\n const references = yield* Effect.forEach(\n specifiers,\n (specifier) => referenceOf(graph, file, specifier),\n { concurrency: 1 },\n );\n const found = Arr.getSomes(references);\n return { packages: Arr.getFailures(found), sources: Arr.getSuccesses(found) };\n});\n\nconst packagesFrom = (\n graph: Graph,\n walk: Walk,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(walk.pending, {\n onEmpty: () => Effect.succeed(walk.packages),\n onNonEmpty: ([next, ...rest]) => {\n if (HashSet.has(walk.visited, next)) {\n return packagesFrom(graph, { ...walk, pending: rest });\n }\n return referencesIn(graph, next).pipe(\n Effect.flatMap(({ packages, sources }) =>\n packagesFrom(graph, {\n pending: [...rest, ...sources],\n visited: HashSet.add(walk.visited, next),\n packages: HashSet.union(walk.packages, HashSet.fromIterable(packages)),\n }),\n ),\n );\n },\n });\n\n/** @internal */\nexport const packagesByEntry = Effect.fn(\"packagesByEntry\")(function* packagesByEntry(\n api: API,\n directory: string,\n entries: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const imports = pipe(\n manifest,\n Option.flatMap(decodeImports),\n Option.flatMap((field) => Option.fromUndefinedOr(field.imports)),\n Option.getOrElse((): Readonly<Record<string, string>> => ({})),\n );\n const graph: Graph = { api, directory, imports };\n return yield* Effect.forEach(\n entries,\n (entry) =>\n packagesFrom(graph, {\n pending: [entry],\n visited: HashSet.empty(),\n packages: HashSet.empty(),\n }).pipe(Effect.map((packages) => [entry, packages] as const)),\n { concurrency: 1 },\n );\n});\n","import {\n Array as Arr,\n Effect,\n HashSet,\n Number as Num,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst EMPTY = 0;\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\nconst PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });\nconst PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));\nconst InstalledManifest = Schema.Struct({\n dependencies: DependencyMap,\n optionalDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n peerDependenciesMeta: PeerMeta,\n});\ntype Installed = typeof InstalledManifest.Type;\n\ntype Pending = readonly (readonly [string, string])[];\n\ninterface Collect {\n readonly pending: Pending;\n readonly seen: HashSet.HashSet<string>;\n}\n\nconst decodeManifest = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));\n\nconst isOptionalPeer = (manifest: Installed, name: string): boolean =>\n pipe(\n Option.fromUndefinedOr(manifest.peerDependenciesMeta),\n Option.flatMap(Rec.get(name)),\n Option.exists((meta) => meta.optional === true),\n );\n\nconst installedNames = (manifest: Installed): readonly string[] => [\n ...keysOf(manifest.dependencies),\n ...keysOf(manifest.optionalDependencies),\n ...pipe(\n keysOf(manifest.peerDependencies),\n Arr.filter((name) => !isOptionalPeer(manifest, name)),\n ),\n];\n\nconst childrenOf = Effect.fn(\"childrenOf\")(function* childrenOf(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(installedNames),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((child) => [directory, child] as const),\n );\n});\n\nconst resolveFrom = (\n from: string,\n name: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* resolvePackage() {\n const files = yield* RepositoryFiles;\n const candidate = files.join(from, NODE_MODULES, name);\n const found = yield* files.exists(files.join(candidate, MANIFEST_FILE));\n if (found) {\n const real = yield* files.realPath(candidate);\n return Option.some(real);\n }\n const parent = files.dirname(from);\n if (parent === from) {\n return Option.none<string>();\n }\n return yield* resolveFrom(parent, name);\n });\n\nconst unseen = (\n from: string,\n name: string,\n seen: HashSet.HashSet<string>,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n resolveFrom(from, name).pipe(\n Effect.map(Option.filter((directory) => !HashSet.has(seen, directory))),\n );\n\nconst closureOf = (\n provided: HashSet.HashSet<string>,\n collect: Collect,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(collect.pending, {\n onEmpty: () => Effect.succeed(collect.seen),\n onNonEmpty: ([[from, name], ...rest]) => {\n if (HashSet.has(provided, name)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return unseen(from, name, collect.seen).pipe(\n Effect.flatMap((resolved) => {\n if (Option.isNone(resolved)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return childrenOf(resolved.value).pipe(\n Effect.flatMap((children) =>\n closureOf(provided, {\n pending: [...rest, ...children],\n seen: HashSet.add(collect.seen, resolved.value),\n }),\n ),\n );\n }),\n );\n },\n });\n\nconst directorySize = (directory: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* sizeOfDirectory() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const entries = pipe(\n names,\n Arr.filter((name) => name !== NODE_MODULES),\n Arr.map((name) => files.join(directory, name)),\n );\n const sizes = yield* Effect.forEach(\n entries,\n (entry) =>\n files.isDirectory(entry).pipe(\n Effect.flatMap((kind) => {\n if (Option.isNone(kind)) {\n return Effect.succeed(EMPTY);\n }\n if (kind.value) {\n return directorySize(entry);\n }\n return files.fileSize(entry);\n }),\n ),\n { concurrency: 1 },\n );\n return Num.sumAll(sizes);\n });\n\nexport interface ClosureRoot {\n readonly provided: HashSet.HashSet<string>;\n readonly from: string;\n readonly name: string;\n}\n\nexport const installedClosure = ({\n provided,\n from,\n name,\n}: ClosureRoot): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n closureOf(provided, { pending: [[from, name]], seen: HashSet.empty() });\n\nexport const installedSize = (directory: string): Effect.Effect<number, never, RepositoryFiles> => {\n if (Str.includes(`/${NODE_MODULES}/`)(directory)) {\n return directorySize(directory);\n }\n return Effect.succeed(EMPTY);\n};\n","import {\n Array as Arr,\n Effect,\n HashMap,\n HashSet,\n Number as Num,\n Option,\n Order,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport {\n MANIFEST_FILE,\n STACK_CATALOG,\n publicEntriesOf,\n publishedWorkspaces,\n} from \"#/entities/package/index.ts\";\nimport type { PublicEntry, PublishedWorkspace } from \"#/entities/package/index.ts\";\nimport { typeScriptCompiler } from \"#/entities/project/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { packagesByEntry } from \"./import-graph.ts\";\nimport { installedClosure, installedSize } from \"./installed-closure.ts\";\n\nconst INSTALL_SIZE: RuleName = \"install-size\";\nconst STACK_DEPENDENCY: RuleName = \"stack-dependency\";\nconst BUDGET_KEY = \"installSize\";\nconst DEPENDENCIES_KEY = '\"dependencies\"';\nconst LISTED_LARGEST = 5;\nconst SIZE_CONCURRENCY = 32;\nconst MEGABYTE = 1_000_000;\nconst MEGABYTE_DIGITS = 1;\nconst START = 0;\nconst SINGLE_ENTRY = 1;\n\ninterface DependencySize {\n readonly name: string;\n readonly size: number;\n readonly entries: readonly string[];\n}\n\ninterface Published {\n readonly workspace: PublishedWorkspace;\n readonly entries: readonly PublicEntry[];\n readonly provided: HashSet.HashSet<string>;\n}\n\ninterface Measured {\n readonly closures: readonly (readonly [string, HashSet.HashSet<string>])[];\n readonly sizeOf: (packages: HashSet.HashSet<string>) => number;\n readonly total: number;\n}\n\ninterface Overrun {\n readonly workspace: PublishedWorkspace;\n readonly total: number;\n readonly largest: readonly DependencySize[];\n readonly entryCount: number;\n}\n\nconst megabytes = (bytes: number): string => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;\n\nconst usageHint = (dependency: DependencySize, entryCount: number): string => {\n const partial =\n entryCount > SINGLE_ENTRY &&\n dependency.entries.length > START &&\n dependency.entries.length < entryCount;\n if (!partial) {\n return \"\";\n }\n return ` (imported only from ${Arr.join(dependency.entries, \", \")})`;\n};\n\nconst listed = ({ largest, entryCount }: Overrun): string =>\n pipe(\n largest,\n Arr.map(\n (dependency) =>\n `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`,\n ),\n Arr.join(\", \"),\n );\n\nconst budgetProblem = Effect.fn(\"budgetProblem\")(function* budgetProblem(overrun: Overrun) {\n const files = yield* RepositoryFiles;\n const { workspace, total } = overrun;\n const config = yield* files.readFile(workspace.configFile);\n const source = Option.getOrElse(config, () => \"\");\n const index = Option.getOrElse(Str.indexOf(BUDGET_KEY)(source), () => START);\n return {\n file: workspace.configFile,\n ...positionOf(source)(index),\n rule: INSTALL_SIZE,\n message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed(overrun)}. Make a dependency imported only from some library entries an optional peer, make one that a bin needs at startup a required peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`,\n } satisfies Problem;\n});\n\nconst measure = Effect.fn(\"measure\")(function* measure(\n { workspace, provided }: Published,\n direct: readonly string[],\n) {\n const closures = yield* Effect.forEach(\n direct,\n (name) =>\n installedClosure({ provided, from: workspace.directory, name }).pipe(\n Effect.map((packages) => [name, packages] as const),\n ),\n { concurrency: 1 },\n );\n const everything = pipe(\n closures,\n Arr.flatMap(([, packages]) => Arr.fromIterable(packages)),\n HashSet.fromIterable,\n );\n const measured = yield* Effect.forEach(\n everything,\n (found) => installedSize(found).pipe(Effect.map((size) => [found, size] as const)),\n { concurrency: SIZE_CONCURRENCY },\n );\n const sizes = HashMap.fromIterable(measured);\n const sizeOf = (packages: HashSet.HashSet<string>): number =>\n packages.pipe(\n Arr.fromIterable,\n Arr.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START)),\n Num.sumAll,\n );\n return { closures, sizeOf, total: sizeOf(everything) } satisfies Measured;\n});\n\nconst importersOf = Effect.fn(\"importersOf\")(function* importersOf({\n workspace,\n entries,\n}: Published) {\n const compiler = yield* typeScriptCompiler;\n const sources = pipe(\n entries,\n Arr.map((entry) => entry.source),\n Arr.dedupe,\n );\n const byEntry = yield* packagesByEntry(compiler.api, workspace.directory, sources);\n const reached = HashMap.fromIterable(byEntry);\n return (name: string): readonly string[] =>\n pipe(\n entries,\n Arr.filter((entry) =>\n pipe(HashMap.get(reached, entry.source), Option.exists(HashSet.has(name))),\n ),\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n );\n}, Effect.scoped);\n\nconst bySizeDescending = Order.mapInput(\n Order.flip(Order.Number),\n (dependency: DependencySize) => dependency.size,\n);\n\nconst sizeProblems = Effect.fn(\"sizeProblems\")(function* sizeProblems(\n published: Published,\n direct: readonly string[],\n) {\n const { closures, sizeOf, total } = yield* measure(published, direct);\n if (total <= published.workspace.installBudget) {\n return [];\n }\n const importers = yield* importersOf(published);\n const largest = pipe(\n closures,\n Arr.map(([name, packages]): DependencySize => ({\n name,\n size: sizeOf(packages),\n entries: importers(name),\n })),\n Arr.sortBy(bySizeDescending),\n Arr.take(LISTED_LARGEST),\n );\n const entryCount = pipe(\n published.entries,\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n ).length;\n const problem = yield* budgetProblem({\n workspace: published.workspace,\n total,\n largest,\n entryCount,\n });\n return [problem];\n});\n\nconst stackProblems = (\n file: string,\n source: string,\n dependencies: Readonly<Record<string, string>>,\n): readonly Problem[] => {\n const section = Option.getOrElse(Str.indexOf(DEPENDENCIES_KEY)(source), () => START);\n const rest = Str.slice(section)(source);\n return pipe(\n Rec.toEntries(dependencies),\n Arr.filter(([, specifier]) => specifier === STACK_CATALOG),\n Arr.map(([name]): Problem => ({\n file,\n ...positionOf(source)(\n section + Option.getOrElse(Str.indexOf(`\"${name}\"`)(rest), () => START),\n ),\n rule: STACK_DEPENDENCY,\n message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`,\n })),\n );\n};\n\nconst PublishedManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n peerDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nconst problemsOf = Effect.fn(\"problemsOf\")(function* problemsOf(\n workspace: PublishedWorkspace,\n file: string,\n source: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = Schema.decodeOption(Schema.fromJsonString(PublishedManifest))(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n const dependencies = Option.getOrElse(\n Option.fromUndefinedOr(manifest.value.dependencies),\n () => ({}),\n );\n const entries = publicEntriesOf({\n manifest: manifest.value,\n join: (target) => files.join(workspace.directory, target),\n packEntries: workspace.packEntries,\n });\n const provided = HashSet.fromIterable(keysOf(manifest.value.peerDependencies));\n const sized = yield* sizeProblems({ workspace, entries, provided }, Rec.keys(dependencies));\n return [...stackProblems(file, source, dependencies), ...sized];\n});\n\nconst workspaceProblems = Effect.fn(\"workspaceProblems\")(function* workspaceProblems(\n workspace: PublishedWorkspace,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(workspace.directory, MANIFEST_FILE);\n const source = yield* files.readFile(file);\n return yield* Option.match(source, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: (text) => problemsOf(workspace, file, text),\n });\n});\n\n/** @internal */\nexport const checkPublishedPackages = Effect.fn(\"checkPublishedPackages\")(\n function* checkPublishedPackages(root: string) {\n const workspaces = yield* publishedWorkspaces(root);\n const found = yield* Effect.forEach(workspaces, workspaceProblems, { concurrency: 1 });\n return Arr.flatten(found);\n },\n);\n","import { stripVTControlCharacters } from \"node:util\";\n\nimport { Array as Arr, Option, Predicate, String as Str, pipe } from \"effect\";\n\nconst ERROR_LINE = /\\[[A-Z_]+\\]/u;\nconst SHOWN_ERRORS = 3;\nconst HEADER = \"Build failed\";\nconst NO_DETAIL = \"Run the bundle to see the error.\";\n\nconst linesOf = (error: unknown): readonly string[] =>\n pipe(\n Option.liftPredicate(error, Predicate.isError),\n Option.map(({ message }) => message),\n Option.getOrElse(() => String(error)),\n stripVTControlCharacters,\n Str.split(\"\\n\"),\n Arr.map(Str.trim),\n Arr.filter(Str.isNonEmpty),\n );\n\nexport const bundleErrorDetail = (error: unknown): string => {\n const lines = linesOf(error);\n return pipe(\n lines,\n Arr.filter((line) => ERROR_LINE.test(line)),\n Arr.take(SHOWN_ERRORS),\n Arr.match({\n onEmpty: () =>\n pipe(\n lines,\n Arr.findFirst((line) => !Str.startsWith(HEADER)(line)),\n Option.getOrElse(() => NO_DETAIL),\n ),\n onNonEmpty: Arr.join(\" \"),\n }),\n );\n};\n","import { builtinModules } from \"node:module\";\n\nimport {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { rolldown } from \"vite/rolldown\";\nimport type { InputOptions, OutputChunk } from \"vite/rolldown\";\n\nimport { bundleErrorDetail } from \"#/shared/lib/bundle-error.ts\";\nimport { packageNameOf } from \"#/shared/lib/package-name.ts\";\n\nconst VIRTUAL_PREFIX = \"\\0\";\nconst VIRTUAL = `${VIRTUAL_PREFIX}tree-shaking-consumer`;\nconst VIRTUAL_ID = /^\\0tree-shaking-consumer$/u;\nconst ABSOLUTE = /^(?:[A-Za-z]:)?[\\\\/]/u;\nconst NODE_PROTOCOL = \"node:\";\nconst SUBPATH_IMPORT = \"#\";\nconst RELATIVE_PREFIX = \".\";\nconst NAMESPACE = \"namespace\";\n\nconst Quoted = Schema.fromJsonString(Schema.String);\nconst quote = (text: string): string =>\n pipe(\n Schema.encodeOption(Quoted)(text),\n Option.getOrElse(() => text),\n );\nconst builtins: ReadonlySet<string> = new Set(builtinModules);\n\nexport type Effectful = (id: string) => boolean;\n\nexport const always: Effectful = () => true;\nexport const never: Effectful = () => false;\n\nexport interface BundleScope {\n readonly declared: readonly string[];\n readonly bundled: readonly string[];\n}\n\nexport interface Kept {\n readonly modules: readonly string[];\n readonly packages: readonly string[];\n}\n\nexport interface Consumer {\n readonly entry: string;\n readonly member: Option.Option<string>;\n}\n\nexport type BundleInput =\n | { readonly kind: \"consumer\"; readonly consumer: Consumer }\n | { readonly kind: \"program\"; readonly file: string };\n\nconst taggedError = Schema.TaggedError;\n\nexport class BundleFailed extends taggedError<BundleFailed, { readonly brand: unique symbol }>()(\n \"BundleFailed\",\n { detail: Schema.String },\n) {}\n\nconst failed = (error: unknown): BundleFailed =>\n BundleFailed.make({ detail: bundleErrorDetail(error) });\n\nconst isBare = (specifier: string): boolean =>\n !Str.startsWith(RELATIVE_PREFIX)(specifier) &&\n !Str.startsWith(SUBPATH_IMPORT)(specifier) &&\n !ABSOLUTE.test(specifier) &&\n !Str.startsWith(VIRTUAL_PREFIX)(specifier);\n\nconst isBuiltin = (specifier: string): boolean =>\n Str.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));\n\nconst isExternal =\n ({ declared, bundled }: BundleScope) =>\n (specifier: string, importer: string | undefined): boolean =>\n Predicate.isNotUndefined(importer) &&\n isBare(specifier) &&\n (isBuiltin(specifier) ||\n (Arr.contains(declared, packageNameOf(specifier)) &&\n !Arr.contains(bundled, packageNameOf(specifier))));\n\nconst consumerSource = ({ entry, member }: Consumer): string =>\n Option.match(member, {\n onNone: () => `export * from ${quote(entry)};\\n`,\n onSome: (name) =>\n `import * as ${NAMESPACE} from ${quote(entry)};\\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\\n`,\n });\n\nconst baseOptions = (scope: BundleScope, effectful: Effectful): InputOptions => ({\n platform: \"node\",\n logLevel: \"silent\",\n external: isExternal(scope),\n treeshake: { moduleSideEffects: effectful },\n});\n\nconst consumerPlugin = (consumer: Consumer): InputOptions[\"plugins\"] => [\n {\n name: \"tree-shaking-consumer\",\n resolveId: { filter: { id: VIRTUAL_ID }, handler: (): string => VIRTUAL },\n load: { filter: { id: VIRTUAL_ID }, handler: (): string => consumerSource(consumer) },\n },\n];\n\nconst optionsFor = (scope: BundleScope, input: BundleInput, effectful: Effectful): InputOptions => {\n const base = baseOptions(scope, effectful);\n if (input.kind === \"program\") {\n return { ...base, input: input.file };\n }\n return { ...base, input: VIRTUAL, plugins: consumerPlugin(input.consumer) };\n};\n\nconst isChunk = (item: { readonly type: string }): item is OutputChunk => item.type === \"chunk\";\n\nconst keptBy = (chunks: readonly OutputChunk[]): Kept => ({\n modules: pipe(\n chunks,\n Arr.flatMap((chunk) => Rec.keys(chunk.modules)),\n Arr.filter((id) => !Str.startsWith(VIRTUAL_PREFIX)(id)),\n Arr.dedupe,\n Arr.sortBy(Order.String),\n ),\n packages: pipe(\n chunks,\n Arr.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]),\n Arr.filter((specifier) => isBare(specifier) && !isBuiltin(specifier)),\n Arr.map(packageNameOf),\n Arr.dedupe,\n Arr.sortBy(Order.String),\n ),\n});\n\nconst generate = (options: InputOptions): Effect.Effect<readonly OutputChunk[], BundleFailed> =>\n Effect.acquireUseRelease(\n Effect.tryPromise({ try: () => rolldown(options), catch: failed }),\n (bundle) => Effect.tryPromise({ try: () => bundle.generate({ format: \"esm\" }), catch: failed }),\n (bundle) => Effect.promise(() => bundle.close()),\n ).pipe(Effect.map(({ output }) => pipe(output, Arr.filter(isChunk))));\n\nexport const keptIn = Effect.fn(\"keptIn\")(function* keptIn(\n scope: BundleScope,\n input: BundleInput,\n effectful: Effectful,\n) {\n const chunks = yield* generate(optionsFor(scope, input, effectful));\n return keptBy(chunks);\n});\n\nexport const exportNamesOf = Effect.fn(\"exportNamesOf\")(function* exportNamesOf(\n scope: BundleScope,\n entry: string,\n) {\n const chunks = yield* generate(optionsFor(scope, { kind: \"program\", file: entry }, always));\n return pipe(\n chunks,\n Arr.flatMap((chunk) => chunk.exports),\n Arr.dedupe,\n );\n});\n","import { Array as Arr, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport { STACK_CATALOG, entryNameOf } from \"#/entities/package/index.ts\";\nimport type { PackedWorkspace } from \"#/entities/package/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\n\nimport { always, never } from \"./consumer-bundle.ts\";\nimport type { Effectful } from \"./consumer-bundle.ts\";\n\nconst Versions = Schema.Record(Schema.String, Schema.String);\nconst PeerMeta = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });\n\nexport const Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n sideEffects: Schema.optional(Schema.Unknown),\n dependencies: Schema.optional(Versions),\n devDependencies: Schema.optional(Versions),\n peerDependencies: Schema.optional(Versions),\n optionalDependencies: Schema.optional(Versions),\n peerDependenciesMeta: Schema.optional(Schema.Record(Schema.String, PeerMeta)),\n});\n\nexport const runtimeDependenciesOf = ({\n dependencies,\n peerDependencies,\n optionalDependencies,\n}: typeof Manifest.Type): readonly string[] =>\n pipe([dependencies, peerDependencies, optionalDependencies], Arr.flatMap(keysOf), Arr.dedupe);\n\nexport const optionalPeersOf = ({\n peerDependenciesMeta,\n}: typeof Manifest.Type): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(peerDependenciesMeta),\n Option.map(Rec.filter(({ optional }) => optional === true)),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n\nexport const stackPackagesOf = ({ devDependencies }: typeof Manifest.Type): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(devDependencies),\n Option.map(Rec.filter((specifier) => specifier === STACK_CATALOG)),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst decode = Schema.decodeOption(Schema.fromJsonString(Manifest));\n\nexport const manifestOf = (text: string): Option.Option<typeof Manifest.Type> => decode(text);\n\nexport interface Declared {\n readonly effectful: Effectful;\n readonly entries: ReadonlySet<string>;\n readonly complete: boolean;\n readonly claimed: boolean;\n}\n\nexport interface Locator {\n readonly workspace: PackedWorkspace;\n readonly join: (target: string) => string;\n}\n\nconst isFileList = Schema.is(Schema.Array(Schema.String));\n\nconst sourcesOf = (workspace: PackedWorkspace, target: string): readonly string[] =>\n pipe(\n workspace.packEntries,\n Arr.filter((entry) => entry.name === entryNameOf(target)),\n Arr.map((entry) => entry.source),\n );\n\nconst listedSources = (declared: readonly string[], { workspace, join }: Locator): Set<string> =>\n new Set(\n pipe(\n declared,\n Arr.flatMap((target) => Arr.append(sourcesOf(workspace, target), join(target))),\n ),\n );\n\nexport interface Declaration {\n readonly declared: unknown;\n readonly locator: Locator;\n}\n\nexport const declaredBy = ({ declared, locator }: Declaration): Declared => {\n if (declared === false) {\n return { effectful: never, entries: new Set(), complete: true, claimed: true };\n }\n if (!isFileList(declared)) {\n return { effectful: always, entries: new Set(), complete: false, claimed: false };\n }\n const sources = listedSources(declared, locator);\n return {\n effectful: (id) => sources.has(id),\n entries: sources,\n complete: false,\n claimed: true,\n };\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { isBinEntry } from \"#/entities/package/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport type { Used } from \"./usage.ts\";\n\nconst RULE: RuleName = \"optional-peer\";\nconst REQUIRED_RULE: RuleName = \"required-peer\";\nconst START = 0;\nconst SINGLE = 1;\nconst DEPENDENCIES_KEY = '\"dependencies\"';\nconst PEER_META_KEY = '\"peerDependenciesMeta\"';\n\nexport interface Located {\n readonly file: string;\n readonly source: string;\n}\n\nconst importsPackage =\n (name: string) =>\n ({ packages }: Used): boolean =>\n Arr.contains(packages, name);\n\nconst labelsOf = (importers: readonly Used[]): string =>\n pipe(\n importers,\n Arr.map(({ entry }) => `\\`${entry.label}\\``),\n Arr.dedupe,\n Arr.join(\", \"),\n );\n\nconst positionIn = (\n located: Located,\n key: string,\n name: string,\n): Pick<Problem, \"line\" | \"column\"> => {\n const section = Option.getOrElse(Str.indexOf(key)(located.source), () => START);\n const rest = Str.slice(section)(located.source);\n return positionOf(located.source)(\n section + Option.getOrElse(Str.indexOf(`\"${name}\"`)(rest), () => START),\n );\n};\n\nconst problemFor = (located: Located, name: string, importers: readonly Used[]): Problem => ({\n file: located.file,\n ...positionIn(located, DEPENDENCIES_KEY, name),\n rule: RULE,\n message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`,\n});\n\nconst requiredPeerAdvice = (fromStack: boolean): string => {\n if (fromStack) {\n return \"Make it a required peer by removing it from peerDependenciesMeta; it comes from the stack catalog, so every project that installs this package already has it.\";\n }\n return \"Make it a required peer by removing it from peerDependenciesMeta when every project that installs this package already has it, or move it to dependencies, which count toward msch.publish.installSize.\";\n};\n\nexport interface Peering {\n readonly located: Located;\n readonly dependencies: Readonly<Record<string, string>> | undefined;\n readonly used: readonly Used[];\n}\n\nexport const optionalPeerProblems = ({\n located,\n dependencies,\n used,\n}: Peering): readonly Problem[] => {\n const libraries = pipe(\n used,\n Arr.filter(({ entry }) => !isBinEntry(entry)),\n );\n const bins = pipe(\n used,\n Arr.filter(({ entry }) => isBinEntry(entry)),\n );\n if (libraries.length <= SINGLE) {\n return [];\n }\n return pipe(\n keysOf(dependencies),\n Arr.flatMap((name) => {\n const importers = pipe(libraries, Arr.filter(importsPackage(name)));\n const neededByBin = pipe(bins, Arr.some(importsPackage(name)));\n const partial = importers.length > START && importers.length < libraries.length;\n if (!partial || neededByBin) {\n return [];\n }\n return [problemFor(located, name, importers)];\n }),\n );\n};\n\nexport interface OptionalPeering {\n readonly located: Located;\n readonly optional: readonly string[];\n readonly stack: readonly string[];\n readonly used: readonly Used[];\n}\n\nexport const requiredPeerProblems = ({\n located,\n optional,\n stack,\n used,\n}: OptionalPeering): readonly Problem[] => {\n const libraries = pipe(\n used,\n Arr.filter(({ entry }) => !isBinEntry(entry)),\n );\n return pipe(\n optional,\n Arr.flatMap((name) => {\n const bins = pipe(\n used,\n Arr.filter((entry) => isBinEntry(entry.entry) && importsPackage(name)(entry)),\n );\n const everyLibrary = pipe(\n libraries,\n Option.liftPredicate(\n (all) => Arr.isArrayNonEmpty(all) && pipe(all, Arr.every(importsPackage(name))),\n ),\n Option.getOrElse((): readonly Used[] => []),\n );\n const importers = Arr.appendAll(bins, everyLibrary);\n if (!Arr.isArrayNonEmpty(importers)) {\n return [];\n }\n return [\n {\n file: located.file,\n ...positionIn(located, PEER_META_KEY, name),\n rule: REQUIRED_RULE,\n message: `${name} is an optional peer, but ${labelsOf(importers)} import it at startup, so installing the package without it breaks them. ${requiredPeerAdvice(Arr.contains(stack, name))}`,\n },\n ];\n }),\n );\n};\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport type { PublicEntry } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { exportNamesOf, keptIn, never } from \"./consumer-bundle.ts\";\nimport type { BundleScope, Effectful, Kept } from \"./consumer-bundle.ts\";\n\nconst RULE: RuleName = \"side-effects\";\nconst BUNDLE_CONCURRENCY = 4;\nconst START = 0;\nconst FIRST = 1;\nconst LISTED_PACKAGES = 4;\nconst SIDE_EFFECTS_KEY = '\"sideEffects\"';\nconst EXPORTS_KEY = '\"exports\"';\n\nexport interface Subject {\n readonly scope: BundleScope;\n readonly effectful: Effectful;\n readonly entry: PublicEntry;\n}\n\nexport interface Excess {\n readonly label: string;\n readonly member: string;\n readonly modules: number;\n readonly packages: readonly string[];\n}\n\nconst beyond = (kept: Kept, ideal: Kept): Pick<Excess, \"modules\" | \"packages\"> => ({\n modules: Arr.difference(kept.modules, ideal.modules).length,\n packages: Arr.difference(kept.packages, ideal.packages),\n});\n\nconst memberExcess = Effect.fn(\"memberExcess\")(function* memberExcess(\n { scope, effectful, entry }: Subject,\n member: string,\n) {\n const consumer = { entry: entry.source, member: Option.some(member) };\n const input = { kind: \"consumer\", consumer } as const;\n const kept = yield* keptIn(scope, input, effectful);\n const ideal = yield* keptIn(scope, input, never);\n const extra = beyond(kept, ideal);\n return Option.liftPredicate(\n { label: entry.label, member, ...extra },\n ({ modules }) => modules > START,\n );\n});\n\nexport const excessOf = Effect.fn(\"excessOf\")(function* excessOf(subject: Subject) {\n const names = yield* exportNamesOf(subject.scope, subject.entry.source);\n const found = yield* Effect.forEach(names, (name) => memberExcess(subject, name), {\n concurrency: BUNDLE_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\nconst listed = (names: readonly string[]): string => {\n const shown = pipe(names, Arr.take(LISTED_PACKAGES), Arr.join(\", \"));\n if (names.length > LISTED_PACKAGES) {\n return `${shown} and more`;\n }\n return shown;\n};\n\nconst importsOf = (packages: readonly string[]): string =>\n Arr.match(packages, {\n onEmpty: () => \"\",\n onNonEmpty: (names) => ` and imports ${listed(names)}`,\n });\n\nconst othersOf = (total: number): string => {\n if (total <= FIRST) {\n return \"\";\n }\n return ` The same happens for ${String(total - FIRST)} other exports.`;\n};\n\nconst messageOf = (worst: Excess, total: number): string =>\n `importing \\`${worst.member}\\` from \\`${worst.label}\\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare \"sideEffects\": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;\n\nconst largest = Order.mapInput(Order.flip(Order.Number), (excess: Excess) => excess.modules);\n\nconst keyIndex = (source: string): number =>\n pipe(\n Str.indexOf(SIDE_EFFECTS_KEY)(source),\n Option.orElse(() => Str.indexOf(EXPORTS_KEY)(source)),\n Option.getOrElse(() => START),\n );\n\nexport interface ExcessReport {\n readonly file: string;\n readonly source: string;\n readonly excesses: readonly Excess[];\n}\n\nexport const sideEffectProblems = ({ file, source, excesses }: ExcessReport): readonly Problem[] =>\n pipe(\n excesses,\n Arr.sortBy(largest),\n Arr.head,\n Option.map((worst): Problem => ({\n file,\n ...positionOf(source)(keyIndex(source)),\n rule: RULE,\n message: messageOf(worst, excesses.length),\n })),\n Option.toArray,\n );\n","import { Array as Arr, Effect, Option, Predicate, pipe } from \"effect\";\n\nimport { typeScriptCompiler } from \"#/entities/project/index.ts\";\nimport {\n isExpressionStatement,\n isImportDeclaration,\n isStringLiteral,\n} from \"#/shared/lib/compiler.ts\";\nimport type { API, Node } from \"#/shared/lib/compiler.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"top-level-effect\";\nconst CODE = /\\.[cm]?[jt]sx?$/u;\nconst READ_CONCURRENCY = 16;\nconst IMPORT_MESSAGE =\n \"imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.\";\nconst STATEMENT_MESSAGE =\n \"runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.\";\n\nconst isEffect = (statement: Node): boolean => {\n if (isExpressionStatement(statement)) {\n return !isStringLiteral(statement.expression);\n }\n return isImportDeclaration(statement) && Predicate.isUndefined(statement.importClause);\n};\n\nconst messageOf = (statement: Node): string => {\n if (isImportDeclaration(statement)) {\n return IMPORT_MESSAGE;\n }\n return STATEMENT_MESSAGE;\n};\n\nconst problemsIn =\n (api: API) =>\n (file: string) =>\n (source: string): readonly Problem[] => {\n const retained = api.createSourceFile(file, source);\n const problems = pipe(\n retained.sourceFile.statements,\n Arr.fromIterable,\n Arr.filter(isEffect),\n Arr.map((statement) => problemAt({ rule: RULE, message: messageOf(statement) })(statement)),\n );\n retained.dispose();\n return problems;\n };\n\n/** @internal */\nexport const topLevelEffects = Effect.fn(\"topLevelEffects\")(function* topLevelEffects(\n root: string,\n modules: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const names = yield* files.ownedFiles(root);\n const owned = new Set(\n pipe(\n names,\n Arr.map((name) => files.join(root, name)),\n ),\n );\n const sources = pipe(\n modules,\n Arr.filter((file) => owned.has(file) && CODE.test(file)),\n );\n const found = yield* Effect.forEach(\n sources,\n (file) =>\n files.readFile(file).pipe(\n Effect.map((text) =>\n pipe(\n text,\n Option.map(problemsIn(compiler.api)(file)),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n}, Effect.scoped);\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { isBinEntry } from \"#/entities/package/index.ts\";\nimport type { PublicEntry } from \"#/entities/package/index.ts\";\n\nimport { always, keptIn } from \"./consumer-bundle.ts\";\nimport type { BundleInput, BundleScope } from \"./consumer-bundle.ts\";\nimport type { Declared } from \"./manifest.ts\";\n\nexport interface Used {\n readonly entry: PublicEntry;\n readonly packages: readonly string[];\n readonly modules: readonly string[];\n}\n\nconst inputOf = (entry: PublicEntry): BundleInput => {\n if (isBinEntry(entry)) {\n return { kind: \"program\", file: entry.source };\n }\n return {\n kind: \"consumer\",\n consumer: { entry: entry.source, member: Option.none<string>() },\n };\n};\n\nexport const usedBy = Effect.fn(\"usedBy\")(function* usedBy(scope: BundleScope, entry: PublicEntry) {\n const kept = yield* keptIn(scope, inputOf(entry), always);\n return { entry, packages: kept.packages, modules: kept.modules } satisfies Used;\n});\n\nexport interface Scan {\n readonly used: readonly Used[];\n readonly declared: Declared;\n}\n\nexport const modulesToScan = ({ used, declared }: Scan): readonly string[] =>\n pipe(\n used,\n Arr.filter(({ entry }) => !isBinEntry(entry)),\n Arr.flatMap(({ modules }) => modules),\n Arr.dedupe,\n Arr.filter((module) => !declared.entries.has(module)),\n );\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n isBinEntry,\n packedWorkspaces,\n publicEntriesOf,\n} from \"#/entities/package/index.ts\";\nimport type { PackedWorkspace, PublicEntry } from \"#/entities/package/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { BundleFailed, BundleScope } from \"./consumer-bundle.ts\";\nimport {\n declaredBy,\n manifestOf,\n optionalPeersOf,\n runtimeDependenciesOf,\n stackPackagesOf,\n} from \"./manifest.ts\";\nimport type { Declared, Manifest } from \"./manifest.ts\";\nimport { optionalPeerProblems, requiredPeerProblems } from \"./optional-peers.ts\";\nimport type { Located } from \"./optional-peers.ts\";\nimport { excessOf, sideEffectProblems } from \"./side-effects.ts\";\nimport { topLevelEffects } from \"./top-level-effects.ts\";\nimport { modulesToScan, usedBy } from \"./usage.ts\";\nimport type { Used } from \"./usage.ts\";\n\nconst BUNDLE: RuleName = \"tree-shake-bundle\";\n\nconst BUNDLE_CONCURRENCY = 4;\n\ninterface Package {\n readonly root: string;\n readonly workspace: PackedWorkspace;\n readonly located: Located;\n readonly manifest: typeof Manifest.Type;\n}\n\ninterface Shape {\n readonly scope: BundleScope;\n readonly declared: Declared;\n readonly entries: readonly PublicEntry[];\n}\n\nconst shapeOf = Effect.fn(\"shapeOf\")(function* shapeOf({ workspace, manifest }: Package) {\n const files = yield* RepositoryFiles;\n const join = (target: string): string => files.join(workspace.directory, target);\n const entries = pipe(\n publicEntriesOf({ manifest, join, packEntries: workspace.packEntries }),\n Arr.dedupeWith(\n (left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right),\n ),\n );\n return {\n scope: { declared: runtimeDependenciesOf(manifest), bundled: workspace.alwaysBundle },\n declared: declaredBy({ declared: manifest.sideEffects, locator: { workspace, join } }),\n entries,\n } satisfies Shape;\n});\n\nconst excessesOf = Effect.fn(\"excessesOf\")(function* excessesOf({\n scope,\n declared,\n entries,\n}: Shape) {\n if (declared.complete) {\n return [];\n }\n const shaken = pipe(\n entries,\n Arr.filter((entry) => !isBinEntry(entry) && !declared.entries.has(entry.source)),\n );\n const found = yield* Effect.forEach(\n shaken,\n (entry) => excessOf({ scope, effectful: declared.effectful, entry }),\n { concurrency: BUNDLE_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\nconst effectsOf = Effect.fn(\"effectsOf\")(function* effectsOf(\n root: string,\n declared: Declared,\n used: readonly Used[],\n) {\n if (!declared.claimed) {\n return [];\n }\n return yield* topLevelEffects(root, modulesToScan({ used, declared }));\n});\n\nconst analyse = Effect.fn(\"analyse\")(function* analyse(pack: Package) {\n const { root, located, manifest } = pack;\n const shape = yield* shapeOf(pack);\n const excesses = yield* excessesOf(shape);\n const used = yield* Effect.forEach(shape.entries, (entry) => usedBy(shape.scope, entry), {\n concurrency: BUNDLE_CONCURRENCY,\n });\n const effects = yield* effectsOf(root, shape.declared, used);\n return [\n ...sideEffectProblems({ file: located.file, source: located.source, excesses }),\n ...effects,\n ...optionalPeerProblems({ located, dependencies: manifest.dependencies, used }),\n ...requiredPeerProblems({\n located,\n optional: optionalPeersOf(manifest),\n stack: stackPackagesOf(manifest),\n used,\n }),\n ];\n});\n\nconst bundleProblem = (file: string, error: BundleFailed): readonly Problem[] => [\n problemInFile(BUNDLE)(file, `does not bundle for the tree-shaking check. ${error.detail}`),\n];\n\nconst workspaceProblems = Effect.fn(\"workspaceProblems\")(function* workspaceProblems(\n root: string,\n workspace: PackedWorkspace,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(workspace.directory, MANIFEST_FILE);\n const source = yield* files.readFile(file);\n const manifest = pipe(source, Option.flatMap(manifestOf));\n if (Option.isNone(source) || Option.isNone(manifest)) {\n return [];\n }\n const located = { file, source: source.value };\n return yield* analyse({ root, workspace, located, manifest: manifest.value }).pipe(\n Effect.catchTag(\"BundleFailed\", (error) => Effect.succeed(bundleProblem(file, error))),\n );\n});\n\n/** @internal */\nexport const checkTreeShaking = Effect.fn(\"checkTreeShaking\")(function* checkTreeShaking(\n root: string,\n) {\n const workspaces = yield* packedWorkspaces(root);\n const found = yield* Effect.forEach(\n workspaces,\n (workspace) => workspaceProblems(root, workspace),\n { concurrency: 1 },\n );\n return Arr.flatten(found);\n});\n","import { parse } from \"@pnpm/deps.path\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { lockedGraph } from \"#/entities/workspace/index.ts\";\nimport type { LockedNode } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"legacy-typescript\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst COMPILER = \"typescript\";\nconst CURRENT_MAJOR = 7;\nconst LEGACY_COMPILER_PACKAGE = /^@typescript\\/typescript\\d+$/u;\nconst FIRST = 1;\n\ninterface Legacy {\n readonly id: string;\n readonly name: string;\n}\n\nconst legacyOf = (id: string): Option.Option<Legacy> => {\n const { name, version } = parse(id);\n const isOldCompiler =\n name === COMPILER &&\n pipe(\n Option.fromNullishOr(version),\n Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))),\n Option.exists((found) => found.major < CURRENT_MAJOR),\n );\n return pipe(\n Option.fromNullishOr(name),\n Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? \"\")),\n Option.map((found) => ({ id, name: found })),\n );\n};\n\nconst dependentsOf =\n (nodes: readonly LockedNode[]) =>\n (id: string): readonly string[] =>\n pipe(\n nodes,\n Arr.filter(({ dependencies }) => Arr.contains(dependencies, id)),\n Arr.map((node) => `\\`${node.id}\\``),\n );\n\nconst lineOf =\n (source: string) =>\n (id: string): number =>\n pipe(\n Str.split(source, \"\\n\"),\n Arr.findFirstIndex((line) => Str.replaceAll(\"'\", \"\")(Str.trim(line)) === `${id}:`),\n Option.match({ onNone: () => FIRST, onSome: (index) => index + FIRST }),\n );\n\nconst messageOf = (legacy: Legacy, dependents: readonly string[]): string =>\n `\\`${legacy.id}\\` is installed, pulled in by ${Arr.join(dependents, \", \")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;\n\n/** @internal */\nexport const checkTypescriptGeneration = Effect.fn(\"checkTypescriptGeneration\")(\n function* checkTypescriptGeneration(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, LOCKFILE);\n const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));\n const read = yield* files.readFile(file);\n const source = Option.getOrElse(read, () => \"\");\n return pipe(\n Option.getOrElse(nodes, (): readonly LockedNode[] => []),\n Arr.flatMap(({ id }) => Option.toArray(legacyOf(id))),\n Arr.map((legacy): Problem => ({\n file,\n line: lineOf(source)(legacy.id),\n column: FIRST,\n rule: RULE,\n message: messageOf(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id)),\n })),\n );\n },\n);\n","import { Array as Arr, Effect, Option } from \"effect\";\nimport { rolldown } from \"vite/rolldown\";\n\nimport { bundledEntries } from \"#/entities/workspace/index.ts\";\nimport { bundleErrorDetail } from \"#/shared/lib/bundle-error.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"worker-bundle\";\nconst BUNDLE_CONCURRENCY = 4;\nconst PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];\nconst CONDITIONS = [\"workerd\", \"worker\", \"browser\", \"import\", \"module\", \"default\"];\n\nconst problemFor = problemInFile(RULE);\n\nconst problemOf = (file: string, detail: string): Problem =>\n problemFor(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);\n\nconst bundleProblem = (file: string): Effect.Effect<Option.Option<Problem>> =>\n Effect.gen(function* bundle() {\n const built = yield* Effect.tryPromise({\n try: () =>\n rolldown({\n input: file,\n platform: \"neutral\",\n external: PLATFORM_MODULES,\n resolve: { conditionNames: CONDITIONS },\n logLevel: \"silent\",\n }),\n catch: bundleErrorDetail,\n });\n yield* Effect.tryPromise({\n try: () => built.generate({ format: \"esm\" }),\n catch: bundleErrorDetail,\n });\n yield* Effect.promise(() => built.close());\n }).pipe(\n Effect.match({\n onSuccess: () => Option.none<Problem>(),\n onFailure: (detail) => Option.some(problemOf(file, detail)),\n }),\n );\n\n/** @internal */\nexport const checkWorkerBundles = Effect.fn(\"checkWorkerBundles\")(function* checkWorkerBundles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* bundledEntries(root);\n const found = yield* Effect.forEach(entries, (entry) => bundleProblem(files.join(root, entry)), {\n concurrency: BUNDLE_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkTreeShaking } from \"#/features/check-tree-shaking/index.ts\";\nimport { checkTypescriptGeneration } from \"#/features/check-typescript-generation/index.ts\";\nimport { checkWorkerBundles } from \"#/features/check-worker-bundles/index.ts\";\n\n/** @internal */\nexport const checkBuilds = Effect.fn(\"checkBuilds\")(function* checkBuilds(root: string) {\n const found = yield* Effect.all(\n [checkTypescriptGeneration(root), checkWorkerBundles(root), checkTreeShaking(root)],\n {\n concurrency: \"unbounded\",\n },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option } from \"effect\";\n\nimport {\n isCallExpression,\n isNewExpression,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/syntax.ts\";\n\ntype AnnotatedDeclaration =\n | ParameterDeclaration\n | VariableDeclaration\n | PropertySignatureDeclaration\n | PropertyDeclaration;\n\nconst ANNOTATED_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.Parameter,\n SyntaxKind.VariableDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotated = (declaration: Declaration): declaration is AnnotatedDeclaration =>\n ANNOTATED_KINDS.has(declaration.kind);\n\nexport const annotationOf = (declaration: Declaration): Option.Option<TypeNode> =>\n Option.liftPredicate(declaration, isAnnotated).pipe(\n Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)),\n );\n\nconst argumentSlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const call = expression.parent;\n if (!isCallExpression(call) && !isNewExpression(call)) {\n return Option.none();\n }\n const { arguments: listed } = call;\n const callArguments: readonly Expression[] = listed ?? [];\n const index = callArguments.indexOf(expression);\n return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.filter(isSignatureDeclaration),\n Option.flatMap((declaration) => Arr.get(declaration.parameters, index)),\n );\n };\n\nconst propertySlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const assignment = expression.parent;\n if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(\n Option.flatMap((objectType) =>\n Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText())),\n ),\n Option.flatMap((property) => Arr.head(declarationsOf(property))),\n );\n };\n\nconst variableSlot = (expression: Expression): Option.Option<Declaration> => {\n const declaration = expression.parent;\n if (!isVariableDeclaration(declaration) || declaration.initializer !== expression) {\n return Option.none();\n }\n return Option.some(declaration);\n};\n\nexport const slotOf =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> =>\n argumentSlot(checker)(expression).pipe(\n Option.orElse(() => propertySlot(checker)(expression)),\n Option.orElse(() => variableSlot(expression)),\n );\n\nexport const contextSymbolsOf =\n (checker: Checker) =>\n (expression: Expression): readonly TypeSymbol[] => {\n const alias = Option.fromUndefinedOr(checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) => Option.fromUndefinedOr(contextual.getAliasSymbol())),\n );\n if (Option.isSome(alias)) {\n return [alias.value];\n }\n return slotOf(checker)(expression).pipe(\n Option.flatMap(annotationOf),\n Option.map((annotation) => referencedSymbols(checker)(annotation)),\n Option.getOrElse(() => []),\n );\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getNameOfDeclaration,\n isClassDeclaration,\n isElementAccessExpression,\n isIdentifier,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isSignatureDeclaration,\n isTypeAliasDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n ClassDeclaration,\n Declaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SignatureDeclaration,\n SourceFile,\n TypeNode,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n packageOf,\n symbolAt,\n} from \"#/shared/lib/syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\n\nexport interface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\nexport interface FlowContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly sites: readonly ValueSite[];\n}\n\nconst MODULE_PREFIX = /^\".*?\"\\./u;\n\nconst externalDeclarationOf =\n (context: FlowContext) =>\n (symbol: TypeSymbol): Option.Option<Declaration> =>\n Arr.findFirst(declarationsOf(symbol), (declaration) =>\n isExternalDeclaration(context.program)(declaration),\n );\n\nconst aliasTarget =\n (context: FlowContext) =>\n (type: Type): Option.Option<string> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) =>\n externalDeclarationOf(context)(alias).pipe(\n Option.map(\n (declaration) =>\n `${Str.replace(MODULE_PREFIX, \"\")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`,\n ),\n ),\n ),\n );\n\nconst isNamedContainer = (\n node: Node,\n): node is SignatureDeclaration | InterfaceDeclaration | ClassDeclaration =>\n isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);\n\nconst slotTarget =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<string> =>\n slotOf(context.checker)(expression).pipe(\n Option.filter((slot) => isExternalDeclaration(context.program)(slot)),\n Option.filter((slot) =>\n Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot))),\n ),\n Option.map((slot) => {\n const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(\n Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))),\n Option.map((name) => ` of ${name.getText()}`),\n Option.getOrElse(() => \"\"),\n );\n const name = Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(\n Option.map((found) => found.getText()),\n Option.getOrElse(() => \"value\"),\n );\n return `${name}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;\n }),\n );\n\nconst libraryTargetOf =\n (context: FlowContext) =>\n (expression: Expression, contextual: Type): Option.Option<string> =>\n aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));\n\nconst siteWithin =\n (context: FlowContext) =>\n (node: Node): Option.Option<ValueSite> =>\n Arr.findFirst(context.sites, (site) => contains(node)(site.node));\n\nconst aliasDeclarationOf = (type: Type): Option.Option<Node> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) => Arr.findFirst(declarationsOf(alias), isTypeAliasDeclaration)),\n );\n\nconst aliasSite =\n (context: FlowContext) =>\n (type: Type): Option.Option<ValueSite> =>\n Option.flatMap(aliasDeclarationOf(type), siteWithin(context));\n\nconst annotationAt =\n (checker: Checker) =>\n (expression: Expression): Option.Option<TypeNode> =>\n symbolAt(checker)(expression).pipe(\n Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)),\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.flatMap(annotationOf),\n );\n\nconst annotationSite =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n annotationAt(context.checker)(expression).pipe(\n Option.flatMap((annotation) =>\n siteWithin(context)(annotation).pipe(\n Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))),\n ),\n ),\n );\n\nconst siteBehind =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(\n Option.orElse(() => annotationSite(context)(expression)),\n );\n\nconst isFlowSource = (node: Node): node is Expression =>\n isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst flowOf =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<Flow> =>\n Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) =>\n Option.all([\n vocabularyOf(context.checker)(contextual),\n libraryTargetOf(context)(expression, contextual),\n ]),\n ),\n Option.flatMap(([vocabulary, target]) =>\n siteBehind(context)(expression).pipe(\n Option.filter((site) => isSubsetOf(site.values, vocabulary.values)),\n Option.map((site) => ({ site, target })),\n ),\n ),\n );\n\nexport const flowsIn =\n (context: FlowContext) =>\n (sourceFile: SourceFile): readonly Flow[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isFlowSource(node)),\n Arr.map((node) => flowOf(context)(node)),\n ),\n );\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isCallExpression,\n isExportDeclaration,\n isImportDeclaration,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isSourceFile,\n isStringLiteral,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node, SourceFile, StringLiteral } from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n descendantsOf,\n isInsideAny,\n symbolAtLocation,\n} from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf } from \"#/shared/lib/values.ts\";\n\nconst NAME = /^[\\w@.#/:$-]{2,}$/u;\n\nconst REQUIRE = \"require\";\n\nconst isModuleSpecifier = (node: StringLiteral): boolean => {\n const { parent } = node;\n return (\n isImportDeclaration(parent) ||\n isExportDeclaration(parent) ||\n parent.kind === SyntaxKind.ExternalModuleReference ||\n parent.kind === SyntaxKind.LiteralType ||\n (isCallExpression(parent) &&\n (parent.expression.kind === SyntaxKind.ImportKeyword ||\n parent.expression.getText() === REQUIRE))\n );\n};\n\nconst isModuleScope = (node: Node): boolean => {\n const { parent } = node;\n if (isSourceFile(parent)) {\n return true;\n }\n return !isSignatureDeclaration(parent) && isModuleScope(parent);\n};\n\nconst isModuleConstant = (node: Node): boolean =>\n isVariableDeclaration(node.parent) &&\n node.parent.initializer === node &&\n isModuleScope(node.parent);\n\nconst isDefinition = (node: StringLiteral): boolean => {\n const { parent } = node;\n if (isPropertyAssignment(parent)) {\n return (\n parent.initializer === node &&\n isObjectLiteralExpression(parent.parent) &&\n isModuleConstant(parent.parent)\n );\n }\n return isModuleConstant(node);\n};\n\nconst isTyped =\n (checker: Checker) =>\n (node: StringLiteral): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst specifierOf = (statement: Node): Option.Option<StringLiteral> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));\n};\n\nconst importedFilesOf =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map(specifierOf),\n Arr.getSomes,\n Arr.flatMap((specifier) =>\n pipe(\n symbolAtLocation(checker)(specifier),\n Option.flatMap((symbol) => Arr.head(declarationsOf(symbol))),\n Option.map((declaration) => declaration.getSourceFile().fileName),\n Option.toArray,\n ),\n ),\n Arr.dedupe,\n );\n\nconst freeLiteralsIn =\n (checker: Checker) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly string[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node): node is StringLiteral => isStringLiteral(node)),\n Arr.filter((node) => NAME.test(node.text)),\n Arr.filter(isDefinition),\n Arr.filter((node) => !isModuleSpecifier(node)),\n Arr.filter((node) => !isInsideAny(excluded)(node) && !isTyped(checker)(node)),\n Arr.map((node) => node.text),\n Arr.dedupe,\n );\n\nexport interface FileFacts {\n readonly file: string;\n readonly values: readonly string[];\n readonly imports: readonly string[];\n}\n\nexport const fileFactsIn =\n (checker: Checker) =>\n (sourceFiles: readonly SourceFile[], excluded: readonly Node[]): readonly FileFacts[] =>\n pipe(\n sourceFiles,\n Arr.map((sourceFile) => ({\n file: sourceFile.fileName,\n values: freeLiteralsIn(checker)(sourceFile, excluded),\n imports: importedFilesOf(checker)(sourceFile),\n })),\n Arr.filter(\n (facts) =>\n Arr.isReadonlyArrayNonEmpty(facts.values) || Arr.isReadonlyArrayNonEmpty(facts.imports),\n ),\n );\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport type { PackageScope, UnownedSite } from \"./duplicates.ts\";\nimport type { FileFacts } from \"./free-literals.ts\";\n\nconst RULE: RuleName = \"hand-written-names\";\n\nexport const MINIMUM_NAMES = 2;\n\nexport const MISSING_ALLOWANCE = 1;\n\nexport const TEST_FILE = /\\.test(?:\\.[\\w-]+)?\\.[cm]?tsx?$/u;\n\nexport interface FileLiterals extends FileFacts {\n readonly scope: PackageScope;\n}\n\nexport interface NameList {\n readonly site: UnownedSite;\n readonly names: readonly string[];\n}\n\nexport const nameListOf = (site: UnownedSite): Option.Option<NameList> => {\n if (TEST_FILE.test(site.file) || site.values.length < MINIMUM_NAMES) {\n return Option.none();\n }\n const names = pipe(site.values, Arr.filter(Predicate.isString));\n return Option.liftPredicate({ site, names }, (list) => list.names.length === site.values.length);\n};\n\nexport const mostNamesOf = (list: NameList): number =>\n Math.max(MINIMUM_NAMES, list.names.length - MISSING_ALLOWANCE);\n\nexport interface Listed {\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly names: readonly string[];\n readonly reason: string;\n}\n\nexport const listedProblem = ({ file, line, column, names, reason }: Listed): Problem => ({\n file,\n line,\n column,\n rule: RULE,\n message: `The names ${formatValues(names)} are listed by hand, but ${reason}`,\n});\n\nexport const problemOf = ({\n list,\n reason,\n}: Readonly<{ list: NameList; reason: string }>): Problem =>\n listedProblem({\n file: list.site.file,\n line: list.site.line,\n column: list.site.column,\n names: list.names,\n reason,\n });\n","import { Array as Arr, HashSet, Option, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport { SymbolFlags, isArrayLiteralExpression, isStringLiteral } from \"#/shared/lib/compiler.ts\";\nimport type { ArrayLiteralExpression, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n columnOf,\n carriesTag,\n declarationsOf,\n declaresAType,\n descendantsOf,\n isOutsideDeclaration,\n lineOf,\n} from \"#/shared/lib/syntax.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport { MINIMUM_NAMES, TEST_FILE, listedProblem } from \"./name-lists.ts\";\n\nconst IDENTIFIER = /^[A-Za-z_$][\\w$]*$/u;\n\nconst HALF = 2;\n\nconst outsideTypeIn = (project: Project): ((name: string) => boolean) => {\n const exported = HashSet.fromIterable(project.library.typeNames);\n const values = HashSet.fromIterable([\n ...project.library.tagNames,\n ...pipe(\n project.library.vocabularies,\n Arr.flatMap(({ vocabulary }) => vocabulary.values),\n ),\n ]);\n const known = new Map<string, boolean>();\n const isOutside = isOutsideDeclaration(project.program);\n const isGlobalType = (name: string): boolean =>\n pipe(\n Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)),\n Option.map(declarationsOf),\n Option.exists(\n (declarations) =>\n declaresAType(declarations) &&\n !carriesTag(name)(declarations) &&\n pipe(declarations, Arr.every(isOutside)),\n ),\n );\n return (name) =>\n known.getOrInsertComputed(\n name,\n () =>\n IDENTIFIER.test(name) &&\n !HashSet.has(values, name) &&\n (HashSet.has(exported, name) || isGlobalType(name)),\n );\n};\n\nconst namesIn = (list: ArrayLiteralExpression): readonly string[] =>\n pipe(\n list.elements,\n Arr.filter(isStringLiteral),\n Arr.map((element) => element.text),\n );\n\nconst problemIn =\n (isOutsideType: (name: string) => boolean) =>\n (list: ArrayLiteralExpression): Option.Option<Problem> => {\n const names = namesIn(list);\n const outside = pipe(names, Arr.filter(isOutsideType));\n if (outside.length < Math.max(MINIMUM_NAMES, names.length / HALF)) {\n return Option.none();\n }\n return Option.some(\n listedProblem({\n file: list.getSourceFile().fileName,\n line: lineOf(list),\n column: columnOf(list),\n names,\n reason: `${formatValues(outside)} are types that the language or a package declares. Let the code that reads this list decide by where each type is declared, so that a new type does not mean a new entry.`,\n }),\n );\n };\n\nexport const outsideNameProblemsIn = (\n project: Project,\n): ((sourceFile: SourceFile) => readonly Problem[]) => {\n const problemOfList = problemIn(outsideTypeIn(project));\n return (sourceFile) => {\n if (TEST_FILE.test(sourceFile.fileName)) {\n return [];\n }\n return pipe(\n descendantsOf(sourceFile),\n Arr.filter(isArrayLiteralExpression),\n Arr.map(problemOfList),\n Arr.getSomes,\n );\n };\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface Owner {\n readonly conceptId: string;\n readonly key: string;\n readonly name: string;\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly packageName: Option.Option<string>;\n readonly values: readonly Value[];\n}\n\nexport interface OwnerScan {\n readonly owners: readonly Owner[];\n readonly problems: readonly Problem[];\n}\n\ninterface Annotated {\n readonly node: Node;\n readonly conceptId: string;\n}\n\nexport const OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nexport const ownerKeyOf = (declaration: Declaration): Option.Option<string> => {\n if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) {\n return Option.none();\n }\n return Option.some(`${declaration.getSourceFile().fileName}#${declaration.name.text}`);\n};\n\nconst annotationsOf = (node: Node): readonly Annotated[] =>\n pipe(\n getJSDocTags(node),\n Arr.filter((tag) => tag.tagName.text === OWNER_TAG),\n Arr.map((tag) => ({ node, conceptId: Str.trim(getTextOfJSDocComment(tag.comment) ?? \"\") })),\n );\n\nconst ANNOTATABLE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.VariableDeclaration,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyAssignment,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotatable = (node: Node): boolean => ANNOTATABLE_KINDS.has(node.kind);\n\nconst isConstList = (list: VariableDeclarationList): boolean =>\n Option.fromUndefinedOr(list.getFirstToken()).pipe(\n Option.exists((token) => token.kind === SyntaxKind.ConstKeyword),\n );\n\nconst isModuleStatementList = (list: VariableDeclarationList): boolean =>\n isVariableStatement(list.parent) && isSourceFile(list.parent.parent);\n\nconst isModuleConstList = (node: Node): node is VariableDeclarationList =>\n isVariableDeclarationList(node) && isModuleStatementList(node) && isConstList(node);\n\nconst isModuleConst = (node: Node): node is VariableDeclaration =>\n isVariableDeclaration(node) && isIdentifier(node.name) && isModuleConstList(node.parent);\n\nconst objectValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalValuesOf(\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => checker.getTypeOfSymbol(property)),\n ),\n );\n\nconst ownerValuesOf =\n (checker: Checker) =>\n (declaration: VariableDeclaration): Option.Option<readonly Value[]> => {\n const type = checker.getTypeAtLocation(declaration.name);\n return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));\n };\n\nconst annotationProblem = (message: string): ((node: Node) => Problem) =>\n problemAt({ rule: \"owner-annotation\", message });\n\nconst scanned = (owners: readonly Owner[], problems: readonly Problem[]): OwnerScan => ({\n owners,\n problems,\n});\n\nconst ownerOf =\n (project: Project) =>\n (annotated: Annotated): OwnerScan => {\n const { node, conceptId } = annotated;\n if (!isModuleConst(node)) {\n return scanned(\n [],\n [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)],\n );\n }\n if (conceptId === \"\") {\n return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);\n }\n const values = ownerValuesOf(project.checker)(node);\n return Option.match(Option.all([values, ownerKeyOf(node)]), {\n onNone: () =>\n scanned(\n [],\n [annotationProblem(`The owner of ${conceptId} holds no finite value set.`)(node)],\n ),\n onSome: ([ownedValues, key]) =>\n scanned(\n [\n {\n conceptId,\n key,\n name: node.name.getText(),\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n packageName: project.packageName,\n values: ownedValues,\n },\n ],\n [],\n ),\n });\n };\n\nconst annotatedIn = (sourceFile: SourceFile): readonly Annotated[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isAnnotatable(node)),\n Arr.flatMap((node) => annotationsOf(node)),\n );\n\nconst ownerProblem =\n (message: string) =>\n (owner: Owner): Problem => ({\n file: owner.file,\n line: owner.line,\n column: owner.column,\n rule: \"owner-annotation\",\n message,\n });\n\nconst conflictProblems = (owners: readonly Owner[]): readonly Problem[] =>\n pipe(\n owners,\n Arr.flatMap((owner, index) => {\n const earlier = Arr.take(owners, index);\n const sameConcept = pipe(\n earlier,\n Arr.filter((other) => other.conceptId === owner.conceptId),\n );\n const sameSet = pipe(\n earlier,\n Arr.filter(\n (other) => other.conceptId !== owner.conceptId && sameValues(other.values, owner.values),\n ),\n );\n return [\n ...pipe(\n Arr.take(sameConcept, FIRST_OWNER_COUNT),\n Arr.map(() =>\n ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner),\n ),\n ),\n ...pipe(\n Arr.take(sameSet, FIRST_OWNER_COUNT),\n Arr.map((other) =>\n ownerProblem(\n `The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`,\n )(owner),\n ),\n ),\n ];\n }),\n );\n\nexport const ownersIn = (project: Project): OwnerScan => {\n const results = pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n annotatedIn(sourceFile),\n Arr.map((annotated) => ownerOf(project)(annotated)),\n ),\n ),\n );\n return scanned(\n pipe(\n results,\n Arr.flatMap((result) => result.owners),\n ),\n pipe(\n results,\n Arr.flatMap((result) => result.problems),\n ),\n );\n};\n\nexport const combineOwnerScans = (scans: readonly OwnerScan[]): OwnerScan => {\n const owners = Arr.dedupeWith(\n pipe(\n scans,\n Arr.flatMap((scan) => scan.owners),\n ),\n (left, right) => left.key === right.key,\n );\n const problems = [\n ...pipe(\n scans,\n Arr.flatMap((scan) => scan.problems),\n ),\n ...conflictProblems(owners),\n ];\n return { owners, problems };\n};\n\nexport const ownerDeclarationsIn =\n (owners: readonly Owner[]) =>\n (project: Project): readonly VariableDeclaration[] => {\n const keys = new Set(\n pipe(\n owners,\n Arr.map((owner) => owner.key),\n ),\n );\n return pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isVariableDeclaration(node)),\n Arr.filter((declaration) =>\n Option.exists(ownerKeyOf(declaration), (key) => keys.has(key)),\n ),\n ),\n ),\n );\n };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { declarationKey, locationOf } from \"#/entities/project/index.ts\";\nimport { isSatisfiesExpression, isVariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node } from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/syntax.ts\";\n\nconst contractOf = (node: Node): readonly Node[] => {\n const { parent } = node;\n if (isSatisfiesExpression(parent) && parent.expression === node) {\n return [parent.type];\n }\n if (isVariableDeclaration(parent) && parent.initializer === node) {\n return Option.toArray(Option.fromUndefinedOr(parent.type));\n }\n return [];\n};\n\nexport const derivedDeclarationsOf =\n (checker: Checker) =>\n (node: Node): ReadonlySet<string> => {\n const scopes = Arr.prepend(contractOf(node), node);\n return new Set(\n pipe(\n scopes,\n Arr.flatMap((scope) => referencedSymbols(checker)(scope)),\n Arr.flatMap((symbol) => declarationsOf(symbol)),\n Arr.map((declaration) => declarationKey(locationOf(declaration))),\n ),\n );\n };\n","import { Array as Arr, pipe } from \"effect\";\n\nimport type { LibraryShape } from \"#/entities/project/index.ts\";\nimport type { Checker, Type, TypeSymbol } from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, packageOf } from \"#/shared/lib/syntax.ts\";\n\nexport interface OpenTypeIds {\n readonly any: number;\n readonly unknown: number;\n}\n\nexport const openTypeIdsOf = (checker: Checker): OpenTypeIds => ({\n any: checker.getAnyType().id,\n unknown: checker.getUnknownType().id,\n});\n\nexport interface PropertyContext {\n readonly checker: Checker;\n readonly open: OpenTypeIds;\n}\n\nexport const sameProperty =\n ({ checker, open }: PropertyContext) =>\n (localType: Type, library: TypeSymbol): boolean => {\n const libraryType = checker.getTypeOfSymbol(library);\n return (\n libraryType.id !== open.any &&\n libraryType.id !== open.unknown &&\n checker.isTypeAssignableTo(localType, libraryType) &&\n checker.isTypeAssignableTo(libraryType, localType)\n );\n };\n\nexport const declaredBy =\n (shape: LibraryShape) =>\n (library: TypeSymbol): boolean => {\n const owner = packageOf(shape.declaration.file);\n return pipe(\n declarationsOf(library),\n Arr.some((declaration) => packageOf(declaration.getSourceFile().fileName) === owner),\n );\n };\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport { declarationKey, describeLibraryType, isObjectType } from \"#/entities/project/index.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"#/entities/project/index.ts\";\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n VariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n descendantsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n symbolAtLocation,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf } from \"#/shared/lib/values.ts\";\n\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\nimport { declaredBy, openTypeIdsOf, sameProperty } from \"./property-match.ts\";\nimport type { OpenTypeIds } from \"./property-match.ts\";\n\nexport interface ShapeContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface ShapeSite {\n readonly node: Node;\n readonly type: Type;\n}\n\ninterface ShapeMatch {\n readonly shape: LibraryShape;\n readonly extra: number;\n}\n\nconst MINIMUM_SHAPE_PROPERTIES = 3;\nconst EXACT = 0;\n\nconst augmentsAModule = (node: Node): boolean => {\n const block = node.parent;\n return (\n isModuleBlock(block) && isModuleDeclaration(block.parent) && isStringLiteral(block.parent.name)\n );\n};\n\nconst isPlainInterface = (node: Node): node is InterfaceDeclaration =>\n isInterfaceDeclaration(node) && !isGenericDeclaration(node) && !augmentsAModule(node);\n\nconst isPlainTypeLiteral = (node: Node): node is TypeAliasDeclaration =>\n isTypeAliasDeclaration(node) && !isGenericDeclaration(node) && isTypeLiteralNode(node.type);\n\nconst isDeclaredShape = (node: Node): node is InterfaceDeclaration | TypeAliasDeclaration =>\n isPlainInterface(node) || isPlainTypeLiteral(node);\n\nconst declaredShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> =>\n Option.liftPredicate(node, isDeclaredShape).pipe(\n Option.map((declaration) => checker.getTypeAtLocation(declaration.name)),\n );\n\nconst schemaShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> => {\n if (!isCallExpression(node)) {\n return Option.none();\n }\n const { arguments: callArguments } = node;\n if (\n !pipe(\n callArguments,\n Arr.some((argument) => isObjectLiteralExpression(argument)),\n )\n ) {\n return Option.none();\n }\n return schemaTypeOf(checker)(checker.getTypeAtLocation(node)).pipe(\n Option.filter((type) => isObjectType(checker)(type)),\n );\n };\n\nconst shapeSitesIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly ShapeSite[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.map((node) =>\n declaredShapeOf(checker)(node).pipe(\n Option.orElse(() => schemaShapeOf(checker)(node)),\n Option.map((type) => ({ node, type })),\n ),\n ),\n ),\n );\n\ninterface LocalProperty {\n readonly name: string;\n readonly type: Type;\n}\n\ntype IndexedDeclaration =\n | TypeAliasDeclaration\n | InterfaceDeclaration\n | EnumDeclaration\n | VariableDeclaration;\n\nconst isIndexedDeclaration = (node: Node): node is IndexedDeclaration =>\n isTypeDeclaration(node) || isVariableDeclaration(node);\n\nconst declarationAt =\n (program: Program) =>\n (location: DeclarationLocation): Option.Option<IndexedDeclaration> =>\n Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(\n Option.flatMap((sourceFile) =>\n Arr.findFirst(\n descendantsOf(sourceFile),\n (node): node is IndexedDeclaration =>\n node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node),\n ),\n ),\n );\n\nconst shapeTypeOf =\n (context: ShapeContext) =>\n (shape: LibraryShape): Option.Option<Type> => {\n const { checker } = context;\n return declarationAt(context.program)(shape.declaration).pipe(\n Option.flatMap((declaration) =>\n symbolAtLocation(checker)(declaration.name).pipe(\n Option.flatMap((symbol) => {\n if (shape.form === \"declared\") {\n return Option.some(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return schemaTypeOf(checker)(checker.getTypeOfSymbolAtLocation(symbol, declaration));\n }),\n ),\n ),\n );\n };\n\nconst hasEveryName =\n (locals: readonly LocalProperty[]) =>\n (shape: LibraryShape): boolean => {\n const names: ReadonlySet<string> = new Set(shape.propertyNames);\n return pipe(\n locals,\n Arr.every((local) => names.has(local.name)),\n );\n };\n\nconst matchOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (locals: readonly LocalProperty[], shape: LibraryShape): Option.Option<ShapeMatch> => {\n const { checker } = context;\n const matches = shapeTypeOf(context)(shape).pipe(\n Option.exists((shapeType) =>\n pipe(\n locals,\n Arr.every((local) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(\n Option.exists(\n (library) =>\n declaredBy(shape)(library) &&\n sameProperty({ checker, open })(local.type, library),\n ),\n ),\n ),\n ),\n ),\n );\n if (!matches) {\n return Option.none();\n }\n return Option.some({ shape, extra: shape.propertyNames.length - locals.length });\n };\n\nconst localPropertiesOf =\n (checker: Checker) =>\n (symbols: readonly TypeSymbol[]): readonly LocalProperty[] =>\n pipe(\n Arr.zip(symbols, checker.getTypeOfSymbol(symbols)),\n Arr.map(([symbol, type]) => ({ name: symbol.name, type })),\n );\n\nconst matchOrder = Order.mapInput(Order.Number, (match: ShapeMatch) => match.extra);\n\nconst shapeProblem = (site: ShapeSite, matches: readonly ShapeMatch[]): Problem => {\n const shown = pipe(\n Arr.take(matches, CANDIDATE_LIMIT),\n Arr.map((match) => describeLibraryType(match.shape)),\n Arr.join(\", \"),\n );\n const advice = Option.match(\n Arr.findFirst(matches, (match) => match.extra === EXACT),\n {\n onNone: () =>\n \"Derive it from the library type, for example with Pick, instead of copying its properties.\",\n onSome: () => \"Use the library type instead of copying it.\",\n },\n );\n return problemAt({ rule: \"library-shape\", message: `This shape copies ${shown}. ${advice}` })(\n site.node,\n );\n};\n\nconst candidatesOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite, locals: readonly LocalProperty[]): readonly ShapeMatch[] => {\n const derived = derivedDeclarationsOf(context.checker)(site.node);\n const named = pipe(context.shapes, Arr.filter(hasEveryName(locals)));\n if (\n pipe(\n named,\n Arr.some((shape) => derived.has(declarationKey(shape.declaration))),\n )\n ) {\n return [];\n }\n const candidates = pipe(\n named,\n Arr.map((shape) => matchOf(context, open)(locals, shape)),\n Arr.getSomes,\n );\n return Arr.sort(candidates, matchOrder);\n };\n\nconst shapeProblemOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite): Option.Option<Problem> => {\n const symbols = context.checker.getPropertiesOfType(site.type);\n if (symbols.length < MINIMUM_SHAPE_PROPERTIES) {\n return Option.none();\n }\n const locals = localPropertiesOf(context.checker)(symbols);\n return Option.liftPredicate(\n candidatesOf(context, open)(site, locals),\n Arr.isReadonlyArrayNonEmpty,\n ).pipe(Option.map((found) => shapeProblem(site, found)));\n };\n\nexport const shapeProblemsIn =\n (context: ShapeContext) =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const sites = shapeSitesIn(context.checker)(sourceFile);\n if (!Arr.isReadonlyArrayNonEmpty(sites)) {\n return [];\n }\n const open = openTypeIdsOf(context.checker);\n return Arr.getSomes(\n pipe(\n sites,\n Arr.map((site) => shapeProblemOf(context, open)(site)),\n ),\n );\n };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isElementAccessExpression,\n isEnumDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n isSpreadElement,\n isTypeAliasDeclaration,\n isTypeReferenceNode,\n isUnionTypeNode,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n childrenOf,\n isInsideAny,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n symbolAtLocation,\n} from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface ValueSite {\n readonly node: Node;\n readonly values: readonly Value[];\n readonly sources: readonly TypeSymbol[];\n}\n\nconst namedValuesOf =\n (checker: Checker) =>\n (symbol: TypeSymbol): Option.Option<readonly Value[]> => {\n if (\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isTypeDeclaration(declaration)),\n )\n ) {\n return finiteValuesOf(checker)(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));\n };\n\nconst hasFiniteContext =\n (checker: Checker) =>\n (node: Expression): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst isNamedValue = (element: Expression): boolean => {\n if (isSpreadElement(element)) {\n return isNamedValue(element.expression);\n }\n return (\n isIdentifier(element) ||\n isPropertyAccessExpression(element) ||\n isElementAccessExpression(element)\n );\n};\n\nconst namesEveryElement = (array: ArrayLiteralExpression): boolean =>\n pipe(\n array.elements,\n Arr.every((element) => isNamedValue(element)),\n );\n\nconst expressionValuesOf =\n (checker: Checker) =>\n (node: Expression): Option.Option<readonly Value[]> => {\n if (hasFiniteContext(checker)(node)) {\n return Option.none();\n }\n const type = checker.getTypeAtLocation(node);\n if (isArrayLiteralExpression(node)) {\n return Option.liftPredicate(node, (array) => !namesEveryElement(array)).pipe(\n Option.flatMap(() => finiteValuesOf(checker)(type)),\n );\n }\n return schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf));\n };\n\nconst selectsKeys =\n (checker: Checker) =>\n (node: UnionTypeNode, values: readonly Value[]): boolean => {\n const { parent } = node;\n if (!isTypeReferenceNode(parent)) {\n return false;\n }\n const typeArguments: readonly TypeNode[] = parent.typeArguments ?? [];\n return pipe(\n typeArguments,\n Arr.filter((argument) => argument !== node),\n Arr.some((argument) =>\n isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument))),\n ),\n );\n };\n\nconst FILTERED_TYPE = 0;\n\nconst isConditionalAlias = (declaration: Node): boolean =>\n isTypeAliasDeclaration(declaration) && declaration.type.kind === SyntaxKind.ConditionalType;\n\nconst filtersBy =\n (checker: Checker) =>\n (node: Node): boolean => {\n const { parent } = node;\n const filtering =\n isTypeReferenceNode(parent) &&\n Arr.findFirstIndex(parent.typeArguments ?? [], (argument) => argument === node).pipe(\n Option.exists((position) => position > FILTERED_TYPE),\n ) &&\n symbolAtLocation(checker)(parent.typeName).pipe(\n Option.map(declarationsOf),\n Option.exists(Arr.some(isConditionalAlias)),\n );\n return filtering || (parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent));\n };\n\nconst unionValuesOf =\n (checker: Checker) =>\n (node: UnionTypeNode): Option.Option<readonly Value[]> =>\n literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(\n Option.filter((values) => !selectsKeys(checker)(node, values) && !filtersBy(checker)(node)),\n );\n\nconst isExpressionSite = (node: Node): node is ArrayLiteralExpression | CallExpression =>\n isArrayLiteralExpression(node) || isCallExpression(node);\n\nconst expressionSiteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> =>\n Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));\n\nconst siteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> => {\n if (isUnionTypeNode(node)) {\n return unionValuesOf(checker)(node);\n }\n if (isEnumDeclaration(node)) {\n return literalUnionOf(checker.getTypeAtLocation(node.name));\n }\n return expressionSiteValuesOf(checker)(node);\n };\n\nconst derivationScopeOf = (node: Node): Node => {\n if (isTypeReferenceNode(node.parent)) {\n return node.parent;\n }\n return node;\n};\n\nconst sourcesOf =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] =>\n pipe(\n referencedSymbols(checker)(derivationScopeOf(node)),\n Arr.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))),\n );\n\nexport const sitesUnder =\n (checker: Checker) =>\n (node: Node): readonly ValueSite[] => {\n const nested = pipe(\n childrenOf(node),\n Arr.flatMap((child) => sitesUnder(checker)(child)),\n );\n if (Arr.isReadonlyArrayNonEmpty(nested)) {\n return nested;\n }\n return siteValuesOf(checker)(node).pipe(\n Option.map((values) => ({ node, values, sources: sourcesOf(checker)(node) })),\n Option.toArray,\n );\n };\n\nexport const sitesOutside =\n (checker: Checker) =>\n (project: Project, outers: readonly Node[]): readonly ValueSite[] =>\n pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)),\n Arr.filter((site) => !isInsideAny(outers)(site.node)),\n );\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { describeLibraryType } from \"#/entities/project/index.ts\";\nimport type { LibraryVocabulary } from \"#/entities/project/index.ts\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n isInsideAny,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"#/shared/lib/syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { Flow } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\n\nexport interface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\nexport interface SiteVerdict {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst OWNER_SEARCH_DEPTH = 4;\nconst NOTHING_HIDDEN = 0;\n\nconst directOwners =\n (context: ValueContext) =>\n (symbol: TypeSymbol): readonly Owner[] => {\n const keys = Arr.getSomes(\n pipe(\n declarationsOf(symbol),\n Arr.map((declaration) => ownerKeyOf(declaration)),\n ),\n );\n return pipe(\n context.owners,\n Arr.filter((owner) => keys.includes(owner.key)),\n );\n };\n\nconst isFollowable = (declaration: Declaration): boolean =>\n !declaration.getSourceFile().isDeclarationFile &&\n (isTypeAliasDeclaration(declaration) || isVariableDeclaration(declaration));\n\nconst ownersBehind =\n (context: ValueContext) =>\n (symbol: TypeSymbol, ancestors: readonly TypeSymbol[]): readonly Owner[] => {\n const direct = directOwners(context)(symbol);\n if (Arr.isReadonlyArrayNonEmpty(direct) || ancestors.length >= OWNER_SEARCH_DEPTH) {\n return direct;\n }\n const visited = [...ancestors, symbol];\n return uniqueByReference(\n pipe(\n declarationsOf(symbol),\n Arr.filter((declaration) => isFollowable(declaration)),\n Arr.flatMap((declaration) => referencedSymbols(context.checker)(declaration)),\n Arr.filter((referenced) => !visited.includes(referenced)),\n Arr.flatMap((referenced) => ownersBehind(context)(referenced, visited)),\n ),\n );\n };\n\nconst describeOwners = (owners: readonly Owner[]): string =>\n pipe(\n owners,\n Arr.map((owner) => `${owner.conceptId} (${owner.name})`),\n Arr.join(\", \"),\n );\n\nconst verdict = (problems: readonly Problem[], unowned: readonly ValueSite[]): SiteVerdict => ({\n problems,\n unowned,\n});\n\nconst derivedVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = uniqueByReference(\n pipe(\n site.sources,\n Arr.flatMap((source) => ownersBehind(context)(source, [])),\n ),\n );\n const held = pipe(\n owners,\n Arr.flatMap((owner) => owner.values),\n );\n const added = pipe(\n site.values,\n Arr.filter((value) => !isSubsetOf([value], held)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(owners) || !Arr.isReadonlyArrayNonEmpty(added)) {\n return verdict([], []);\n }\n const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;\n return verdict([problemAt({ rule: \"owner-extension\", message })(site.node)], []);\n };\n\nconst libraryCandidates =\n (context: ValueContext) =>\n (site: ValueSite): readonly string[] => {\n const flowing = Arr.dedupe(\n pipe(\n context.flows,\n Arr.filter((flow) => flow.site.node === site.node),\n Arr.map((flow) => flow.target),\n ),\n );\n if (Arr.isReadonlyArrayNonEmpty(flowing)) {\n return flowing;\n }\n if (\n !pipe(\n site.values,\n Arr.some((value) => typeof value === \"string\"),\n )\n ) {\n return [];\n }\n const imported = importedModulesOf(site.node.getSourceFile());\n return Arr.dedupe(\n pipe(\n context.vocabularies,\n Arr.filter((library) => imported.includes(library.specifier)),\n Arr.filter((library) => isSubsetOf(site.values, library.vocabulary.values)),\n Arr.map((library) => describeLibraryType(library)),\n ),\n );\n };\n\nconst listCandidates = (candidates: readonly string[]): string => {\n const shown = pipe(Arr.take(candidates, CANDIDATE_LIMIT), Arr.join(\", \"));\n const hidden = candidates.length - CANDIDATE_LIMIT;\n if (hidden > NOTHING_HIDDEN) {\n return `${shown} and ${String(hidden)} more`;\n }\n return shown;\n};\n\nconst originalVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = pipe(\n context.owners,\n Arr.filter((owner) => isSubsetOf(site.values, owner.values)),\n );\n if (Arr.isReadonlyArrayNonEmpty(owners)) {\n const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;\n return verdict([problemAt({ rule: \"owner-value-set\", message })(site.node)], []);\n }\n const candidates = libraryCandidates(context)(site);\n if (Arr.isReadonlyArrayNonEmpty(candidates)) {\n const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;\n return verdict([problemAt({ rule: \"library-value-set\", message })(site.node)], []);\n }\n return verdict([], [site]);\n };\n\nexport const siteVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n if (Arr.isReadonlyArrayNonEmpty(site.sources)) {\n return derivedVerdict(context)(site);\n }\n return originalVerdict(context)(site);\n };\n\nconst VALUE_PARENT_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ReturnStatement,\n SyntaxKind.ArrayLiteralExpression,\n SyntaxKind.ConditionalExpression,\n SyntaxKind.ParenthesizedExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.JsxExpression,\n]);\n\nconst isCallArgument = (node: Node, parent: Node): boolean =>\n (isCallExpression(parent) || isNewExpression(parent)) && parent.expression !== node;\n\nconst isInitializer = (node: Node, parent: Node): boolean =>\n (isPropertyAssignment(parent) || isVariableDeclaration(parent)) && parent.initializer === node;\n\nconst isRightOperand = (node: Node, parent: Node): boolean =>\n isBinaryExpression(parent) && parent.right === node;\n\nconst VALUE_SLOTS = [isCallArgument, isInitializer, isRightOperand];\n\nconst isValuePosition = (node: Node): boolean => {\n const { parent } = node;\n return (\n VALUE_PARENT_KINDS.has(parent.kind) ||\n pipe(\n VALUE_SLOTS,\n Arr.some((isSlot) => isSlot(node, parent)),\n )\n );\n};\n\nconst ownedLiteralProblem =\n (context: ValueContext) =>\n (literal: StringLiteral | NumericLiteral): Option.Option<Problem> =>\n Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(\n Option.filter((contextual) =>\n vocabularyOf(context.checker)(contextual).pipe(\n Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues),\n ),\n ),\n Option.map(() =>\n pipe(\n contextSymbolsOf(context.checker)(literal),\n Arr.flatMap((symbol) => ownersBehind(context)(symbol, [])),\n uniqueByReference,\n Arr.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Arr.map(String)))),\n ),\n ),\n Option.filter((owners) => Arr.isReadonlyArrayNonEmpty(owners)),\n Option.map((owners) =>\n problemAt({\n rule: \"owned-literal\",\n message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`,\n })(literal),\n ),\n );\n\nexport const ownedLiteralProblems =\n (context: ValueContext) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly Problem[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isStringLiteral(node) || isNumericLiteral(node)),\n Arr.filter((node) => isValuePosition(node)),\n Arr.filter((node) => !isInsideAny(excluded)(node)),\n Arr.map((node) => ownedLiteralProblem(context)(node)),\n ),\n );\n","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport type { Project, SourceCheck } from \"#/entities/project/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { flowsIn } from \"./flows.ts\";\nimport { fileFactsIn } from \"./free-literals.ts\";\nimport type { FileFacts } from \"./free-literals.ts\";\nimport { outsideNameProblemsIn } from \"./outside-names.ts\";\nimport { ownerDeclarationsIn } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesOutside } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\nexport interface ProjectAnalysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n readonly literals: readonly FileFacts[];\n}\n\nconst isVisibleTo =\n (project: Project) =>\n (owner: Owner): boolean =>\n pipe(\n project.sourceFiles,\n Arr.some((sourceFile) => sourceFile.fileName === owner.file),\n ) ||\n Option.exists(\n owner.packageName,\n (name) =>\n Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name),\n );\n\nconst nodesOf = (sites: readonly ValueSite[]): readonly ValueSite[\"node\"][] =>\n pipe(\n sites,\n Arr.map((site) => site.node),\n );\n\nexport interface ProjectChecks {\n readonly owners: readonly Owner[];\n readonly sourceChecks: readonly SourceCheck[];\n}\n\nconst fileChecksOf = (\n project: Project,\n sourceChecks: readonly SourceCheck[],\n): readonly ReturnType<SourceCheck>[] => [\n shapeProblemsIn({\n checker: project.checker,\n program: project.program,\n shapes: project.library.shapes,\n }),\n outsideNameProblemsIn(project),\n ...pipe(\n sourceChecks,\n Arr.map((check) => check(project.checker)),\n ),\n];\n\nexport const analyzeProject =\n ({ owners, sourceChecks }: ProjectChecks) =>\n (project: Project): ProjectAnalysis => {\n const { checker } = project;\n const ownerDeclarations = ownerDeclarationsIn(owners)(project);\n const sites = sitesOutside(checker)(project, ownerDeclarations);\n const flowContext = { checker, program: project.program, sites };\n const context = {\n checker,\n owners: pipe(\n owners,\n Arr.filter((owner) => isVisibleTo(project)(owner)),\n ),\n vocabularies: project.library.vocabularies,\n flows: pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => flowsIn(flowContext)(sourceFile)),\n ),\n };\n const verdicts = pipe(\n sites,\n Arr.map((site) => siteVerdict(context)(site)),\n );\n const excluded = [...ownerDeclarations, ...nodesOf(sites)];\n const fileChecks = fileChecksOf(project, sourceChecks);\n return {\n problems: [\n ...pipe(\n verdicts,\n Arr.flatMap((found) => found.problems),\n ),\n ...pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => [\n ...ownedLiteralProblems(context)(sourceFile, excluded),\n ...pipe(\n fileChecks,\n Arr.flatMap((check) => check(sourceFile)),\n ),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n literals: fileFactsIn(checker)(project.sourceFiles, excluded),\n };\n };\n","import {\n Array as Arr,\n Effect,\n Option,\n Schema,\n SchemaTransformation,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { implementationFingerprint } from \"#/entities/project/index.ts\";\nimport type { ProjectInputs } from \"#/entities/project/index.ts\";\nimport { ProblemList } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst CACHE_DIRECTORY = [NODE_MODULES, \".cache\", \"msch\", \"value-owners\"] as const;\nconst CACHE_SUFFIX = \".json\";\nconst EMPTY = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nconst ValueSchema = Schema.Union([Schema.String, Schema.Finite]);\n\nconst Strings = Schema.Array(Schema.String);\n\nconst ScopeSchema = Schema.Struct({ name: Schema.String, dependencies: Strings });\n\nconst FileLiteralsSchema = Schema.Struct({\n scope: ScopeSchema,\n file: Schema.String,\n values: Strings,\n imports: Strings,\n});\n\nconst UnownedSiteSchema = Schema.Struct({\n scope: ScopeSchema,\n file: Schema.String,\n start: Schema.Int,\n line: Schema.Int,\n column: Schema.Int,\n values: Schema.Array(ValueSchema),\n});\n\nconst AnalysisSchema = Schema.Struct({\n problems: ProblemList,\n unowned: Schema.Array(UnownedSiteSchema),\n literals: Schema.Array(FileLiteralsSchema),\n});\n\nexport type Analysis = typeof AnalysisSchema.Type;\n\nexport type Hasher = (text: string) => Effect.Effect<string>;\n\nexport type FileDigest = (file: string) => Effect.Effect<string, never, RepositoryFiles>;\n\nexport interface AnalysisCache {\n readonly root: string;\n readonly directory: string;\n readonly salt: string;\n readonly digestFile: FileDigest;\n readonly hash: Hasher;\n}\n\nconst hasher = Effect.gen(function* currentHasher() {\n const files = yield* RepositoryFiles;\n const hash: Hasher = files.hash;\n return hash;\n});\n\nconst entryOf = (file: string, found: string): string => `${file}${FIELD_SEPARATOR}${found}`;\n\nconst fileDigest = (hash: Hasher): FileDigest => {\n const digests = new Map<string, string>();\n return (file) =>\n Option.match(Option.fromUndefinedOr(digests.get(file)), {\n onSome: Effect.succeed,\n onNone: () =>\n Effect.gen(function* readDigest() {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const found = yield* hash(Option.getOrElse(text, () => EMPTY));\n digests.set(file, found);\n return found;\n }),\n });\n};\n\nconst digestEntries =\n (digestFile: FileDigest) =>\n (\n named: readonly (readonly [string, string])[],\n ): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.forEach(\n named,\n ([name, file]) => digestFile(file).pipe(Effect.map((found) => entryOf(name, found))),\n { concurrency: 1 },\n );\n\nexport const analysisCache = Effect.fn(\"analysisCache\")(function* analysisCache(\n root: string,\n owners: string,\n) {\n const files = yield* RepositoryFiles;\n const hash = yield* hasher;\n const fingerprint = yield* implementationFingerprint(import.meta.dirname);\n const salt = yield* hash(\n Arr.join([fingerprint, Str.replaceAll(root, EMPTY)(owners)], FIELD_SEPARATOR),\n );\n return {\n root,\n directory: files.join(root, ...CACHE_DIRECTORY),\n salt,\n digestFile: fileDigest(hash),\n hash,\n } satisfies AnalysisCache;\n});\n\nexport const keyOf =\n (cache: AnalysisCache) =>\n (configPath: string, inputs: ProjectInputs): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* deriveKey() {\n const files = yield* RepositoryFiles;\n const entries = yield* digestEntries(cache.digestFile)(\n pipe(\n inputs.files,\n Arr.map((file) => [file, files.join(cache.root, file)] as const),\n ),\n );\n const header = [\n cache.salt,\n files.relative(cache.root, configPath),\n Str.replaceAll(cache.root, EMPTY)(inputs.options),\n ];\n return yield* cache.hash(\n Arr.join([...header, ...inputs.dependencies, ...entries], LINE_SEPARATOR),\n );\n });\n\nconst moved =\n (move: (file: string) => string) =>\n (analysis: Analysis): Analysis => ({\n problems: pipe(\n analysis.problems,\n Arr.map((problem) => ({ ...problem, file: move(problem.file) })),\n ),\n unowned: pipe(\n analysis.unowned,\n Arr.map((site) => ({ ...site, file: move(site.file) })),\n ),\n literals: pipe(\n analysis.literals,\n Arr.map((found) => ({\n ...found,\n file: move(found.file),\n imports: pipe(found.imports, Arr.map(move)),\n })),\n ),\n });\n\nconst entryFile = (cache: AnalysisCache, key: string): string =>\n `${cache.directory}/${key}${CACHE_SUFFIX}`;\n\nconst portableOf = (\n cache: AnalysisCache,\n files: typeof RepositoryFiles.Service,\n): SchemaTransformation.Transformation<Analysis, Analysis> =>\n SchemaTransformation.transform({\n decode: moved((file) => files.resolve(cache.root, file)),\n encode: moved((file) => files.relative(cache.root, file)),\n });\n\nconst codecOf = (\n cache: AnalysisCache,\n): Effect.Effect<Schema.Codec<Analysis, string>, never, RepositoryFiles> =>\n Effect.gen(function* buildCodec() {\n const files = yield* RepositoryFiles;\n const portable = AnalysisSchema.pipe(Schema.decodeTo(AnalysisSchema, portableOf(cache, files)));\n return Schema.fromJsonString(portable);\n });\n\nexport const readAnalysis =\n (cache: AnalysisCache) =>\n (key: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* readCached() {\n const files = yield* RepositoryFiles;\n const codec = yield* codecOf(cache);\n const text = yield* files.readFile(entryFile(cache, key));\n return yield* Option.match(text, {\n onNone: () => Effect.succeedNone,\n onSome: (found) => Schema.decodeEffect(codec)(found).pipe(Effect.option),\n });\n });\n\nexport const writeAnalysis =\n (cache: AnalysisCache) =>\n (key: string, analysis: Analysis): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* writeCached() {\n const files = yield* RepositoryFiles;\n const codec = yield* codecOf(cache);\n const text = yield* Schema.encodeEffect(codec)(analysis).pipe(Effect.option);\n yield* Option.match(text, {\n onNone: () => Effect.void,\n onSome: (found) => files.writeFile(entryFile(cache, key), found),\n });\n });\n\nexport const pruneAnalyses =\n (cache: AnalysisCache) =>\n (kept: readonly string[]): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* pruneCached() {\n const files = yield* RepositoryFiles;\n const keep = new Set(\n pipe(\n kept,\n Arr.map((key) => `${key}${CACHE_SUFFIX}`),\n ),\n );\n const present = yield* files.readDirectory(cache.directory);\n yield* pipe(\n present,\n Arr.filter((name) => !keep.has(name)),\n (items) =>\n Effect.forEach(items, (name) => files.removeFile(files.join(cache.directory, name)), {\n concurrency: 1,\n }),\n Effect.asVoid,\n );\n });\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { formatValues, valueKey } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\n\nexport interface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\nexport interface UnownedSite {\n readonly scope: PackageScope;\n readonly file: string;\n readonly start: number;\n readonly line: number;\n readonly column: number;\n readonly values: readonly Value[];\n}\n\nconst DUPLICATE_THRESHOLD = 1;\n\nexport const unownedSiteOf =\n (scope: PackageScope) =>\n (site: ValueSite): UnownedSite => ({\n scope,\n file: site.node.getSourceFile().fileName,\n start: site.node.getStart(),\n line: lineOf(site.node),\n column: columnOf(site.node),\n values: site.values,\n });\n\nconst canDerive = (left: UnownedSite, right: UnownedSite): boolean =>\n left.scope.name === right.scope.name ||\n left.scope.dependencies.includes(right.scope.name) ||\n right.scope.dependencies.includes(left.scope.name);\n\nconst siteKey = (site: UnownedSite): string => `${site.file}#${String(site.start)}`;\n\nconst valueSetKey = (site: UnownedSite): string => {\n const keys = pipe(\n site.values,\n Arr.map((value) => valueKey(value)),\n );\n return pipe(Arr.sort(keys, Order.String), Arr.join(\"\\0\"));\n};\n\nexport const duplicateProblems =\n (relative: (file: string) => string) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const unique = Arr.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));\n const groups = Rec.values(Arr.groupBy(unique, (site) => valueSetKey(site)));\n return pipe(\n groups,\n Arr.filter((group) => group.length > DUPLICATE_THRESHOLD),\n Arr.flatMap((group) =>\n pipe(\n group,\n Arr.flatMap((site): readonly Problem[] => {\n const related = pipe(\n group,\n Arr.filter((other) => other !== site && canDerive(site, other)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(related)) {\n return [];\n }\n const others = pipe(\n related,\n Arr.map((other) => `${relative(other.file)}:${String(other.line)}`),\n Arr.join(\", \"),\n );\n return [\n {\n file: site.file,\n line: site.line,\n column: site.column,\n rule: \"duplicate-value-set\",\n message: `The values ${formatValues(site.values)} are also declared at ${others}. Register one owner with /** @${OWNER_TAG} <concept> */ and derive the others from it.`,\n },\n ];\n }),\n ),\n ),\n );\n };\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { MINIMUM_NAMES, TEST_FILE, mostNamesOf, problemOf } from \"./name-lists.ts\";\nimport type { FileLiterals, NameList } from \"./name-lists.ts\";\n\nconst MOST_DEFINING_FILES = 2;\n\nconst SINGLE_NAME = 1;\n\nconst SHOWN_FILES = 3;\n\ninterface Defined {\n readonly scope: PackageScope;\n readonly file: string;\n}\n\ntype DefinedIndex = Readonly<Record<string, readonly Defined[]>>;\n\ntype NameFiles = readonly [string, readonly string[]];\n\nconst canDerive = (left: PackageScope, right: PackageScope): boolean =>\n left.name === right.name ||\n left.dependencies.includes(right.name) ||\n right.dependencies.includes(left.name);\n\nconst definitionsOf = (entry: FileLiterals): readonly (readonly [string, Defined])[] =>\n pipe(\n entry.values,\n Arr.map((value) => [value, { scope: entry.scope, file: entry.file }] as const),\n );\n\nconst uniqueFiles = (pairs: readonly (readonly [string, Defined])[]): readonly Defined[] =>\n pipe(\n pairs,\n Arr.map(([, defined]) => defined),\n Arr.dedupeWith((left, right) => left.file === right.file),\n );\n\nconst definedIndexOf = (files: readonly FileLiterals[]): DefinedIndex =>\n pipe(\n files,\n Arr.filter((entry) => !TEST_FILE.test(entry.file)),\n Arr.flatMap(definitionsOf),\n Arr.groupBy(([value]) => value),\n Rec.map(uniqueFiles),\n );\n\nconst ownedOneByOne = (defined: readonly NameFiles[]): readonly NameFiles[] => {\n const hosted = pipe(\n defined,\n Arr.flatMap(([, files]) => files),\n Arr.groupBy((file) => file),\n Rec.map((files) => files.length),\n );\n const hostsOne = (file: string): boolean =>\n Rec.get(hosted, file).pipe(Option.exists((count) => count === SINGLE_NAME));\n return pipe(\n defined,\n Arr.map(([name, files]) => [name, pipe(files, Arr.filter(hostsOne))] as const),\n );\n};\n\nconst filesDefining =\n (index: DefinedIndex, list: NameList) =>\n (name: string): NameFiles => {\n const files = pipe(\n Rec.get(index, name),\n Option.getOrElse((): readonly Defined[] => []),\n Arr.filter(\n (defined) => defined.file !== list.site.file && canDerive(list.site.scope, defined.scope),\n ),\n Arr.map((defined) => defined.file),\n );\n return [name, files];\n };\n\nconst definingFiles =\n (index: DefinedIndex) =>\n (list: NameList): readonly NameFiles[] =>\n pipe(\n list.names,\n Arr.map(filesDefining(index, list)),\n ownedOneByOne,\n Arr.filter(\n ([, files]) => Arr.isReadonlyArrayNonEmpty(files) && files.length <= MOST_DEFINING_FILES,\n ),\n );\n\nexport const declaredNameProblem = ({\n literals,\n relative,\n}: Readonly<{\n literals: readonly FileLiterals[];\n relative: (file: string) => string;\n}>): ((list: NameList) => Option.Option<Problem>) => {\n const index = definedIndexOf(literals);\n return (list) => {\n const defined = definingFiles(index)(list);\n const files = pipe(\n defined,\n Arr.flatMap(([, found]) => found),\n Arr.dedupe,\n );\n if (defined.length < mostNamesOf(list) || files.length < MINIMUM_NAMES) {\n return Option.none();\n }\n const names = pipe(\n defined,\n Arr.map(([name]) => name),\n );\n const shown = pipe(files, Arr.take(SHOWN_FILES), Arr.map(relative), Arr.join(\", \"));\n return Option.some(\n problemOf({\n list,\n reason: `${formatValues(names)} are each written in another module (${shown}). Type those values with this list, or build this list from them, so that adding one does not mean editing two places.`,\n }),\n );\n };\n};\n","import { Array as Arr, HashSet, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport { MINIMUM_NAMES, MISSING_ALLOWANCE, problemOf } from \"./name-lists.ts\";\nimport type { NameList } from \"./name-lists.ts\";\nimport type { RepositoryNames } from \"./repository-names.ts\";\n\nconst PATH_PREFIX = /^(?:!|\\.\\/)+/u;\n\nconst GLOB = /[*?{[]/u;\n\nconst EXTENSION = /\\.[^./]+$/u;\n\nconst SEPARATOR = \"/\";\n\nconst ROOT = \".\";\n\nconst namedPath =\n (repository: RepositoryNames, file: string) =>\n (name: string): Option.Option<string> => {\n const bare = pipe(name, Str.replace(PATH_PREFIX, \"\"));\n if (GLOB.test(bare) || Str.isEmpty(bare)) {\n return Option.none();\n }\n const fromFile = repository.relative(repository.join(repository.dirname(file), bare));\n return pipe(\n [fromFile, bare],\n Arr.findFirst((path) => HashSet.has(repository.paths, path)),\n );\n };\n\nconst kindOf =\n (repository: RepositoryNames) =>\n (path: string): string => {\n if (HashSet.has(repository.directories, path)) {\n return SEPARATOR;\n }\n return pipe(\n path,\n Str.match(EXTENSION),\n Option.flatMap(Arr.head),\n Option.getOrElse(() => path),\n );\n };\n\nconst siblingsOf =\n (repository: RepositoryNames) =>\n (path: string): readonly string[] =>\n pipe(\n Rec.get(repository.entries, repository.dirname(path)),\n Option.getOrElse((): readonly string[] => []),\n Arr.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)),\n );\n\nconst coversDirectory =\n (repository: RepositoryNames) =>\n (group: readonly string[]): boolean =>\n pipe(\n Arr.head(group),\n Option.exists(\n (first) =>\n group.length >=\n Math.max(MINIMUM_NAMES, siblingsOf(repository)(first).length - MISSING_ALLOWANCE),\n ),\n );\n\nconst enumeratedDirectory =\n (repository: RepositoryNames) =>\n (paths: readonly string[]): Option.Option<string> =>\n pipe(\n paths,\n Arr.groupBy((path) => `${repository.dirname(path)}${SEPARATOR}${kindOf(repository)(path)}`),\n Rec.values,\n Arr.findFirst(coversDirectory(repository)),\n Option.flatMap(Arr.head),\n Option.map(repository.dirname),\n );\n\nconst directoryLabel = (directory: string): string => {\n if (directory === ROOT) {\n return \"the repository root\";\n }\n return directory;\n};\n\nexport const listedPathProblem =\n (repository: RepositoryNames) =>\n (list: NameList): Option.Option<Problem> => {\n const paths = pipe(list.names, Arr.map(namedPath(repository, list.site.file)), Arr.getSomes);\n const packages = pipe(\n list.names,\n Arr.filter((name) => HashSet.has(repository.packages, name)),\n );\n const directory = enumeratedDirectory(repository)(paths);\n if (Option.isSome(directory)) {\n return Option.some(\n problemOf({\n list,\n reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`,\n }),\n );\n }\n if (packages.length >= MINIMUM_NAMES) {\n return Option.some(\n problemOf({\n list,\n reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`,\n }),\n );\n }\n return Option.none();\n };\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { formatValues, isSubsetOf, sameValues } from \"#/shared/lib/values.ts\";\n\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { problemOf } from \"./name-lists.ts\";\nimport type { FileLiterals, NameList } from \"./name-lists.ts\";\n\nconst SUBSET_SHARE = 2;\n\ntype ImportIndex = Readonly<Record<string, readonly string[]>>;\n\nconst canImport = (importer: PackageScope, imported: PackageScope): boolean =>\n importer.name === imported.name || importer.dependencies.includes(imported.name);\n\nconst importIndexOf = (files: readonly FileLiterals[]): ImportIndex =>\n pipe(\n files,\n Arr.map((entry) => [entry.file, entry.imports] as const),\n Rec.fromEntries,\n );\n\nconst imports =\n (index: ImportIndex) =>\n (importer: string, imported: string): boolean =>\n Rec.get(index, importer).pipe(Option.exists(Arr.contains(imported)));\n\nconst connected =\n (index: ImportIndex) =>\n (left: string, right: string): boolean =>\n left === right || imports(index)(left, right) || imports(index)(right, left);\n\nconst isPartOf =\n (index: ImportIndex, list: NameList) =>\n (other: NameList): boolean =>\n other !== list &&\n canImport(list.site.scope, other.site.scope) &&\n connected(index)(list.site.file, other.site.file) &&\n isSubsetOf(list.names, other.names) &&\n list.names.length * SUBSET_SHARE >= other.names.length &&\n !sameValues(list.names, other.names);\n\nexport const subsetListProblem = ({\n lists,\n literals,\n relative,\n}: Readonly<{\n lists: readonly NameList[];\n literals: readonly FileLiterals[];\n relative: (file: string) => string;\n}>): ((list: NameList) => Option.Option<Problem>) => {\n const index = importIndexOf(literals);\n return (list) =>\n pipe(\n lists,\n Arr.findFirst(isPartOf(index, list)),\n Option.map((other) =>\n problemOf({\n list,\n reason: `they are a part of ${formatValues(other.names)} at ${relative(other.site.file)}:${String(other.site.line)}. Name that list once and select from it with Extract or Exclude.`,\n }),\n ),\n );\n};\n","import { Array as Arr, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { declaredNameProblem } from \"./declared-names.ts\";\nimport type { UnownedSite } from \"./duplicates.ts\";\nimport { listedPathProblem } from \"./listed-paths.ts\";\nimport { nameListOf } from \"./name-lists.ts\";\nimport type { FileLiterals } from \"./name-lists.ts\";\nimport type { RepositoryNames } from \"./repository-names.ts\";\nimport { subsetListProblem } from \"./subset-lists.ts\";\n\nexport const handWrittenNameProblems =\n ({\n repository,\n literals,\n }: Readonly<{ repository: RepositoryNames; literals: readonly FileLiterals[] }>) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const lists = pipe(\n sites,\n Arr.dedupeWith((left, right) => left.file === right.file && left.start === right.start),\n Arr.map(nameListOf),\n Arr.getSomes,\n );\n const { relative } = repository;\n const checks = [\n listedPathProblem(repository),\n declaredNameProblem({ literals, relative }),\n subsetListProblem({ lists, literals, relative }),\n ];\n return pipe(\n lists,\n Arr.map((list) => Arr.findFirst(checks, (check) => check(list))),\n Arr.getSomes,\n );\n };\n","import { Array as Arr, Effect, HashSet, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nexport interface RepositoryNames {\n readonly root: string;\n readonly paths: HashSet.HashSet<string>;\n readonly directories: HashSet.HashSet<string>;\n readonly entries: Readonly<Record<string, readonly string[]>>;\n readonly packages: HashSet.HashSet<string>;\n readonly relative: (file: string) => string;\n readonly join: (...segments: readonly string[]) => string;\n readonly dirname: (file: string) => string;\n}\n\nconst MANIFEST = \"package.json\";\n\nconst SEPARATOR = \"/\";\n\nconst FIRST_SEGMENT = 1;\n\nconst ManifestJson = Schema.fromJsonString(\n Schema.Struct({ name: Schema.optionalKey(Schema.String) }),\n);\n\nconst decodeManifest = Schema.decodeUnknownOption(ManifestJson);\n\nconst prefixesOf = (file: string): readonly string[] => {\n const segments = pipe(file, Str.split(SEPARATOR));\n return pipe(\n Arr.range(FIRST_SEGMENT, segments.length),\n Arr.map((count) => pipe(Arr.take(segments, count), Arr.join(SEPARATOR))),\n );\n};\n\nconst directoriesOf = (file: string): readonly string[] =>\n pipe(prefixesOf(file), Arr.dropRight(FIRST_SEGMENT));\n\nconst nameOf = (text: Option.Option<string>): Option.Option<string> =>\n pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)),\n );\n\nexport const repositoryNamesOf = Effect.fn(\"repositoryNamesOf\")(function* repositoryNamesOf(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const names = yield* pipe(\n listed,\n Arr.filter((file) => files.basename(file) === MANIFEST),\n (items) =>\n Effect.forEach(\n items,\n (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)),\n { concurrency: 1 },\n ),\n );\n const paths = pipe(listed, Arr.flatMap(prefixesOf), Arr.dedupe);\n const repository: RepositoryNames = {\n root,\n paths: HashSet.fromIterable(paths),\n directories: HashSet.fromIterable(pipe(listed, Arr.flatMap(directoriesOf))),\n entries: pipe(paths, Arr.groupBy(files.dirname)),\n packages: HashSet.fromIterable(Arr.getSomes(names)),\n relative: (file) => files.relative(root, file),\n join: files.join,\n dirname: files.dirname,\n };\n return repository;\n});\n","import { Effect, Option, Schema, Array as Arr, pipe } from \"effect\";\n\nimport {\n listConfigFiles,\n mentions,\n projectInputs,\n typeScriptCompiler,\n withProject,\n} from \"#/entities/project/index.ts\";\nimport type { Project, SourceCheck, Workspace } from \"#/entities/project/index.ts\";\nimport { sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport type { ProjectChecks } from \"./analysis.ts\";\nimport { analysisCache, keyOf, pruneAnalyses, readAnalysis, writeAnalysis } from \"./cache.ts\";\nimport type { Analysis, AnalysisCache } from \"./cache.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { handWrittenNameProblems } from \"./hand-lists.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.ts\";\nimport { repositoryNamesOf } from \"./repository-names.ts\";\nimport type { RepositoryNames } from \"./repository-names.ts\";\n\nconst scanOwners = Effect.fn(\"scanOwners\")(function* scanOwners(\n workspace: Workspace,\n configPaths: readonly string[],\n) {\n const ownerConfigs = yield* pipe(\n configPaths,\n Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)),\n );\n const scans = yield* Effect.forEach(\n ownerConfigs,\n (configPath) =>\n withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))),\n { concurrency: 1 },\n );\n return combineOwnerScans(Arr.getSomes(scans));\n});\n\nconst scopeOf = (project: Project, configPath: string): PackageScope => ({\n name: Option.getOrElse(project.packageName, () => configPath),\n dependencies: project.workspaceDependencies,\n});\n\ninterface Context {\n readonly workspace: Workspace;\n readonly owners: readonly Owner[];\n readonly sourceChecks: readonly SourceCheck[];\n readonly cache: AnalysisCache;\n readonly listed: readonly string[];\n}\n\nconst freshAnalysis =\n ({ workspace, owners, sourceChecks }: Context) =>\n (configPath: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject({ owners, sourceChecks })(project);\n const scope = scopeOf(project, configPath);\n return {\n problems: analysis.problems,\n unowned: pipe(analysis.unowned, Arr.map(unownedSiteOf(scope))),\n literals: pipe(\n analysis.literals,\n Arr.map((entry) => ({ ...entry, scope })),\n ),\n };\n }).pipe(Effect.withSpan(\"analyzeProject\")),\n );\n\nconst keyedAnalysis =\n (context: Context) =>\n (\n configPath: string,\n key: string,\n ): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* lookupAnalysis() {\n const cached = yield* readAnalysis(context.cache)(key);\n if (Option.isSome(cached)) {\n return cached;\n }\n const fresh = yield* freshAnalysis(context)(configPath);\n yield* Option.match(fresh, {\n onNone: () => Effect.void,\n onSome: (analysis) => writeAnalysis(context.cache)(key, analysis),\n });\n return fresh;\n });\n\nconst analyzeConfig =\n (context: Context) =>\n (\n configPath: string,\n ): Effect.Effect<Option.Option<readonly [string, Analysis]>, never, RepositoryFiles> =>\n Effect.gen(function* analyzeOne() {\n const inputs = yield* projectInputs(context)(configPath);\n if (Option.isNone(inputs)) {\n return Option.none();\n }\n const key = yield* keyOf(context.cache)(configPath, inputs.value);\n const analysis = yield* keyedAnalysis(context)(configPath, key);\n return pipe(\n analysis,\n Option.map((found) => [key, found] as const),\n );\n });\n\nconst encodeOwners = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst cacheFor = Effect.fn(\"cacheFor\")(function* cacheFor(root: string, owners: readonly Owner[]) {\n const plain = pipe(\n owners,\n Arr.map((owner) => ({ ...owner, packageName: Option.getOrNull(owner.packageName) })),\n );\n const encoded = yield* encodeOwners(plain).pipe(Effect.orElseSucceed(() => \"\"));\n return yield* analysisCache(root, encoded);\n});\n\nconst analyzeProjects = Effect.fn(\"analyzeProjects\")(function* analyzeProjects(\n workspace: Workspace,\n { owners, sourceChecks }: ProjectChecks,\n configPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const cache = yield* cacheFor(workspace.root, owners);\n const listed = yield* files.listedFiles(workspace.root);\n const keyed = yield* Effect.forEach(\n configPaths,\n analyzeConfig({ workspace, owners, sourceChecks, cache, listed }),\n {\n concurrency: 1,\n },\n );\n const found = Arr.getSomes(keyed);\n yield* pruneAnalyses(cache)(\n pipe(\n found,\n Arr.map(([key]) => key),\n ),\n );\n return pipe(\n found,\n Arr.map(([, analysis]) => analysis),\n );\n});\n\nconst repositoryProblems =\n (repository: RepositoryNames) =>\n (analyses: readonly Analysis[]): readonly Problem[] => {\n const unowned = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.unowned),\n );\n const literals = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.literals),\n );\n return [\n ...pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.problems),\n ),\n ...duplicateProblems(repository.relative)(unowned),\n ...handWrittenNameProblems({ repository, literals })(unowned),\n ];\n };\n\nexport const checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(\n root: string,\n sourceChecks: readonly SourceCheck[] = [],\n) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const generated = yield* files.generatedFiles(root);\n const workspace: Workspace = { compiler, root, generated };\n const configPaths = yield* listConfigFiles(root);\n const ownerScan: OwnerScan = yield* scanOwners(workspace, configPaths);\n const analyses = yield* analyzeProjects(\n workspace,\n { owners: ownerScan.owners, sourceChecks },\n configPaths,\n );\n const repository = yield* repositoryNamesOf(root);\n return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);\n}, Effect.scoped);\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n SyntaxKind,\n isIdentifier,\n isImportDeclaration,\n isStringLiteral,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type { Node, SourceFile, VariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf } from \"#/shared/lib/syntax.ts\";\n\nconst RULE: RuleName = \"namespace-destructuring\";\nconst LOCAL = /^[.#/]/u;\n\nconst messageOf = (name: string): string =>\n `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;\n\nconst isPackage = (specifier: Node): boolean =>\n isStringLiteral(specifier) && !LOCAL.test(specifier.text);\n\nconst importedNames = (sourceFile: SourceFile): readonly string[] => {\n const bindings = pipe(\n sourceFile.statements,\n Arr.filter(isImportDeclaration),\n Arr.filter((declaration) => isPackage(declaration.moduleSpecifier)),\n Arr.map((declaration) => Option.fromUndefinedOr(declaration.importClause)),\n Arr.getSomes,\n Arr.filter((clause) => clause.phaseModifier !== SyntaxKind.TypeKeyword),\n Arr.map((clause) => Option.fromUndefinedOr(clause.namedBindings)),\n Arr.getSomes,\n );\n return pipe(\n bindings,\n Arr.flatMap((binding) => {\n if (binding.kind === SyntaxKind.NamespaceImport) {\n return [binding.name.text];\n }\n return pipe(\n binding.elements,\n Arr.filter((element) => !element.isTypeOnly),\n Arr.map((element) => element.name.text),\n );\n }),\n );\n};\n\nconst destructuredName = (declaration: VariableDeclaration): Option.Option<string> => {\n if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) {\n return Option.none();\n }\n return pipe(\n Option.fromUndefinedOr(declaration.initializer),\n Option.filter(isIdentifier),\n Option.map((initializer) => initializer.text),\n );\n};\n\nconst problemOf =\n (names: readonly string[]) =>\n (declaration: VariableDeclaration): Option.Option<Problem> =>\n pipe(\n destructuredName(declaration),\n Option.filter((name) => names.includes(name)),\n Option.map((name) => problemAt({ rule: RULE, message: messageOf(name) })),\n Option.map((report) => report(declaration)),\n );\n\nexport const namespaceDestructuringIn =\n () =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const names = importedNames(sourceFile);\n return pipe(\n descendantsOf(sourceFile),\n Arr.filter(isVariableDeclaration),\n Arr.map(problemOf(names)),\n Arr.getSomes,\n );\n };\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport {\n SignatureKind,\n SyntaxKind,\n isArrowFunction,\n isBlock,\n isCallExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isIdentifier,\n isNewExpression,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isReturnStatement,\n isSpreadElement,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n ArrowFunction,\n CallExpression,\n Checker,\n Expression,\n FunctionDeclaration,\n FunctionExpression,\n Identifier,\n Node,\n ParameterDeclaration,\n SourceFile,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf, symbolAtLocation } from \"#/shared/lib/syntax.ts\";\n\ntype Wrapper = FunctionDeclaration | ArrowFunction | FunctionExpression;\n\ninterface Forward {\n readonly node: Expression;\n readonly callee: Expression;\n readonly kind: SignatureKind;\n readonly arguments: readonly Expression[];\n readonly typed: boolean;\n readonly optional: boolean;\n}\n\ninterface Candidate {\n readonly name: Identifier;\n readonly wrapper: Wrapper;\n}\n\nconst RULE: RuleName = \"pass-through-wrapper\";\nconst SINGLE_STATEMENT = 1;\nconst SINGLE_DECLARATION = 1;\nconst THIS_PARAMETER = \"this\";\nconst NO_ARGUMENTS: readonly Expression[] = [];\n\nconst messageOf = (callee: string): string =>\n `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;\n\nconst unwrapped = (expression: Expression): Expression => {\n if (isParenthesizedExpression(expression)) {\n return unwrapped(expression.expression);\n }\n return expression;\n};\n\nconst isWrapperExpression = (\n expression: Expression,\n): expression is ArrowFunction | FunctionExpression =>\n isArrowFunction(expression) || isFunctionExpression(expression);\n\nconst candidateOf = (node: Node): Option.Option<Candidate> => {\n if (isFunctionDeclaration(node)) {\n return pipe(\n Option.fromUndefinedOr(node.name),\n Option.map((name) => ({ name, wrapper: node })),\n );\n }\n if (!isVariableDeclaration(node) || !isIdentifier(node.name)) {\n return Option.none();\n }\n const { name } = node;\n return pipe(\n Option.fromUndefinedOr(node.initializer),\n Option.map(unwrapped),\n Option.filter(isWrapperExpression),\n Option.map((wrapper) => ({ name, wrapper })),\n );\n};\n\nconst changesTheCall = (wrapper: Wrapper): boolean =>\n Predicate.isNotUndefined(wrapper.asteriskToken) ||\n Option.exists(\n Option.fromUndefinedOr(wrapper.type),\n (type) => type.kind === SyntaxKind.TypePredicate,\n ) ||\n pipe(\n wrapper.modifiers ?? [],\n Arr.some((modifier) => modifier.kind === SyntaxKind.AsyncKeyword),\n );\n\nconst returnedExpression = (wrapper: Wrapper): Option.Option<Expression> => {\n const { body } = wrapper;\n if (Predicate.isUndefined(body)) {\n return Option.none();\n }\n if (!isBlock(body)) {\n return Option.some(body);\n }\n if (body.statements.length !== SINGLE_STATEMENT) {\n return Option.none();\n }\n return pipe(\n Arr.head(body.statements),\n Option.filter((statement) => isReturnStatement(statement)),\n Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)),\n );\n};\n\nconst callForward = (call: CallExpression): Forward => ({\n node: call,\n callee: call.expression,\n kind: SignatureKind.Call,\n arguments: call.arguments,\n typed: Predicate.isNotUndefined(call.typeArguments),\n optional: Predicate.isNotUndefined(call.questionDotToken),\n});\n\nconst forwardOf = (expression: Expression): Option.Option<Forward> => {\n const inner = unwrapped(expression);\n if (isCallExpression(inner)) {\n return Option.some(callForward(inner));\n }\n if (isNewExpression(inner)) {\n return Option.some({\n node: inner,\n callee: inner.expression,\n kind: SignatureKind.Construct,\n arguments: inner.arguments ?? NO_ARGUMENTS,\n typed: Predicate.isNotUndefined(inner.typeArguments),\n optional: false,\n });\n }\n return Option.none();\n};\n\nconst rootOf = (callee: Expression): Option.Option<Identifier> => {\n if (isIdentifier(callee)) {\n return Option.some(callee);\n }\n if (\n isPropertyAccessExpression(callee) &&\n Predicate.isUndefined(callee.questionDotToken) &&\n isIdentifier(callee.name)\n ) {\n return rootOf(callee.expression);\n }\n return Option.none();\n};\n\nconst parameterName = (parameter: ParameterDeclaration): Option.Option<string> => {\n const { name } = parameter;\n if (\n !isIdentifier(name) ||\n Predicate.isNotUndefined(parameter.initializer) ||\n name.text === THIS_PARAMETER\n ) {\n return Option.none();\n }\n return Option.some(name.text);\n};\n\nconst isRest = (parameter: ParameterDeclaration): boolean =>\n Predicate.isNotUndefined(parameter.dotDotDotToken);\n\nconst forwardsParameter = ([parameter, name, argument]: readonly [\n ParameterDeclaration,\n string,\n Expression,\n]): boolean => {\n if (!isRest(parameter)) {\n return isIdentifier(argument) && argument.text === name;\n }\n return (\n isSpreadElement(argument) &&\n isIdentifier(argument.expression) &&\n argument.expression.text === name\n );\n};\n\nconst forwardedNames = (wrapper: Wrapper, forward: Forward): Option.Option<readonly string[]> => {\n const { parameters } = wrapper;\n const names = pipe(parameters, Arr.map(parameterName), Arr.getSomes);\n if (names.length !== parameters.length || forward.arguments.length !== parameters.length) {\n return Option.none();\n }\n const triples = Arr.zipWith(\n Arr.zip(parameters, names),\n forward.arguments,\n ([parameter, name], argument) => [parameter, name, argument] as const,\n );\n return pipe(\n Option.some(names),\n Option.filter(() => pipe(triples, Arr.every(forwardsParameter))),\n );\n};\n\nconst calleeTakesExactly =\n (checker: Checker) =>\n (forward: Forward, count: number): boolean => {\n const signatures = checker.getSignaturesOfType(\n checker.getTypeAtLocation(forward.callee),\n forward.kind,\n );\n return (\n Arr.isReadonlyArrayNonEmpty(signatures) &&\n pipe(\n signatures,\n Arr.every(\n (signature) =>\n !signature.hasRestParameter &&\n signature.parameters.length === count &&\n !Arr.isReadonlyArrayNonEmpty(signature.typeParameters ?? []),\n ),\n )\n );\n };\n\nconst keepsTheReturnType =\n (checker: Checker) =>\n (wrapper: Wrapper, forward: Forward): boolean =>\n Option.match(Option.fromUndefinedOr(wrapper.type), {\n onNone: () => true,\n onSome: (type) =>\n checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id,\n });\n\nconst isOverloaded =\n (checker: Checker) =>\n (name: Identifier): boolean =>\n Option.exists(\n symbolAtLocation(checker)(name),\n (symbol) => symbol.declarations.length > SINGLE_DECLARATION,\n );\n\nconst callsAnotherFunction = (\n { name }: Candidate,\n forward: Forward,\n names: readonly string[],\n): boolean =>\n Option.exists(\n rootOf(forward.callee),\n (root) => root.text !== name.text && !names.includes(root.text),\n );\n\nconst isPassThrough =\n (checker: Checker) =>\n (candidate: Candidate) =>\n (forward: Forward): boolean => {\n const { wrapper, name } = candidate;\n if (forward.typed || forward.optional) {\n return false;\n }\n const restForwarded = pipe(wrapper.parameters, Arr.some(isRest));\n return (\n Option.exists(forwardedNames(wrapper, forward), (names) =>\n callsAnotherFunction(candidate, forward, names),\n ) &&\n (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) &&\n keepsTheReturnType(checker)(wrapper, forward) &&\n !isOverloaded(checker)(name)\n );\n };\n\nconst problemOf =\n (checker: Checker) =>\n (candidate: Candidate): Option.Option<Problem> => {\n if (changesTheCall(candidate.wrapper)) {\n return Option.none();\n }\n return pipe(\n returnedExpression(candidate.wrapper),\n Option.flatMap(forwardOf),\n Option.filter(isPassThrough(checker)(candidate)),\n Option.map((forward) =>\n problemAt({ rule: RULE, message: messageOf(forward.callee.getText()) })(candidate.name),\n ),\n );\n };\n\nexport const passThroughWrappersIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly Problem[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.map(candidateOf),\n Arr.getSomes,\n Arr.map(problemOf(checker)),\n Arr.getSomes,\n );\n","import { checkRepository } from \"#/features/check-value-owners/index.ts\";\nimport { namespaceDestructuringIn } from \"#/features/source-code/find-namespace-destructuring/index.ts\";\nimport { passThroughWrappersIn } from \"#/features/source-code/find-pass-through-wrappers/index.ts\";\n\n/** @internal */\nexport const checkSources = (root: string): ReturnType<typeof checkRepository> =>\n checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);\n","","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport marketplace from \"#/shared/config/masseater-marketplace.json\" with { type: \"json\" };\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"known-plugins\";\nconst SETTINGS_FILE = \".claude/settings.json\";\nconst GITHUB = \"github\";\n\nconst Source = Schema.Struct({ source: Schema.String, repo: Schema.optionalKey(Schema.String) });\nconst KnownMarketplace = Schema.Struct({ source: Source });\nconst Marketplaces = Schema.Record(Schema.String, KnownMarketplace);\nconst Plugins = Schema.Record(Schema.String, Schema.Boolean);\nconst SettingsSchema = Schema.Struct({\n extraKnownMarketplaces: Schema.optionalKey(Marketplaces),\n enabledPlugins: Schema.optionalKey(Plugins),\n});\nconst decodeSettings = Schema.decodeUnknownOption(Schema.fromJsonString(SettingsSchema));\n\ntype Settings = typeof SettingsSchema.Type;\n\nconst REPOSITORY_NAME = \"masseater/masseater.dev\";\nconst MARKETPLACE = marketplace.name;\nconst PLUGINS = pipe(\n marketplace.plugins,\n Arr.map(({ name }) => `${name}@${MARKETPLACE}`),\n);\n\nconst problem = problemInFile(RULE);\n\nconst fromGithub = ({ source }: typeof KnownMarketplace.Type): boolean =>\n source.source === GITHUB && source.repo === REPOSITORY_NAME;\n\nconst marketplaceKnown = (settings: Settings): boolean =>\n pipe(\n Option.fromUndefinedOr(settings.extraKnownMarketplaces),\n Option.flatMap(Rec.get(MARKETPLACE)),\n Option.exists(fromGithub),\n );\n\nconst pluginEnabled =\n (settings: Settings) =>\n (plugin: string): boolean =>\n pipe(\n Option.fromUndefinedOr(settings.enabledPlugins),\n Option.flatMap(Rec.get(plugin)),\n Option.getOrElse(() => false),\n );\n\nconst marketplaceProblems = (file: string, settings: Settings): readonly Problem[] => {\n if (marketplaceKnown(settings)) {\n return [];\n }\n return [\n problem(\n file,\n `Agents miss masseater's own tools when the ${MARKETPLACE} marketplace is not known. Add \"extraKnownMarketplaces\": { \"${MARKETPLACE}\": { \"source\": { \"source\": \"${GITHUB}\", \"repo\": \"${REPOSITORY_NAME}\" } } }.`,\n ),\n ];\n};\n\nconst pluginProblems = (file: string, settings: Settings): readonly Problem[] => {\n const enabled = pluginEnabled(settings);\n return pipe(\n PLUGINS,\n Arr.filter((plugin) => !enabled(plugin)),\n Arr.map((plugin) =>\n problem(file, `Enable \"${plugin}\" in \"enabledPlugins\" so every session gets it.`),\n ),\n );\n};\n\n/** @internal */\nexport const checkKnownPlugins = Effect.fn(\"checkKnownPlugins\")(function* checkKnownPlugins(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, SETTINGS_FILE);\n const text = yield* files.readFile(file);\n const settings = pipe(\n text,\n Option.flatMap(decodeSettings),\n Option.getOrElse((): Settings => ({})),\n );\n return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"missing-hook\";\nconst SETTINGS_FILE = /^\\.claude\\/settings\\.json$/u;\nconst PLUGIN_HOOKS_FILE = /(?:^|\\/)hooks\\/hooks\\.json$/u;\nconst PROJECT_PATH =\n /(?<optional>--env-file-if-exists=)?\\$\\{?CLAUDE_PROJECT_DIR\\}?(?:\\\\\")?\\/(?<path>[\\w.@/-]+)/gu;\nconst PLUGIN_PATH =\n /(?<optional>--env-file-if-exists=)?\\$\\{?CLAUDE_PLUGIN_ROOT\\}?(?:\\\\\")?\\/(?<path>[\\w.@/-]+)/gu;\nconst PLUGIN_ROOT = \"..\";\nconst READ_CONCURRENCY = 16;\n\ninterface HookFile {\n readonly root: string;\n readonly file: string;\n readonly base: string;\n readonly pattern: RegExp;\n}\n\ninterface Reference {\n readonly path: string;\n readonly index: number;\n}\n\nconst START = 0;\n\nconst referenceOf = (found: RegExpMatchArray): readonly Reference[] =>\n pipe(\n groupOf(\"path\")(found),\n Option.filter(() => Option.isNone(groupOf(\"optional\")(found))),\n Option.map((path): Reference => ({ path, index: found.index ?? START })),\n Option.toArray,\n );\n\nconst referencesIn = (pattern: RegExp, source: string): readonly Reference[] =>\n pipe(Arr.fromIterable(Str.matchAll(pattern)(source)), Arr.flatMap(referenceOf));\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn({\n root,\n file,\n base,\n pattern,\n}: HookFile) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return [];\n }\n const source = text.value;\n const absent = yield* Effect.filter(referencesIn(pattern, source), ({ path }) =>\n files.exists(files.join(base, path)).pipe(Effect.map((exists) => !exists)),\n );\n const targetOf = ({ path }: Reference): string => files.join(base, path);\n const built = yield* files.ignoredPaths(root, pipe(absent, Arr.map(targetOf)));\n const missing = pipe(\n absent,\n Arr.filter((reference) => !Arr.contains(built, targetOf(reference))),\n );\n return pipe(\n missing,\n Arr.map(({ path, index }): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkMissingHooks = Effect.fn(\"checkMissingHooks\")(function* checkMissingHooks(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const hookFiles = pipe(\n listed,\n Arr.flatMap((name): readonly HookFile[] => {\n const file = files.join(root, name);\n if (SETTINGS_FILE.test(name)) {\n return [{ root, file, base: root, pattern: PROJECT_PATH }];\n }\n if (PLUGIN_HOOKS_FILE.test(name)) {\n return [\n { root, file, base: files.join(files.dirname(file), PLUGIN_ROOT), pattern: PLUGIN_PATH },\n ];\n }\n return [];\n }),\n );\n const found = yield* Effect.forEach(hookFiles, problemsIn, { concurrency: READ_CONCURRENCY });\n return Arr.flatten(found);\n});\n","import { Context, Effect, Option, Schema, Stream, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nconst SUCCESS = 0;\n\nconst PackageSchema = Schema.Struct({ name: Schema.optional(Schema.String) });\nconst TaskSchema = Schema.Struct({ package: Schema.String, name: Schema.String });\n\nconst TaskGraphSchema = Schema.Struct({\n packages: Schema.Record(Schema.String, PackageSchema),\n tasks: Schema.Record(Schema.String, TaskSchema),\n});\n\nexport type TaskGraph = typeof TaskGraphSchema.Type;\n\nconst decodeGraph = Schema.decodeUnknownOption(Schema.fromJsonString(TaskGraphSchema));\n\n/** @internal */\nexport const listedTasks = Effect.fn(\"listedTasks\")(\n function* listedTasks(root: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"run\", \"--json\"], {\n cwd: root,\n extendEnv: true,\n stdin: \"ignore\",\n stderr: \"ignore\",\n });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return pipe(\n Option.liftPredicate(text, () => Number(code) === SUCCESS),\n Option.flatMap(decodeGraph),\n );\n },\n Effect.scoped,\n Effect.orElseSucceed(() => Option.none<TaskGraph>()),\n);\n\nexport const GivenTaskGraph = Context.Reference<Option.Option<TaskGraph>>(\"msch/GivenTaskGraph\", {\n defaultValue: () => Option.none(),\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { GivenTaskGraph, listedTasks } from \"./task-graph.ts\";\nimport type { TaskGraph } from \"./task-graph.ts\";\n\nconst RULE: RuleName = \"documented-commands\";\nconst DOCUMENTS = [\"*AGENTS.md\", \"*CLAUDE.md\"];\nconst DOCUMENT_NAMES: ReadonlySet<string> = new Set([\"AGENTS.md\", \"CLAUDE.md\"]);\nconst COMMAND = /`vp run (?<args>[^`]+)`/gu;\nconst COMMAND_START = \"`vp run \";\nconst ARGS = \"args\";\nconst PLACEHOLDER = /[<>*{}$]/u;\nconst WHITESPACE = /\\s+/u;\nconst ROOT = \".\";\nconst SEPARATOR = \"/\";\nconst END_OF_OPTIONS = \"--\";\nconst FLAG = \"-\";\nconst TASK_SEPARATOR = \"#\";\nconst LOCAL_PREFIX = \"./\";\nconst FILTER_FLAGS: ReadonlySet<string> = new Set([\"--filter\", \"-F\"]);\nconst FILTER_ASSIGNMENT = \"--filter=\";\nconst RECURSIVE_FLAGS: ReadonlySet<string> = new Set([\"-r\", \"--recursive\"]);\nconst ROOT_FLAGS: ReadonlySet<string> = new Set([\"-w\", \"--workspace-root\"]);\nconst ONE = 1;\nconst START = 0;\n\ntype Scope =\n | { readonly kind: \"here\" }\n | { readonly kind: \"root\" }\n | { readonly kind: \"anywhere\" }\n | { readonly kind: \"package\"; readonly name: string };\n\ninterface Invocation {\n readonly task: string;\n readonly scope: Scope;\n}\n\ninterface Document {\n readonly file: string;\n readonly text: string;\n}\n\nconst optionsOf = (args: string): readonly string[] =>\n pipe(\n Str.split(Str.trim(args), WHITESPACE),\n Arr.takeWhile((token) => token !== END_OF_OPTIONS),\n );\n\nconst filterOf = (tokens: readonly string[]): Option.Option<string> =>\n pipe(\n tokens,\n Arr.findFirstIndex((token) => FILTER_FLAGS.has(token)),\n Option.flatMap((index) => Arr.get(tokens, index + ONE)),\n Option.orElse(() =>\n pipe(\n tokens,\n Arr.findFirst(Str.startsWith(FILTER_ASSIGNMENT)),\n Option.map(Str.slice(FILTER_ASSIGNMENT.length)),\n ),\n ),\n );\n\nconst follows =\n (tokens: readonly string[]) =>\n (index: number): boolean =>\n pipe(\n Arr.get(tokens, index - ONE),\n Option.exists((previous) => FILTER_FLAGS.has(previous)),\n );\n\nconst specifierOf = (tokens: readonly string[]): Option.Option<string> =>\n pipe(\n tokens,\n Arr.findFirstIndex((token, index) => !Str.startsWith(FLAG)(token) && !follows(tokens)(index)),\n Option.flatMap((index) => Arr.get(tokens, index)),\n );\n\nconst hasAny =\n (flags: ReadonlySet<string>) =>\n (tokens: readonly string[]): boolean =>\n pipe(\n tokens,\n Arr.some((token) => flags.has(token)),\n );\n\nconst scopeOf = (tokens: readonly string[]): Scope => {\n const filter = filterOf(tokens);\n if (Option.isSome(filter)) {\n return { kind: \"package\", name: filter.value };\n }\n if (hasAny(RECURSIVE_FLAGS)(tokens)) {\n return { kind: \"anywhere\" };\n }\n if (hasAny(ROOT_FLAGS)(tokens)) {\n return { kind: \"root\" };\n }\n return { kind: \"here\" };\n};\n\nconst invocationOf =\n (tokens: readonly string[]) =>\n (specifier: string): Invocation => {\n const [owner, ...rest] = Str.split(specifier, TASK_SEPARATOR);\n return pipe(\n Arr.head(rest),\n Option.match({\n onNone: (): Invocation => ({ task: specifier, scope: scopeOf(tokens) }),\n onSome: (task): Invocation => ({ task, scope: { kind: \"package\", name: owner } }),\n }),\n );\n };\n\nconst parsed = (args: string): Option.Option<Invocation> => {\n const tokens = optionsOf(args);\n return pipe(\n specifierOf(tokens),\n Option.filter(\n () =>\n !pipe(\n tokens,\n Arr.some((token) => PLACEHOLDER.test(token)),\n ),\n ),\n Option.map(invocationOf(tokens)),\n );\n};\n\nconst ancestorsOf = (file: string): readonly string[] => {\n const parts = pipe(Str.split(file, SEPARATOR), Arr.dropRight(ONE));\n return [\n ...Arr.makeBy(parts.length, (index) =>\n pipe(parts, Arr.take(parts.length - index), Arr.join(SEPARATOR)),\n ),\n ROOT,\n ];\n};\n\nconst named =\n (graph: TaskGraph, name: string) =>\n (directory: string): boolean =>\n directory === Str.replace(LOCAL_PREFIX, \"\")(name) ||\n pipe(\n Rec.get(graph.packages, directory),\n Option.exists((found) => found.name === name),\n );\n\nconst packagesOf =\n (graph: TaskGraph, file: string) =>\n (scope: Scope): readonly string[] => {\n const directories = Rec.keys(graph.packages);\n if (scope.kind === \"anywhere\") {\n return directories;\n }\n if (scope.kind === \"root\") {\n return [ROOT];\n }\n if (scope.kind === \"package\") {\n return pipe(directories, Arr.filter(named(graph, scope.name)));\n }\n return pipe(\n ancestorsOf(file),\n Arr.findFirst((directory) => Rec.has(graph.packages, directory)),\n Option.toArray,\n );\n };\n\nconst hasTask =\n (graph: TaskGraph, task: string) =>\n (directory: string): boolean =>\n pipe(\n Rec.values(graph.tasks),\n Arr.some((found) => found.package === directory && found.name === task),\n );\n\nconst whereOf = (scope: Scope, file: string): string => {\n if (scope.kind === \"anywhere\") {\n return \"any package\";\n }\n if (scope.kind === \"root\") {\n return \"the workspace root\";\n }\n if (scope.kind === \"package\") {\n return `package ${scope.name}`;\n }\n return `the package that holds ${file}`;\n};\n\nconst isMissing =\n (graph: TaskGraph, file: string) =>\n ({ task, scope }: Invocation): boolean =>\n !pipe(packagesOf(graph, file)(scope), Arr.some(hasTask(graph, task)));\n\nconst problemsIn = (\n graph: TaskGraph,\n absolute: (file: string) => string,\n { file, text }: Document,\n): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(COMMAND)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap(Rec.get(ARGS)),\n Option.flatMap(parsed),\n Option.filter(isMissing(graph, file)),\n Option.map(({ task, scope }): Problem => ({\n file: absolute(file),\n ...positionOf(text)(match.index ?? START),\n rule: RULE,\n message: `${match[START]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`,\n })),\n Option.toArray,\n ),\n ),\n );\n\nconst isDocument = (file: string): boolean =>\n pipe(\n Str.split(file, SEPARATOR),\n Arr.last,\n Option.exists((name) => DOCUMENT_NAMES.has(name)),\n );\n\n/** @internal */\nexport const checkDocumentedCommands = Effect.fn(\"checkDocumentedCommands\")(\n function* checkDocumentedCommands(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.trackedFiles(root, DOCUMENTS);\n const documents = yield* Effect.forEach(\n pipe(listed, Arr.filter(isDocument)),\n (file) =>\n files\n .readFile(files.join(root, file))\n .pipe(Effect.map(Option.map((text): Document => ({ file, text })))),\n { concurrency: \"unbounded\" },\n );\n const commanded = pipe(\n Arr.getSomes(documents),\n Arr.filter(({ text }) => Str.includes(COMMAND_START)(text)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(commanded)) {\n return [];\n }\n const given = yield* GivenTaskGraph;\n const graph = yield* Option.match(given, {\n onNone: () => listedTasks(root),\n onSome: Effect.succeedSome,\n });\n const absolute = (file: string): string => files.join(root, file);\n return Option.match(graph, {\n onNone: (): readonly Problem[] => [\n {\n file: absolute(Arr.headNonEmpty(commanded).file),\n line: ONE,\n column: ONE,\n rule: RULE,\n message: \"msch could not list the tasks with `vp run --json`\",\n },\n ],\n onSome: (found) =>\n pipe(\n commanded,\n Arr.flatMap((document) => problemsIn(found, absolute, document)),\n ),\n });\n },\n);\n","import { fileURLToPath } from \"node:url\";\n\nimport { Array as Arr, Effect, Schema, Stream, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"legacy-web\";\nconst FIRST_COLUMN = 1;\nconst SCANNER = fileURLToPath(\n new URL(\n \"./skills/modern-web-guidance/modern-web.mjs\",\n import.meta.resolve(\"modern-web-guidance/package.json\"),\n ),\n);\n\nconst Finding = Schema.Struct({ file: Schema.String, line: Schema.Int, message: Schema.String });\n\nconst Rule = Schema.Struct({ ruleId: Schema.String, findings: Schema.Array(Finding) });\n\nconst Guide = Schema.Struct({ guideId: Schema.String, rules: Schema.Array(Rule) });\n\nconst Scan = Schema.fromJsonString(Schema.Struct({ guides: Schema.Array(Guide) }));\n\nconst scanOutput = Effect.fn(\"scanOutput\")(function* scanOutput(root: string) {\n const handle = yield* ChildProcess.make(\"node\", [SCANNER, \"legacy-scan\", \".\", \"--json\"], {\n cwd: root,\n extendEnv: true,\n env: { DISABLE_TELEMETRY: \"1\" },\n stdin: \"ignore\",\n });\n return yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n}, Effect.scoped);\n\n/** @internal */\nexport const checkLegacyWeb = Effect.fn(\"checkLegacyWeb\")(function* checkLegacyWeb(root: string) {\n const files = yield* RepositoryFiles;\n const output = yield* scanOutput(root).pipe(Effect.orDie);\n const scan = yield* Schema.decodeEffect(Scan)(output).pipe(Effect.orDie);\n const problemOf =\n (guideId: string, ruleId: string) =>\n ({ file, line, message }: typeof Finding.Type): Problem => ({\n file: files.join(root, file),\n line,\n column: FIRST_COLUMN,\n rule: RULE,\n message: `${ruleId}: ${message} Read the guide with \\`modern-web-guidance retrieve ${guideId}\\` and apply it.`,\n });\n return pipe(\n scan.guides,\n Arr.flatMap(({ guideId, rules }) =>\n pipe(\n rules,\n Arr.flatMap(({ ruleId, findings }) => pipe(findings, Arr.map(problemOf(guideId, ruleId)))),\n ),\n ),\n );\n});\n","import { Array as Arr, Effect, Metric, Option, Result, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { problemInFile } from \"./problem.ts\";\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass SectionConfigUnreadable extends taggedError<\n SectionConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"SectionConfigUnreadable\", { file: Schema.String }) {}\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst ONE = 1;\n\nconst diagnostics = Metric.counter(\"lint.diagnostics\", {\n description: \"Diagnostics that each lint rule reported, before msch keeps only the errors\",\n});\n\nconst countDiagnostics = (check: string, found: readonly Linted[]): Effect.Effect<void> =>\n Effect.forEach(\n found,\n (diagnostic) =>\n Metric.update(\n Metric.withAttributes(diagnostics, {\n \"lint.check\": check,\n \"lint.rule\": diagnostic.rule,\n \"lint.severity\": diagnostic.severity,\n }),\n ONE,\n ),\n { concurrency: 1, discard: true },\n );\n\nexport interface Linted {\n readonly path: string;\n readonly line: number;\n readonly column?: number;\n readonly rule: string;\n readonly message: string;\n readonly severity: string;\n}\n\nexport interface LintRequest<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface SectionCheck<\n Config,\n Found extends Linted,\n Failure extends { readonly message: string },\n> {\n readonly name: string;\n readonly rule: RuleName;\n readonly pick: (config: unknown) => Config;\n readonly pathspecs: (config: Config) => readonly string[];\n readonly lint: (request: LintRequest<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly detail: (found: Found) => string;\n}\n\nconst sectionAt = <Config>(\n file: string,\n pick: (config: unknown) => Config,\n): Effect.Effect<Option.Option<Config>, never, RepositoryFiles> =>\n Effect.gen(function* readSection() {\n const files = yield* RepositoryFiles;\n const exists = yield* files.exists(file);\n if (!exists) {\n return Option.none<Config>();\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => SectionConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.map(pick));\n });\n\nexport const checkSection =\n <Config, Found extends Linted, Failure extends { readonly message: string }>(\n check: SectionCheck<Config, Found, Failure>,\n ) =>\n (root: string): Effect.Effect<readonly Problem[], never, RepositoryFiles> =>\n Effect.gen(function* runSection() {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, CONFIG_FILE);\n const section = yield* sectionAt(configFile, check.pick);\n if (Option.isNone(section)) {\n return [];\n }\n const config = section.value;\n const [listed, projectFiles] = yield* Effect.all(\n [files.matchingFiles(root, check.pathspecs(config)), files.listedFiles(root)],\n { concurrency: \"unbounded\" },\n );\n const linted = yield* Effect.result(\n check.lint({ root, files: listed, projectFiles, config }),\n );\n yield* Result.match(linted, {\n onFailure: () => Effect.void,\n onSuccess: (found) => countDiagnostics(check.name, found),\n });\n return Result.match(linted, {\n onFailure: (failure) => [problemInFile(check.rule)(configFile, failure.message)],\n onSuccess: (found) =>\n pipe(\n found,\n Arr.filter(({ severity }) => severity === \"error\"),\n Arr.map((diagnostic): Problem => ({\n file: files.join(root, diagnostic.path),\n line: diagnostic.line,\n column: diagnostic.column ?? FIRST,\n rule: check.rule,\n message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`,\n })),\n ),\n });\n }).pipe(Effect.withSpan(check.name));\n","import { diagnosticDetail, lint, markdownPathspecs, y8Section } from \"@r_masseater/y8\";\n\nimport { checkSection } from \"#/shared/lib/section-check.ts\";\n\nexport const checkMarkdown = checkSection({\n name: \"checkMarkdown\",\n rule: \"markdown\",\n pick: y8Section,\n pathspecs: (config) => markdownPathspecs({ config }),\n lint,\n detail: diagnosticDetail,\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst SHELL_FILE = /\\.(?:sh|bash|zsh|ksh|fish|command)$/u;\nconst SHELL_SHEBANG = /^#!\\S*(?:\\/|\\s)(?:env\\s+)?(?:-\\S+\\s+)*(?:ba|z|k|da)?sh\\b|^#!\\S*fish\\b/u;\nconst EXTENSION = /\\.[^./]+$/u;\nconst SETTINGS_FILE = \".claude/settings.json\";\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"shell-script\";\nconst MESSAGE =\n \"is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.\";\n\nconst HookSchema = Schema.Struct({\n command: Schema.optional(Schema.String),\n args: Schema.String.pipe(Schema.Array, Schema.optional),\n});\nconst MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });\nconst HooksSchema = Schema.Struct({\n SessionStart: MatcherSchema.pipe(Schema.Array, Schema.optional),\n});\nconst SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });\nconst decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));\n\ntype Hook = typeof HookSchema.Type;\ntype Matcher = typeof MatcherSchema.Type;\n\nconst NO_TEXT: readonly string[] = [];\n\nconst commandText = ({ command, args }: Hook): readonly string[] => [\n ...Option.toArray(Option.fromUndefinedOr(command)),\n ...pipe(\n Option.fromUndefinedOr(args),\n Option.getOrElse(() => NO_TEXT),\n ),\n];\n\nconst matcherText = ({ hooks }: Matcher): readonly string[] =>\n pipe(\n hooks,\n Arr.flatMap((hook) => commandText(hook)),\n );\n\nconst sessionStartCommands = (source: string): readonly string[] => {\n const matchers = pipe(\n decodeSettings(source),\n Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)),\n Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)),\n );\n return pipe(\n matchers,\n Option.map(Arr.flatMap((matcher) => matcherText(matcher))),\n Option.getOrElse(() => NO_TEXT),\n );\n};\n\nconst hasExtension = (name: string): boolean => EXTENSION.test(baseName(name));\n\n/** @internal */\nexport const checkShellScripts = Effect.fn(\"checkShellScripts\")(function* checkShellScripts(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));\n const commands = pipe(\n settings,\n Option.map(sessionStartCommands),\n Option.getOrElse(() => NO_TEXT),\n );\n const isSessionStartHook = (name: string): boolean =>\n pipe(commands, Arr.some(Str.includes(name)));\n const isShell = (name: string): Effect.Effect<boolean> => {\n const file = files.join(root, name);\n if (SHELL_FILE.test(name)) {\n return files.exists(file);\n }\n if (hasExtension(name)) {\n return Effect.succeed(false);\n }\n return files\n .readFile(file)\n .pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));\n };\n const candidates = pipe(\n names,\n Arr.filter((name) => !isSessionStartHook(name)),\n );\n const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY });\n return pipe(\n shell,\n Arr.map((name) => problemInFile(RULE)(files.join(root, name), MESSAGE)),\n );\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst WORKFLOW_FILE = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/u;\nconst READ_CONCURRENCY = 16;\n\ninterface WorkflowFile {\n readonly file: string;\n readonly source: string;\n}\n\nexport const readWorkflows = Effect.fn(\"readWorkflows\")(function* readWorkflows(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n names,\n Arr.filter((name) => WORKFLOW_FILE.test(name)),\n ),\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(Effect.map(Option.map((source): WorkflowFile => ({ file, source }))));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n});\n","import { Option, pipe } from \"effect\";\nimport type { Range } from \"yaml\";\nimport { isPair, isScalar, parseDocument, visit } from \"yaml\";\n\nconst RUN_KEY = \"run\";\nconst START = 0;\n\nexport interface RunScript {\n readonly text: string;\n readonly start: number;\n}\n\nconst startOf = (range: Readonly<Range> | null | undefined): number =>\n pipe(\n Option.fromNullishOr(range),\n Option.map(([start]) => start),\n Option.getOrElse(() => START),\n );\n\nexport const runScriptsOf = (source: string): readonly RunScript[] => {\n const found: RunScript[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (\n isPair(pair) &&\n isScalar(pair.key) &&\n pair.key.value === RUN_KEY &&\n isScalar(pair.value) &&\n typeof pair.value.value === \"string\"\n ) {\n found.push({ text: pair.value.value, start: startOf(pair.value.range) });\n }\n },\n });\n return found;\n};\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { readWorkflows } from \"#/shared/lib/workflow-files.ts\";\nimport { runScriptsOf } from \"#/shared/lib/workflow-run.ts\";\nimport type { RunScript } from \"#/shared/lib/workflow-run.ts\";\n\nconst COMMAND_CHAIN = /&&|\\|\\||;|\\|/u;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst COMMENT = \"#\";\nconst RULE: RuleName = \"workflow-script\";\nconst ONE_COMMAND = 1;\nconst MESSAGE =\n \"runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.\";\n\nconst isCommand = (line: string): boolean => Str.isNonEmpty(line) && !Str.startsWith(COMMENT)(line);\n\nconst chainsCommands = (line: string): boolean =>\n COMMAND_CHAIN.test(Str.replaceAll(QUOTED, \"\")(line));\n\nconst runsMoreThanOneCommand = ({ text }: RunScript): boolean => {\n const lines = pipe(Str.split(\"\\n\")(text), Arr.map(Str.trim), Arr.filter(isCommand));\n return lines.length > ONE_COMMAND || pipe(lines, Arr.some(chainsCommands));\n};\n\nconst problemsIn =\n (file: string) =>\n (source: string): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n runScriptsOf(source),\n Arr.filter(runsMoreThanOneCommand),\n Arr.map(({ start }) => problemAtPosition(RULE)(file, at(start), MESSAGE)),\n );\n };\n\n/** @internal */\nexport const checkWorkflows = Effect.fn(\"checkWorkflows\")(function* checkWorkflows(root: string) {\n const workflows = yield* readWorkflows(root);\n return pipe(\n workflows,\n Arr.flatMap(({ file, source }) => problemsIn(file)(source)),\n );\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkShellScripts } from \"./shell-scripts.ts\";\nimport { checkWorkflows } from \"./workflows.ts\";\n\n/** @internal */\nexport const checkScripts = Effect.fn(\"checkScripts\")(function* checkScripts(root: string) {\n const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","import { lint, wismPathspecs, wismSection } from \"@r_masseater/wism\";\n\nimport { checkSection } from \"#/shared/lib/section-check.ts\";\n\nexport const checkStructure = checkSection({\n name: \"checkStructure\",\n rule: \"structure\",\n pick: wismSection,\n pathspecs: (config) => wismPathspecs({ config }),\n lint,\n detail: () => \"\",\n});\n","import { Array as Arr, String as Str, pipe } from \"effect\";\n\nconst CONTINUATION = /\\\\\\n/gu;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst SEPARATOR = /&&|\\|\\||[;|\\n`]|\\$\\(/u;\nconst BLANK = /\\s+/u;\nconst ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;\nconst QUOTE = '\"\"';\n\nexport type CommandWords = Arr.NonEmptyReadonlyArray<string>;\n\nconst wordsOf = (segment: string): readonly string[] =>\n pipe(\n Str.split(Str.trim(segment), BLANK),\n Arr.filter(Str.isNonEmpty),\n Arr.dropWhile((word) => ASSIGNMENT.test(word)),\n );\n\nexport const simpleCommands = (text: string): readonly CommandWords[] =>\n pipe(\n text,\n Str.replaceAll(CONTINUATION, \" \"),\n Str.replaceAll(QUOTED, QUOTE),\n Str.split(SEPARATOR),\n Arr.map(wordsOf),\n Arr.filter(Arr.isReadonlyArrayNonEmpty),\n );\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nimport type { CommandKind, CommandSource } from \"./command-sources.ts\";\nimport { simpleCommands } from \"./command-words.ts\";\nimport type { CommandWords } from \"./command-words.ts\";\n\nconst PACKAGE_MANAGERS: readonly string[] = [\"pnpm\", \"pnpx\", \"npm\", \"npx\", \"yarn\", \"bun\", \"bunx\"];\nconst VITE_PLUS = \"vp\";\nconst RUN = \"run\";\nconst GIT = \"git\";\nconst GITHUB = \"gh\";\nconst MERGE = \"merge\";\nconst SKIP_HOOKS = \"--no-verify\";\nconst BYPASS_RULESET = \"--admin\";\nconst FILTER = /^(?:--filter(?:=.*)?|-F)$/u;\nconst TASK_KINDS: readonly CommandKind[] = [\"script\", \"task\"];\nconst SECOND = 1;\nconst DOC_KIND: CommandKind = \"doc\";\nconst NODE = \"node\";\nconst INLINE_CODE = /^(?:--eval(?:=.*)?|--print(?:=.*)?|-[a-z]*[ep][a-z]*)$/u;\n\ninterface CommandRule {\n readonly rule: RuleName;\n readonly applies: (source: CommandSource, words: CommandWords) => boolean;\n readonly message: (command: string) => string;\n}\n\nconst programOf = (words: CommandWords): string => Arr.headNonEmpty(words);\n\nconst subcommandOf = (words: CommandWords): Option.Option<string> => Arr.get(words, SECOND);\n\nconst RULES: readonly CommandRule[] = [\n {\n rule: \"package-manager-command\",\n applies: (source, words) =>\n Arr.contains(PACKAGE_MANAGERS, programOf(words)) &&\n (source.kind !== DOC_KIND || words.length > SECOND),\n message: (command) =>\n `\\`${command}\\` calls the package manager directly. Run it through vp (vp install, vp add, vp exec, vp dlx, vp run), so that hooks, CI and sessions all use the toolchain Vite+ pins.`,\n },\n {\n rule: \"skipped-gate\",\n applies: (_source, words) =>\n (programOf(words) === GIT && Arr.contains(words, SKIP_HOOKS)) ||\n (programOf(words) === GITHUB &&\n Arr.contains(words, MERGE) &&\n Arr.contains(words, BYPASS_RULESET)),\n message: (command) =>\n `\\`${command}\\` skips a gate: ${SKIP_HOOKS} skips the hooks that run verify, and ${BYPASS_RULESET} bypasses the ruleset. Remove the flag and fix what the gate reports.`,\n },\n {\n rule: \"filter-task\",\n applies: (source, words) =>\n Arr.contains(TASK_KINDS, source.kind) &&\n programOf(words) === VITE_PLUS &&\n Option.contains(subcommandOf(words), RUN) &&\n pipe(\n words,\n Arr.some((word) => FILTER.test(word)),\n ),\n message: (command) =>\n `\\`${command}\\` wraps one package's task in another task. Write <package>#<task> in dependsOn instead, so that Vite+ sees the dependency and caches it.`,\n },\n {\n rule: \"inline-script\",\n applies: (source, words) =>\n source.kind !== DOC_KIND &&\n programOf(words) === NODE &&\n pipe(\n Arr.drop(words, SECOND),\n Arr.some((word) => INLINE_CODE.test(word)),\n ),\n message: (command) =>\n `\\`${command}\\` runs code written inside a command, which gets copied from package to package. Put the code in bin/<name>.ts of the package that owns it, or in a shared package, and run it with node bin/<name>.ts.`,\n },\n];\n\nconst problemsOf = (source: CommandSource): readonly Problem[] =>\n pipe(\n simpleCommands(source.text),\n Arr.flatMap((words) =>\n pipe(\n RULES,\n Arr.filter(({ applies }) => applies(source, words)),\n Arr.map(({ rule, message }): Problem => ({\n file: source.file,\n ...source.position,\n rule,\n message: message(Str.trim(Arr.join(words, \" \"))),\n })),\n ),\n ),\n );\n\nexport const commandProblems = (sources: readonly CommandSource[]): readonly Problem[] =>\n pipe(sources, Arr.flatMap(problemsOf));\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport type { CommandSource } from \"./command-sources.ts\";\n\nconst FENCE = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \\t]*\\n)(?<body>[\\s\\S]*?)^```[ \\t]*$/gmu;\nconst INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\\n]+)`(?!`)/gu;\n\ninterface CodeSpan {\n readonly text: string;\n readonly start: number;\n readonly end: number;\n}\n\nconst codeIn =\n (pattern: RegExp) =>\n (source: string): readonly CodeSpan[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.flatMap((match) =>\n pipe(\n Option.all({\n open: groupOf(\"open\")(match),\n text: groupOf(\"body\")(match),\n whole: Arr.head(match),\n index: Option.fromUndefinedOr(match.index),\n }),\n Option.map(({ open, text, whole, index }) => ({\n text,\n start: index + open.length,\n end: index + whole.length,\n })),\n Option.toArray,\n ),\n ),\n );\n\nconst outside =\n (fences: readonly CodeSpan[]) =>\n (span: CodeSpan): boolean =>\n !pipe(\n fences,\n Arr.some((fence) => span.start >= fence.start && span.start < fence.end),\n );\n\nexport const docSources =\n (file: string) =>\n (source: string): readonly CommandSource[] => {\n const fences = codeIn(FENCE)(source);\n const inline = pipe(codeIn(INLINE_CODE)(source), Arr.filter(outside(fences)));\n return pipe(\n [...fences, ...inline],\n Arr.map(({ text, start }): CommandSource => ({\n kind: \"doc\",\n file,\n position: positionOf(source)(start),\n name: \"code\",\n text,\n })),\n );\n };\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n childrenOf,\n keyName,\n literalOf,\n propertyValue,\n runTasksOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RunTask } from \"#/entities/workspace/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { runScriptsOf } from \"#/shared/lib/workflow-run.ts\";\n\nimport { docSources } from \"./doc-sources.ts\";\n\nconst ROOT_DIRECTORY = \".\";\nconst COMMAND_KEY = \"command\";\nconst ARGUMENTS_KEY = \"args\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst MANIFESTS: readonly string[] = [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED];\nconst STEP_FILES: readonly string[] = [\n \":(glob).github/workflows/*.yml\",\n \":(glob).github/workflows/*.yaml\",\n \":(glob)**/action.yml\",\n \":(glob)**/action.yaml\",\n ...EXCLUDED,\n];\nconst HOOK_FILES: readonly string[] = [\":(glob).vite-hooks/*\"];\nconst AGENT_FILES: readonly string[] = [\".claude/settings.json\", \".mcp.json\"];\nconst AGENT_DOCS: readonly string[] = [\":(glob)**/AGENTS.md\", \":(glob)**/CLAUDE.md\", ...EXCLUDED];\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst FIRST = 1;\nconst LINE = \"\\n\";\n\nexport type CommandKind = \"script\" | \"task\" | \"step\" | \"hook\" | \"agent\" | \"doc\";\n\nexport interface CommandSource {\n readonly kind: CommandKind;\n readonly file: string;\n readonly position: Pick<Problem, \"line\" | \"column\">;\n readonly name: string;\n readonly text: string;\n}\n\nconst CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);\nconst decodeCommandText = Schema.decodeUnknownOption(CommandText);\nconst Scripts = Schema.Struct({\n scripts: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts));\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\nconst decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));\n\nconst NO_SOURCES: readonly CommandSource[] = [];\n\nconst offsetOf = (source: string, text: string): number =>\n pipe(\n Str.indexOf(text)(source),\n Option.getOrElse(() => START),\n );\n\nconst scriptSources =\n (file: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n decodeScripts(source),\n Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n Arr.map(([name, text]): CommandSource => {\n const offset = offsetOf(source, `\"${name}\"`);\n return { kind: \"script\", file, position: positionOf(source)(offset), name, text };\n }),\n );\n\nconst stepSources =\n (file: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n runScriptsOf(source),\n Arr.map(({ text, start }): CommandSource => ({\n kind: \"step\",\n file,\n position: positionOf(source)(start),\n name: \"run\",\n text,\n })),\n );\n\nconst hookSources =\n (file: string, name: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n Str.split(source, LINE),\n Arr.map((text, index): CommandSource => ({\n kind: \"hook\",\n file,\n position: { line: index + FIRST, column: FIRST },\n name,\n text,\n })),\n );\n\nconst commandIn = (node: unknown): Option.Option<string> => {\n if (!Predicate.isReadonlyObject(node)) {\n return Option.none();\n }\n const record: Readonly<Record<string, unknown>> = node;\n return pipe(\n Option.fromUndefinedOr(record[COMMAND_KEY]),\n Option.filter(Predicate.isString),\n Option.map((command) =>\n pipe(\n decodeArguments(record[ARGUMENTS_KEY]),\n Option.getOrElse((): readonly string[] => []),\n Arr.prepend(command),\n Arr.join(\" \"),\n ),\n ),\n );\n};\n\nconst commandsIn = (node: unknown): readonly string[] => [\n ...Option.toArray(commandIn(node)),\n ...pipe(childrenOf(node), Arr.flatMap(commandsIn)),\n];\n\nconst agentSources =\n (file: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n decodeJson(source),\n Option.map(commandsIn),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((text): CommandSource => {\n const program = Arr.headNonEmpty(Str.split(text, \" \"));\n const offset = offsetOf(source, `\"${program}\"`);\n return {\n kind: \"agent\",\n file,\n position: positionOf(source)(offset),\n name: COMMAND_KEY,\n text,\n };\n }),\n );\n\nconst taskCommand = (value: unknown): Option.Option<string> =>\n pipe(\n propertyValue(COMMAND_KEY)(value),\n Option.orElse(() => Option.some(value)),\n Option.flatMap(literalOf),\n Option.flatMap(decodeCommandText),\n Option.map((command) => Arr.join(Arr.ensure(command), LINE)),\n );\n\nconst taskSource =\n (file: string, source: string) =>\n (task: RunTask): Option.Option<CommandSource> =>\n pipe(\n taskCommand(task.value),\n Option.map((text) => ({\n kind: \"task\",\n file,\n position: positionOf(source)(task.start),\n name: keyName(task.key),\n text,\n })),\n );\n\nconst taskSources = Effect.fn(\"taskSources\")(function* taskSources(\n root: string,\n directory: string,\n) {\n const found = yield* runTasksOf(root, directory);\n if (Option.isNone(found)) {\n return NO_SOURCES;\n }\n const { file, source, tasks } = found.value;\n return pipe(\n tasks,\n Arr.flatMap((task) => Option.toArray(taskSource(file, source)(task))),\n );\n});\n\nconst workspaceTasks = Effect.fn(\"workspaceTasks\")(function* workspaceTasks(\n root: string,\n directories: readonly string[],\n) {\n const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.flatten(found);\n});\n\nconst readSources = Effect.fn(\"readSources\")(function* readSources(\n root: string,\n names: readonly string[],\n sourcesOf: (file: string, name: string) => (source: string) => readonly CommandSource[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n const sourcesIn = Option.match({ onNone: () => NO_SOURCES, onSome: sourcesOf(file, name) });\n return files.readFile(file).pipe(Effect.map(sourcesIn));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\n/** @internal */\nexport const commandSources = Effect.fn(\"commandSources\")(function* commandSources(root: string) {\n const files = yield* RepositoryFiles;\n const [manifests, steps, hooks, docs, workspaces] = yield* Effect.all(\n [\n files.matchingFiles(root, MANIFESTS),\n files.matchingFiles(root, STEP_FILES),\n files.matchingFiles(root, HOOK_FILES),\n files.matchingFiles(root, AGENT_DOCS),\n workspaceDirectories(root),\n ],\n { concurrency: \"unbounded\" },\n );\n const found = yield* Effect.all(\n [\n readSources(root, manifests, scriptSources),\n readSources(root, steps, stepSources),\n readSources(root, hooks, hookSources),\n readSources(root, AGENT_FILES, agentSources),\n readSources(root, docs, docSources),\n workspaceTasks(root, Arr.dedupe([ROOT_DIRECTORY, ...workspaces])),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nimport type { CommandSource } from \"./command-sources.ts\";\n\nconst RULE: RuleName = \"package-script\";\nconst LIFECYCLE: readonly string[] = [\n \"preinstall\",\n \"install\",\n \"postinstall\",\n \"preprepare\",\n \"prepare\",\n \"postprepare\",\n \"prepublish\",\n \"prepublishOnly\",\n \"prepack\",\n \"postpack\",\n \"publish\",\n \"postpublish\",\n \"preversion\",\n \"version\",\n \"postversion\",\n \"dependencies\",\n \"pnpm:devPreinstall\",\n];\n\nconst problemOf = ({ file, position, name }: CommandSource): Problem => ({\n file,\n ...position,\n rule: RULE,\n message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`,\n});\n\nexport const packageScriptProblems = (sources: readonly CommandSource[]): readonly Problem[] =>\n pipe(\n sources,\n Arr.filter(({ kind, name }) => kind === \"script\" && !Arr.contains(LIFECYCLE, name)),\n Arr.map(problemOf),\n );\n","import { Array as Arr, Option, String as Str } from \"effect\";\n\nimport { agentDocProblems } from \"#/shared/lib/agent-docs.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"vite-plus-block\";\nconst MARKER = Arr.join([\"<!--\", \"VITE PLUS START\", \"-->\"], \"\");\nconst MESSAGE =\n \"holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.\";\n\nconst problemIn =\n (file: string) =>\n (source: string): Option.Option<Problem> => {\n const index = Str.indexOf(MARKER)(source);\n if (Option.isNone(index)) {\n return Option.none();\n }\n return Option.some({ file, ...positionOf(source)(index.value), rule: RULE, message: MESSAGE });\n };\n\n/** @internal */\nexport const checkVitePlusBlock = (root: string): ReturnType<typeof agentDocProblems> =>\n agentDocProblems(root, problemIn);\n","import { Effect } from \"effect\";\n\nimport { commandProblems } from \"./command-problems.ts\";\nimport { commandSources } from \"./command-sources.ts\";\nimport { packageScriptProblems } from \"./package-scripts.ts\";\nimport { checkVitePlusBlock } from \"./vite-plus-block.ts\";\n\n/** @internal */\nexport const checkVitePlus = Effect.fn(\"checkVitePlus\")(function* checkVitePlus(root: string) {\n const [sources, blocks] = yield* Effect.all([commandSources(root), checkVitePlusBlock(root)], {\n concurrency: \"unbounded\",\n });\n return [...packageScriptProblems(sources), ...commandProblems(sources), ...blocks];\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, parseDocument, visit } from \"yaml\";\nimport type { Pair } from \"yaml\";\n\nimport type { Finding, Problem } from \"#/shared/lib/problem.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { readWorkflows } from \"#/shared/lib/workflow-files.ts\";\n\nexport const pairsNamed =\n (name: string) =>\n (source: string): readonly Pair[] => {\n const found: Pair[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (isPair(pair) && isScalar(pair.key) && pair.key.value === name) {\n found.push(pair);\n }\n },\n });\n return found;\n };\n\nexport const pairIn =\n (name: string) =>\n (node: unknown): Option.Option<Pair> =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.flatMap((map) =>\n Arr.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === name),\n ),\n );\n\nexport const keyOffsetIn =\n (name: string) =>\n (node: unknown): Option.Option<number> =>\n pipe(\n pairIn(name)(node),\n Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)),\n Option.flatMap((key) => Option.fromNullishOr(key.range)),\n Option.map(([start]) => start),\n );\n\nexport interface WorkflowFinding extends Finding {\n readonly offsetsOf: (source: string) => readonly number[];\n}\n\nexport const workflowCheck = ({\n rule,\n message,\n offsetsOf,\n}: WorkflowFinding): ((\n root: string,\n) => Effect.Effect<readonly Problem[], never, RepositoryFiles>) =>\n Effect.fn(rule)(function* checkWorkflows(root: string) {\n const workflows = yield* readWorkflows(root);\n return pipe(\n workflows,\n Arr.flatMap(({ file, source }): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n offsetsOf(source),\n Arr.map((offset): Problem => {\n const { line, column } = at(offset);\n return { file, line, column, rule, message };\n }),\n );\n }),\n );\n });\n\nexport interface ScalarKey {\n readonly name: string;\n readonly matches: (value: string) => boolean;\n}\n\nexport const scalarKeyOffsets =\n ({ name, matches }: ScalarKey) =>\n (source: string): readonly number[] =>\n pipe(\n pairsNamed(name)(source),\n Arr.filter(({ value }) => isScalar(value) && matches(String(value.value))),\n Arr.flatMap(({ key }) =>\n pipe(\n Option.liftPredicate(key, isScalar),\n Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)),\n Option.map(([start]) => start),\n Option.toArray,\n ),\n ),\n );\n","import type { RuleName } from \"#/shared/lib/problem.ts\";\n\nimport { scalarKeyOffsets, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst DEPTH_KEY = \"fetch-depth\";\nconst WHOLE_HISTORY = \"0\";\nconst RULE: RuleName = \"full-history-checkout\";\nconst MESSAGE =\n \"fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.\";\n\nconst fullHistoryOffsetsOf = scalarKeyOffsets({\n name: DEPTH_KEY,\n matches: (value) => value === WHOLE_HISTORY,\n});\n\n/** @internal */\nexport const checkFullHistoryCheckout = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: fullHistoryOffsetsOf,\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isMap, isScalar, isSeq, parseDocument } from \"yaml\";\n\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { runScriptsOf } from \"#/shared/lib/workflow-run.ts\";\n\nimport { keyOffsetIn, pairIn, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst RULE: RuleName = \"publish-trigger\";\nconst PUBLISH = /\\bmsch-publish\\s+(?:plan|npm|release)\\b/u;\nconst MANUAL = \"workflow_dispatch\";\nconst TRIGGER_KEY = \"on\";\nconst MESSAGE =\n \"publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch-publish dispatch`.\";\n\nconst triggersOf = (node: unknown): readonly string[] => {\n if (isScalar(node)) {\n return [String(node.value)];\n }\n if (isSeq(node)) {\n return pipe(\n node.items,\n Arr.filter(isScalar),\n Arr.map((item) => String(item.value)),\n );\n }\n if (isMap(node)) {\n return pipe(\n node.items,\n Arr.flatMap(({ key }) =>\n pipe(\n Option.liftPredicate(key, isScalar),\n Option.map((scalar) => String(scalar.value)),\n Option.toArray,\n ),\n ),\n );\n }\n return [];\n};\n\nconst publishTriggerOffsetsOf = (source: string): readonly number[] => {\n const publishes = pipe(\n runScriptsOf(source),\n Arr.some(({ text }) => PUBLISH.test(text)),\n );\n if (!publishes) {\n return [];\n }\n const { contents } = parseDocument(source);\n const triggers = pipe(\n pairIn(TRIGGER_KEY)(contents),\n Option.map(({ value }) => triggersOf(value)),\n Option.getOrElse((): readonly string[] => []),\n );\n if (\n pipe(\n triggers,\n Arr.every((trigger) => trigger === MANUAL),\n )\n ) {\n return [];\n }\n return Option.toArray(keyOffsetIn(TRIGGER_KEY)(contents));\n};\n\n/** @internal */\nexport const checkPublishTrigger = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: publishTriggerOffsetsOf,\n});\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { scalarKeyOffsets, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst RULE: RuleName = \"release-please\";\nconst RELEASE_PLEASE = /^googleapis\\/release-please-action(?:@|$)/u;\nconst RELEASE_PLEASE_FILE = /(?:^|\\/)(?:release-please-config|\\.release-please-manifest)\\.json$/u;\nconst FIRST = 1;\nconst MESSAGE =\n \"releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.\";\n\nconst releasePleaseOffsetsOf = scalarKeyOffsets({\n name: \"uses\",\n matches: (value) => RELEASE_PLEASE.test(value),\n});\n\nconst checkReleasePleaseSteps = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: releasePleaseOffsetsOf,\n});\n\nconst checkReleasePleaseFiles = Effect.fn(\"checkReleasePleaseFiles\")(\n function* checkReleasePleaseFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.filter((name) => RELEASE_PLEASE_FILE.test(name)),\n Arr.map((name): Problem => ({\n file: files.join(root, name),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n })),\n );\n },\n);\n\n/** @internal */\nexport const checkReleasePlease = Effect.fn(\"checkReleasePlease\")(function* checkReleasePlease(\n root: string,\n) {\n const found = yield* Effect.all([checkReleasePleaseSteps(root), checkReleasePleaseFiles(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\n\nimport { keyOffsetIn, pairsNamed, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst CONCURRENCY_KEY = \"concurrency\";\nconst QUEUE_KEY = \"queue\";\nconst RULE: RuleName = \"workflow-queue\";\nconst MESSAGE =\n \"queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.\";\n\nconst queueOffsetsOf = (source: string): readonly number[] =>\n pipe(\n pairsNamed(CONCURRENCY_KEY)(source),\n Arr.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))),\n );\n\n/** @internal */\nexport const checkWorkflowQueues = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: queueOffsetsOf,\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isScalar } from \"yaml\";\n\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\n\nimport { pairsNamed, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst RULE: RuleName = \"workflow-commit\";\nconst GIT_WRITE = /\\bgit\\s+(?:-{1,2}\\S+\\s+(?:\\S+\\s+)?)*(?:commit|push)\\b/u;\nconst COMMIT_ACTION = /^[^@/]+\\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;\nconst MESSAGE =\n \"commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.\";\n\nconst offsetsWhere =\n (name: string, pattern: RegExp) =>\n (source: string): readonly number[] =>\n pipe(\n pairsNamed(name)(source),\n Arr.filter(\n ({ value }) =>\n isScalar(value) && typeof value.value === \"string\" && pattern.test(value.value),\n ),\n Arr.flatMap(({ key }) =>\n pipe(\n Option.liftPredicate(key, isScalar),\n Option.flatMap(({ range }) => Option.fromNullishOr(range)),\n Option.map(([start]) => start),\n Option.toArray,\n ),\n ),\n );\n\nconst commitOffsetsOf = (source: string): readonly number[] => [\n ...offsetsWhere(\"run\", GIT_WRITE)(source),\n ...offsetsWhere(\"uses\", COMMIT_ACTION)(source),\n];\n\n/** @internal */\nexport const checkWorkflowCommits = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: commitOffsetsOf,\n});\n","import { fu4Section, lint, workflowPathspecs } from \"@r_masseater/fu4\";\n\nimport { checkSection } from \"#/shared/lib/section-check.ts\";\n\nexport const checkWorkflowLint = checkSection({\n name: \"checkWorkflowLint\",\n rule: \"workflow-lint\",\n pick: fu4Section,\n pathspecs: (config) => workflowPathspecs({ config }),\n lint,\n detail: () => \"\",\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkKnownPlugins, checkMissingHooks } from \"#/features/check-agent-settings/index.ts\";\nimport { checkDocumentedCommands } from \"#/features/check-documented-commands/index.ts\";\nimport { checkLegacyWeb } from \"#/features/check-legacy-web/index.ts\";\nimport { checkMarkdown } from \"#/features/check-markdown/index.ts\";\nimport { checkRestrictedRules, checkTypeExemptions } from \"#/features/check-overrides/index.ts\";\nimport { checkScripts } from \"#/features/check-scripts/index.ts\";\nimport { checkStructure } from \"#/features/check-structure/index.ts\";\nimport { checkVitePlus } from \"#/features/check-vite-plus/index.ts\";\nimport {\n checkFullHistoryCheckout,\n checkPublishTrigger,\n checkReleasePlease,\n checkWorkflowCommits,\n checkWorkflowLint,\n checkWorkflowQueues,\n} from \"#/features/check-workflows/index.ts\";\n\n/** @internal */\nexport const checkToolUse = Effect.fn(\"checkToolUse\")(function* checkToolUse(root: string) {\n const found = yield* Effect.all(\n [\n checkVitePlus(root),\n checkMissingHooks(root),\n checkKnownPlugins(root),\n checkScripts(root),\n checkWorkflowQueues(root),\n checkWorkflowCommits(root),\n checkFullHistoryCheckout(root),\n checkReleasePlease(root),\n checkPublishTrigger(root),\n checkRestrictedRules(root),\n checkTypeExemptions(root),\n checkMarkdown(root),\n checkLegacyWeb(root),\n checkDocumentedCommands(root),\n checkStructure(root),\n checkWorkflowLint(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","export const COMMENT_DIRECTIVES: readonly string[] = [\n \"oxlint-disable\",\n \"textlint-disable\",\n \"textlint-enable\",\n String.raw`\\* @internal \\*?$`,\n String.raw`\\* @msch \\S+ \\*?$`,\n String.raw`\\* @stability (?:experimental|unstable) \\*?$`,\n String.raw`shellcheck \\w`,\n String.raw`zizmor: ignore\\[`,\n String.raw`exit: \\S`,\n \"> statement-breakpoint$\",\n \"/ <reference (?:types|path|lib)=\",\n];\n","import { Array as Arr, Effect, Schema, String as Str, pipe } from \"effect\";\n\nexport interface FoundComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport type Found = Effect.Effect<readonly FoundComment[], CommentsUnreadable>;\n\nconst taggedError = Schema.TaggedError;\n\nexport class CommentsUnreadable extends taggedError<\n CommentsUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentsUnreadable\", { reader: Schema.String, message: Schema.String }) {}\n\nexport const unreadable =\n (reader: string) =>\n (cause: unknown): CommentsUnreadable =>\n CommentsUnreadable.make({ reader, message: String(cause) });\n\nconst trimmed = ({ index, text }: FoundComment): FoundComment => ({\n index,\n text: Str.trimEnd(text),\n});\n\nexport const commentsFrom =\n (reader: string) =>\n (read: (source: string) => readonly FoundComment[]) =>\n (source: string): Found =>\n Effect.try({\n try: () => pipe(read(source), Arr.map(trimmed)),\n catch: unreadable(reader),\n });\n","import { DockerfileParser } from \"dockerfile-ast\";\nimport { Array as Arr, Number as Num, String as Str, pipe } from \"effect\";\nimport { parse as parseSql } from \"sql-parser-cst\";\n\nimport {\n collectNodes,\n isRecord,\n tomlSourceComments,\n yamlSourceComments,\n} from \"#/shared/lib/config-comments.ts\";\n\nimport { commentsFrom } from \"./found-comment.ts\";\n\nconst NEXT = 1;\n\nexport const yamlComments = commentsFrom(\"yaml\")(yamlSourceComments);\n\nexport const tomlComments = commentsFrom(\"toml\")(tomlSourceComments);\n\ninterface SqlComment {\n readonly text: string;\n readonly range: readonly [number, number];\n}\n\nconst isSqlComment = (value: unknown): value is SqlComment =>\n isRecord(value) &&\n (value[\"type\"] === \"line_comment\" || value[\"type\"] === \"block_comment\") &&\n typeof value[\"text\"] === \"string\" &&\n Arr.isArray(value[\"range\"]);\n\nexport const sqlComments = commentsFrom(\"sql\")((source) => {\n const program = parseSql(source, {\n dialect: \"sqlite\",\n includeComments: true,\n includeRange: true,\n paramTypes: [],\n });\n return pipe(\n collectNodes(isSqlComment)(program),\n Arr.map(({ range: [start], text }) => ({ index: start, text })),\n );\n});\n\nconst offsetAt =\n (lines: readonly string[]) =>\n ({ line, character }: Readonly<{ line: number; character: number }>): number =>\n character +\n pipe(\n lines,\n Arr.take(line),\n Arr.map((text) => text.length + NEXT),\n Num.sumAll,\n );\n\nexport const dockerfileComments = commentsFrom(\"dockerfile\")((source) => {\n const lines = Str.split(source, \"\\n\");\n return pipe(\n DockerfileParser.parse(source).getComments(),\n Arr.map((comment) => ({\n index: offsetAt(lines)(comment.getRange().start),\n text: comment.toString(),\n })),\n );\n});\n","import { isComment, isTag, isText } from \"domhandler\";\nimport type { AnyNode, Text } from \"domhandler\";\nimport {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport { DomUtils, parseDocument } from \"htmlparser2\";\n\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { Language } from \"#/shared/lib/tree-sitter.ts\";\n\nimport { dockerfileComments, sqlComments, tomlComments, yamlComments } from \"./config-comments.ts\";\nimport { commentsFrom, unreadable } from \"./found-comment.ts\";\nimport type { CommentsUnreadable, Found, FoundComment } from \"./found-comment.ts\";\n\nconst GRAMMARS = [\n \"bash\",\n \"c-sharp\",\n \"cpp\",\n \"css\",\n \"javascript\",\n \"powershell\",\n \"rust\",\n \"tsx\",\n \"typescript\",\n] as const;\n\nexport type Grammar = (typeof GRAMMARS)[number];\n\nexport type Markup = \"html\" | \"xml\";\n\nexport type Reader = Grammar | Markup | \"yaml\" | \"toml\" | \"sql\" | \"dockerfile\";\n\nexport type Grammars = (grammar: Grammar) => Option.Option<Language>;\n\nconst COMMENT_NODES = [\"comment\", \"line_comment\", \"block_comment\", \"multiline_comment\"];\nconst START = 0;\nconst NEXT = 1;\nconst NONE: readonly FoundComment[] = [];\n\nconst loadGrammar = (\n grammar: Grammar,\n): Effect.Effect<readonly [Grammar, Language], CommentsUnreadable> =>\n loadLanguage(grammar).pipe(\n Effect.mapBoth({\n onFailure: ({ message }) => unreadable(grammar)(message),\n onSuccess: (language) => [grammar, language] as const,\n }),\n );\n\nexport const loadGrammars = Effect.fn(\"loadGrammars\")(function* loadGrammars() {\n const loaded = yield* Effect.forEach(GRAMMARS, (grammar) => loadGrammar(grammar), {\n concurrency: 1,\n });\n const languages = Rec.fromEntries(loaded);\n const grammars: Grammars = (grammar) => Rec.get(languages, grammar);\n return grammars;\n});\n\nconst commentNodesIn = (language: Language, source: string): readonly FoundComment[] =>\n pipe(\n readTree({\n language,\n source,\n read: (root) =>\n pipe(\n root.descendantsOfType(COMMENT_NODES),\n Arr.filter(Predicate.isNotNullish),\n Arr.map((node) => ({ index: node.startIndex, text: node.text })),\n ),\n }),\n Option.getOrElse(() => NONE),\n );\n\nconst syntaxComments =\n (grammars: Grammars, grammar: Grammar) =>\n (source: string): Found =>\n Option.match(grammars(grammar), {\n onNone: () => Effect.fail(unreadable(grammar)(\"the grammar is not loaded\")),\n onSome: (language) => commentsFrom(grammar)((text) => commentNodesIn(language, text))(source),\n });\n\nconst SCRIPT_TYPE = /^(?:|module|text\\/javascript|application\\/javascript)$/iu;\nconst SHADER_TYPE = /shader|glsl/iu;\n\ninterface EmbeddingTag {\n readonly name: string;\n readonly attribs: Readonly<Record<string, string>>;\n}\n\nconst scriptGrammar = (attribs: EmbeddingTag[\"attribs\"]): Option.Option<Grammar> => {\n const type = Str.trim(Option.getOrElse(Rec.get(attribs, \"type\"), () => \"\"));\n if (Rec.get(attribs, \"lang\").pipe(Option.contains(\"ts\"))) {\n return Option.some<Grammar>(\"typescript\");\n }\n if (SHADER_TYPE.test(type)) {\n return Option.some<Grammar>(\"cpp\");\n }\n return Option.liftPredicate<Grammar>(\"javascript\", () => SCRIPT_TYPE.test(type));\n};\n\nconst EMBEDDED_GRAMMARS: Readonly<\n Record<string, (attribs: EmbeddingTag[\"attribs\"]) => Option.Option<Grammar>>\n> = {\n style: () => Option.some<Grammar>(\"css\"),\n script: scriptGrammar,\n};\n\nconst embeddedGrammar = ({ name, attribs }: EmbeddingTag): Option.Option<Grammar> =>\n Rec.get(EMBEDDED_GRAMMARS, name).pipe(Option.flatMap((grammarOf) => grammarOf(attribs)));\n\nconst shifted =\n (offset: number) =>\n ({ index, text }: FoundComment): FoundComment => ({ index: index + offset, text });\n\nconst markupComment =\n (source: string) =>\n (node: AnyNode): readonly FoundComment[] => {\n if (!isComment(node) || node.startIndex === null || node.endIndex === null) {\n return NONE;\n }\n return [\n { index: node.startIndex, text: Str.slice(node.startIndex, node.endIndex + NEXT)(source) },\n ];\n };\n\nconst textComments =\n (grammars: Grammars, grammar: Grammar) =>\n (text: Text): Found => {\n const shift = shifted(text.startIndex ?? START);\n return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Arr.map(shift)));\n };\n\nconst embeddedComments =\n (grammars: Grammars) =>\n (node: AnyNode): Found => {\n if (!isTag(node)) {\n return Effect.succeed(NONE);\n }\n const texts = pipe(node.children, Arr.filter(isText));\n return Option.match(embeddedGrammar(node), {\n onNone: () => Effect.succeed(NONE),\n onSome: (grammar) =>\n pipe(\n texts,\n (items) => Effect.forEach(items, textComments(grammars, grammar), { concurrency: 1 }),\n Effect.map(Arr.flatten),\n ),\n });\n };\n\nconst markupComments =\n (grammars: Grammars, markup: Markup) =>\n (source: string): Found =>\n Effect.gen(function* readMarkup() {\n const document = parseDocument(source, {\n xmlMode: markup === \"xml\",\n withStartIndices: true,\n withEndIndices: true,\n });\n const nodes = DomUtils.filter(() => true, document.children, true);\n const own = pipe(nodes, Arr.flatMap(markupComment(source)));\n if (markup === \"xml\") {\n return own;\n }\n const embedded = yield* Effect.forEach(nodes, embeddedComments(grammars), { concurrency: 1 });\n return [...own, ...Arr.flatten(embedded)];\n });\n\nconst isGrammar = (reader: Reader): reader is Grammar => pipe(GRAMMARS, Arr.contains(reader));\n\nexport const commentsWith =\n (grammars: Grammars) =>\n (reader: Reader, source: string): Found => {\n if (isGrammar(reader)) {\n return syntaxComments(grammars, reader)(source);\n }\n const readers = {\n html: markupComments(grammars, \"html\"),\n xml: markupComments(grammars, \"xml\"),\n yaml: yamlComments,\n toml: tomlComments,\n sql: sqlComments,\n dockerfile: dockerfileComments,\n } satisfies Record<Exclude<Reader, Grammar>, (text: string) => Found>;\n return readers[reader](source);\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Reader } from \"./comment-readers.ts\";\n\nconst SHEBANG = \"#!\";\n\nconst READERS: readonly (readonly [RegExp, Reader])[] = [\n [/\\.(?:[cm]?jsx?)$/u, \"javascript\"],\n [/\\.(?:[cm]?ts)$/u, \"typescript\"],\n [/\\.tsx$/u, \"tsx\"],\n [/\\.rs$/u, \"rust\"],\n [/\\.(?:cs|csx)$/u, \"c-sharp\"],\n [/\\.(?:sh|bash|zsh|ksh)$/u, \"bash\"],\n [/(?:^|\\/)\\.(?:vite-hooks|husky|githooks)\\/[^./][^/]*$/u, \"bash\"],\n [/\\.(?:ps1|psm1|psd1)$/u, \"powershell\"],\n [/\\.(?:c|h|cc|cpp|cxx|hpp|hh|m|mm|glsl|frag|vert|comp|wgsl|hlsl|metal)$/u, \"cpp\"],\n [/\\.(?:css|pcss)$/u, \"css\"],\n [/\\.(?:html?|vue|svelte|astro)$/u, \"html\"],\n [/\\.(?:xml|xaml|plist|resx|props|targets|[a-z]+proj|manifest|nuspec)$/u, \"xml\"],\n [/\\.ya?ml$/u, \"yaml\"],\n [/\\.toml$/u, \"toml\"],\n [/\\.sql$/u, \"sql\"],\n [/(?:^|\\/)(?:Dockerfile|Containerfile)(?:\\.[^/]+)?$|\\.dockerfile$/u, \"dockerfile\"],\n];\n\nconst SHEBANG_READERS: readonly (readonly [RegExp, Reader])[] = [\n [/^#!.*\\b(?:ba|z|k|da)?sh\\b/u, \"bash\"],\n [/^#!.*\\b(?:node|bun|deno|tsx)\\b/u, \"javascript\"],\n [/^#!.*\\bpwsh\\b/u, \"powershell\"],\n];\n\nconst shebangReader = (source: string): Option.Option<readonly [RegExp, Reader]> => {\n if (!Str.startsWith(SHEBANG)(source)) {\n return Option.none();\n }\n return pipe(\n SHEBANG_READERS,\n Arr.findFirst(([pattern]) => pattern.test(source)),\n );\n};\n\nexport const readerOf =\n (name: string) =>\n (source: string): Option.Option<Reader> =>\n pipe(\n READERS,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.orElse(() => shebangReader(source)),\n Option.map(([, reader]) => reader),\n );\n","import { matcher } from \"@masseater.dev/path-kit\";\nimport {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Predicate,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { COMMENT_DIRECTIVES } from \"#/shared/lib/comment-directives.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { commentsWith, loadGrammars } from \"./comment-readers.ts\";\nimport type { FoundComment } from \"./found-comment.ts\";\nimport { readerOf } from \"./reader-of.ts\";\n\nconst RULE: RuleName = \"comment\";\nconst UNUSED_RULE: RuleName = \"unused-comment-allowance\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst VENDORED_PATHSPEC = \":(attr:linguist-vendored)\";\nconst READ_CONCURRENCY = 64;\nconst START = 0;\n\nconst SHEBANG = \"#!\";\nconst PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\\s*$/u;\nconst VERSION = /^\\s?v?\\d[\\w.+-]*$/u;\nconst DELIMITERS = /^(?:\\/\\/|\\/\\*|<!--|<#|#|--)|(?:\\*\\/|-->|#>)$/gu;\nconst MESSAGE =\n \"Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.\";\n\nconst Patterns = Schema.Array(Schema.String);\nconst CommentSettings = Schema.Struct({ allow: Patterns });\nconst MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });\nconst LintSettings = Schema.Struct({ ignorePatterns: Schema.optional(Patterns) });\n\nconst RootConfig = Schema.Struct({\n msch: Schema.optional(MschSettings),\n lint: Schema.optional(LintSettings),\n});\n\ntype RootConfigType = typeof RootConfig.Type;\n\ninterface RootSettings {\n readonly allow: readonly string[];\n readonly ignorePatterns: readonly string[];\n}\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst NO_SETTINGS: RootSettings = { allow: [], ignorePatterns: [] };\n\nconst taggedError = Schema.TaggedError;\n\nclass CommentConfigUnreadable extends taggedError<\n CommentConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentConfigUnreadable\", { file: Schema.String }) {}\n\nconst valueOf = (text: string): string => Str.replaceAll(DELIMITERS, \"\")(text);\n\nconst lineBefore = (source: string, index: number): string => {\n const lines = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return Option.getOrElse(Arr.last(lines), () => \"\");\n};\n\nconst isPinVersion = (source: string, { index, text }: FoundComment): boolean =>\n PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));\n\nconst isShebang = ({ index, text }: FoundComment): boolean =>\n index === START && Str.startsWith(SHEBANG)(text);\n\nconst isAllowed =\n (source: string, directives: RegExp) =>\n (comment: FoundComment): boolean =>\n isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);\n\ninterface Scanned {\n readonly problems: readonly Problem[];\n readonly used: readonly number[];\n}\n\nconst NOTHING: Scanned = { problems: [], used: [] };\n\nconst unusedMessage = (entry: string): string =>\n `allows the comment pattern \\`${entry}\\`, but no comment in the repository matches it. Delete the entry and add it back when a comment needs it.`;\n\nconst problemOf =\n (file: string, source: string) =>\n ({ index }: FoundComment): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: MESSAGE,\n });\n\nconst settingsOf = ({ msch, lint }: RootConfigType): RootSettings => ({\n allow: pipe(\n Option.fromUndefinedOr(msch),\n Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)),\n Option.match({ onNone: () => NO_SETTINGS.allow, onSome: ({ allow }) => allow }),\n ),\n ignorePatterns: pipe(\n Option.fromUndefinedOr(lint),\n Option.flatMap(({ ignorePatterns }) => Option.fromUndefinedOr(ignorePatterns)),\n Option.getOrElse(() => NO_SETTINGS.ignorePatterns),\n ),\n});\n\nconst rootSettings = Effect.fn(\"rootSettings\")(function* rootSettings(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return NO_SETTINGS;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => CommentConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(\n config,\n Option.flatMap(Schema.decodeUnknownOption(RootConfig)),\n Option.match({ onNone: () => NO_SETTINGS, onSome: settingsOf }),\n );\n});\n\nconst directivePattern = (directives: readonly string[]): RegExp =>\n new RegExp(String.raw`^\\s?(?:${Arr.join(directives, \"|\")})`, \"u\");\n\nconst scannedFiles = Effect.fn(\"scannedFiles\")(function* scannedFiles(\n root: string,\n settings: RootSettings,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const generated = yield* files.generatedFiles(root);\n const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);\n const isIgnored = matcher(settings.ignorePatterns);\n const skipped = HashSet.fromIterable([\n ...generated,\n ...pipe(\n vendored,\n Arr.map((name) => files.join(root, name)),\n ),\n ]);\n return pipe(\n listed,\n Arr.filter((name) => !isIgnored(name)),\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n Arr.filter(({ file }) => !HashSet.has(skipped, file)),\n );\n});\n\nconst usedAllowances = (\n allowances: readonly RegExp[],\n found: readonly FoundComment[],\n): readonly number[] =>\n pipe(\n allowances,\n Arr.map((pattern, index) => [pattern, index] as const),\n Arr.filter(([pattern]) =>\n pipe(\n found,\n Arr.some((comment) => pattern.test(valueOf(comment.text))),\n ),\n ),\n Arr.map(([, index]) => index),\n );\n\nconst entryOffset = (source: string, entry: string): number =>\n pipe(\n Str.indexOf(entry)(source),\n Option.getOrElse(() => START),\n );\n\nconst unusedAllowances = Effect.fn(\"unusedAllowances\")(function* unusedAllowances(\n root: string,\n settings: RootSettings,\n used: HashSet.HashSet<number>,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const text = yield* files.readFile(file);\n const source = Option.getOrElse(text, () => \"\");\n return pipe(\n settings.allow,\n Arr.filter((_entry, index) => !HashSet.has(used, index)),\n Arr.map((entry): Problem => ({\n file,\n ...positionOf(source)(entryOffset(source, entry)),\n rule: UNUSED_RULE,\n message: unusedMessage(entry),\n })),\n );\n});\n\ninterface Scanning {\n readonly directives: RegExp;\n readonly allowances: readonly RegExp[];\n readonly comments: ReturnType<typeof commentsWith>;\n}\n\nconst scanFile =\n ({ directives, allowances, comments }: Scanning) =>\n ({ name, file }: Listed, source: string): Effect.Effect<Scanned> => {\n const kept = Predicate.not(isAllowed(source, directives));\n const toProblem = problemOf(file, source);\n return Option.match(readerOf(name)(source), {\n onNone: () => Effect.succeed(NOTHING),\n onSome: (reader) =>\n comments(reader, source).pipe(\n Effect.map((found): Scanned => ({\n problems: pipe(found, Arr.filter(kept), Arr.map(toProblem)),\n used: usedAllowances(allowances, found),\n })),\n Effect.catchTag(\"CommentsUnreadable\", ({ message }) =>\n Effect.succeed({\n problems: [\n problemInFile(RULE)(\n file,\n `msch could not read the comments in this file: ${message}`,\n ),\n ],\n used: [],\n }),\n ),\n ),\n });\n };\n\n/** @internal */\nexport const checkComments = Effect.fn(\"checkComments\")(function* checkComments(root: string) {\n const files = yield* RepositoryFiles;\n const settings = yield* rootSettings(root);\n const scanned = yield* scannedFiles(root, settings);\n const grammars = yield* loadGrammars();\n const scan = scanFile({\n directives: directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]),\n allowances: pipe(\n settings.allow,\n Arr.map((entry) => directivePattern([entry])),\n ),\n comments: commentsWith(grammars),\n });\n const found = yield* Effect.forEach(\n scanned,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.succeed(NOTHING),\n onSome: (source) => scan(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n const used = HashSet.fromIterable(\n pipe(\n found,\n Arr.flatMap(({ used: indexes }) => indexes),\n ),\n );\n const unused = yield* unusedAllowances(root, settings, used);\n return [\n ...pipe(\n found,\n Arr.flatMap(({ problems }) => problems),\n ),\n ...unused,\n ];\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst PROGRAM_SOURCE = /\\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;\nconst CONFIG_SOURCE = /(?:^|\\/)[^/]*\\.config\\.[cm]?[jt]s$/u;\n\nexport const isProgramSource = ({ name }: Listed): boolean =>\n PROGRAM_SOURCE.test(name) && !CONFIG_SOURCE.test(name);\n\nexport interface PatternSets {\n readonly spawn: readonly RegExp[];\n readonly command: readonly RegExp[];\n readonly toolVersions?: readonly RegExp[];\n}\n\nexport const patternsBy =\n ({ spawn, command, toolVersions = [] }: PatternSets) =>\n (entry: Listed): readonly RegExp[] => {\n if (isProgramSource(entry)) {\n return spawn;\n }\n if (isToolVersions(entry)) {\n return [...command, ...toolVersions];\n }\n return command;\n };\n\nexport const spawnPattern = (program: string): RegExp =>\n new RegExp(\n String.raw`(?:\\bcommand[\"']?\\s*[:=]\\s*|(?:\\bspawn\\w*|\\bexec\\w*|\\bexeca|Command::new|ChildProcess\\.make)\\(\\s*|\\$\\(\\s*|\\$\\s*(?=\\x60))[\"'\\x60](?:${program})(?=[\"'\\x60\\s])`,\n \"gu\",\n );\n\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\n\nexport interface BannedTool {\n readonly fileRule: RuleName;\n readonly commandRule: RuleName;\n readonly isFile: (entry: Listed) => boolean;\n readonly patternsFor: (entry: Listed) => readonly RegExp[];\n readonly fileMessage: (entry: Listed) => string;\n readonly commandMessage: (command: string) => string;\n}\n\nconst fileProblem =\n (tool: BannedTool) =>\n (entry: Listed): Problem => ({\n file: entry.file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: tool.fileRule,\n message: tool.fileMessage(entry),\n });\n\nconst commandProblem =\n (tool: BannedTool, entry: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: tool.commandRule,\n message: tool.commandMessage(Str.trim(found[WHOLE_MATCH])),\n });\n\nconst commandProblems =\n (tool: BannedTool) =>\n (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n tool.patternsFor(entry),\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map(commandProblem(tool, entry, source)),\n );\n\n/** @internal */\nexport const checkBannedTool = Effect.fn(\"checkBannedTool\")(function* checkBannedTool(\n root: string,\n tool: BannedTool,\n) {\n const listed = yield* listedFiles(root);\n const isScanned = (entry: Listed): boolean => !tool.isFile(entry) && isScannedText(entry);\n const scanned = yield* scanText(pipe(listed, Arr.filter(isScanned)), commandProblems(tool));\n const present = yield* presentFiles(pipe(listed, Arr.filter(tool.isFile)));\n return [...pipe(present, Arr.map(fileProblem(tool))), ...scanned];\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nimport { checkBannedTool, patternsBy, spawnPattern } from \"./banned-tool.ts\";\nimport type { BannedTool } from \"./banned-tool.ts\";\n\nconst RENAMES: readonly (readonly [pattern: RegExp, name: string])[] = [\n [/(?:^|\\/)Dockerfile(?:\\.[^/]+)?$|\\.dockerfile$/iu, \"Containerfile\"],\n [/(?:^|\\/)(?:[^/]+)?\\.dockerignore$/u, \".containerignore\"],\n [/(?:^|\\/)docker-compose(?:\\.[^/]+)?\\.ya?ml$/u, \"compose.yaml\"],\n];\n\nconst SPAWN_PATTERNS: readonly RegExp[] = [spawnPattern(\"docker(?:-compose)?\")];\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\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,\n /(?<![\\w./@-])docker-compose[ \\t]+(?:up|down|build|run|exec|pull|push|ps|logs|stop|start|restart|config)\\b/gu,\n ...SPAWN_PATTERNS,\n /\\buses:\\s*[\"']?docker(?:\\/[\\w.-]+|:\\/\\/)/gu,\n];\n\nconst renameOf = ({ name }: Listed): Option.Option<string> =>\n pipe(\n RENAMES,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.map(([, renamed]) => renamed),\n );\n\nconst DOCKER: BannedTool = {\n fileRule: \"docker-file\",\n commandRule: \"docker-command\",\n isFile: (entry) => Option.isSome(renameOf(entry)),\n patternsFor: patternsBy({ spawn: SPAWN_PATTERNS, command: COMMAND_PATTERNS }),\n fileMessage: (entry) =>\n `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.`,\n commandMessage: (command) =>\n `Docker is not used in this repository. Replace \\`${command}\\` with podman, which takes the same arguments.`,\n};\n\n/** @internal */\nexport const checkDocker = (root: string): ReturnType<typeof checkBannedTool> =>\n checkBannedTool(root, DOCKER);\n","import { checkBannedTool, patternsBy, spawnPattern } from \"./banned-tool.ts\";\nimport type { BannedTool } from \"./banned-tool.ts\";\n\nconst PYTHON_FILE =\n /(?:\\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\\/)(?:pyproject\\.toml|uv\\.lock|uv\\.toml|poetry\\.lock|Pipfile|Pipfile\\.lock|setup\\.cfg|tox\\.ini|pytest\\.ini|\\.python-version|requirements[^/]*\\.txt))$/u;\n\nconst SPAWN_PATTERNS: readonly RegExp[] = [\n spawnPattern(String.raw`python[\\d.]*|pip3?|pipx|uvx?|poetry`),\n];\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])python[\\d.]*[ \\t]+(?:[-\"'$./]|\\S+\\.py\\b)/gu,\n /(?<![\\w./@-])pip3?[ \\t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\\b/gu,\n /(?<![\\w./@-])pipx[ \\t]+(?:run|install|inject|upgrade)\\b/gu,\n /(?<![\\w./@-])uvx[ \\t]+[^\\s=:,;)|&]/gu,\n /(?<![\\w./@-])uv[ \\t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\\b/gu,\n /(?<![\\w./@-])poetry[ \\t]+(?:run|install|add|lock|build|publish|shell|export)\\b/gu,\n ...SPAWN_PATTERNS,\n /\\buses:\\s*[\"']?(?:actions\\/setup-python|astral-sh\\/setup-uv|astral-sh\\/ruff-action|pypa\\/[\\w.-]+|snok\\/install-poetry|abatilo\\/actions-poetry|conda-incubator\\/setup-miniconda|mamba-org\\/setup-micromamba|pdm-project\\/setup-pdm)\\b/gu,\n];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^\"'\\s=]+)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst PYTHON: BannedTool = {\n fileRule: \"python-file\",\n commandRule: \"python-command\",\n isFile: ({ name }) => PYTHON_FILE.test(name),\n patternsFor: patternsBy({\n spawn: SPAWN_PATTERNS,\n command: COMMAND_PATTERNS,\n toolVersions: TOOL_PATTERNS,\n }),\n fileMessage: () =>\n \"Python is not used in this repository. Replace this file with TypeScript or Rust.\",\n commandMessage: (command) =>\n `Python is not used in this repository. Remove \\`${command}\\` and do the work in TypeScript or Rust.`,\n};\n\n/** @internal */\nexport const checkPython = (root: string): ReturnType<typeof checkBannedTool> =>\n checkBannedTool(root, PYTHON);\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n manifestSpecifiers,\n manifestPattern,\n offsetIn,\n} from \"#/entities/package/index.ts\";\nimport type { Specified } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"uncataloged-dependency\";\nconst OWNED_ELSEWHERE: readonly string[] = [\"catalog:\", \"workspace:\", \"link:\", \"file:\"];\nconst ROOT_DIRECTORY = \".\";\nconst PLUGIN_MANIFEST = \".claude-plugin/plugin.json\";\nconst MESSAGE =\n \"is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.\";\n\nconst isOwnedElsewhere = ({ specifier }: Specified): boolean =>\n pipe(\n OWNED_ELSEWHERE,\n Arr.some((protocol) => Str.startsWith(protocol)(specifier)),\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n manifestSpecifiers(source),\n Arr.filter((found) => !isOwnedElsewhere(found)),\n Arr.map((found): Problem => ({\n file: entry.file,\n ...positionOf(source)(offsetIn(source)(manifestPattern(found))),\n rule: RULE,\n message: `\\`${found.name}\\` \\`${found.specifier}\\` ${MESSAGE}`,\n })),\n );\n\n/** @internal */\nexport const uncatalogedDependencies = Effect.fn(\"uncatalogedDependencies\")(\n function* uncatalogedDependencies(root: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(root);\n const installed = yield* pipe(\n directories,\n Effect.filter((directory) =>\n files\n .exists(files.join(root, directory, PLUGIN_MANIFEST))\n .pipe(Effect.map((found) => !found)),\n ),\n );\n const listed = pipe(\n [ROOT_DIRECTORY, ...installed],\n Arr.map((directory): Listed => {\n const name = files.join(directory, MANIFEST_FILE);\n return { name, file: files.join(root, name) };\n }),\n );\n return yield* scanText(listed, problemsIn);\n },\n);\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { decodeManifest, fieldsOf, namedCatalogsOf } from \"#/entities/package/index.ts\";\nimport type { Fields } from \"#/entities/package/index.ts\";\nimport { lockedPackages, workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { uncatalogedDependencies } from \"./uncataloged-dependencies.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst MANIFEST = /(?:^|\\/)package\\.json$/u;\nconst CATALOG_PROTOCOL = \"catalog:\";\nconst DEFAULT_CATALOG = \"default\";\nconst VERSION_SEPARATOR = \"||\";\nconst WILDCARD = \"*\";\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;\nconst READ_CONCURRENCY = 16;\nconst STALE_RULE: RuleName = \"stale-release-age-exclude\";\nconst UNUSED_RULE: RuleName = \"unused-catalog-entry\";\nconst STALE_MESSAGE =\n \"excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.\";\nconst UNUSED_MESSAGE =\n \"is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.\";\n\ninterface CatalogEntry {\n readonly catalog: string;\n readonly name: string;\n}\n\nconst decodeString = Schema.decodeUnknownOption(Schema.String);\nconst decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));\n\nconst entriesOf =\n (catalog: string) =>\n (held: unknown): readonly CatalogEntry[] =>\n pipe(\n Rec.keys(fieldsOf(held)),\n Arr.map((name) => ({ catalog, name })),\n );\n\nconst catalogEntries = (settings: Fields): readonly CatalogEntry[] => [\n ...entriesOf(DEFAULT_CATALOG)(settings[\"catalog\"]),\n ...pipe(\n namedCatalogsOf(settings),\n Arr.flatMap(([catalog, held]) => entriesOf(catalog)(held)),\n ),\n];\n\nconst catalogOf = (specifier: string): Option.Option<string> =>\n pipe(\n Option.liftPredicate(specifier, Str.startsWith(CATALOG_PROTOCOL)),\n Option.map(Str.slice(CATALOG_PROTOCOL.length)),\n Option.map((name) =>\n Option.getOrElse(Option.liftPredicate(name, Str.isNonEmpty), () => DEFAULT_CATALOG),\n ),\n );\n\nconst referenceOf = ([name, specifier]: readonly [string, unknown]): readonly string[] =>\n pipe(\n decodeString(specifier),\n Option.flatMap(catalogOf),\n Option.map((catalog) => `${catalog}:${name}`),\n Option.toArray,\n );\n\nconst referencesIn = (manifest: Fields): readonly string[] =>\n pipe(\n Rec.values(manifest),\n Arr.flatMap((section) => pipe(fieldsOf(section), Rec.toEntries, Arr.flatMap(referenceOf))),\n );\n\nconst versionsOf = (raw: string | undefined): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(raw),\n Option.map((listed) => pipe(Str.split(listed, VERSION_SEPARATOR), Arr.map(Str.trim))),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst hasKeyWith =\n (keys: readonly string[]) =>\n (prefix: string): boolean =>\n pipe(keys, Arr.some(Str.startsWith(prefix)));\n\nconst isLocked =\n (keys: readonly string[]) =>\n (resolved: string): boolean =>\n Arr.contains(keys, resolved) || hasKeyWith(keys)(`${resolved}(`);\n\nconst hasPackage =\n (keys: readonly string[]) =>\n (name: string): boolean =>\n hasKeyWith(keys)(`${name}@`);\n\nconst lockedVersion =\n (keys: readonly string[], name: string) =>\n (version: string): boolean =>\n isLocked(keys)(`${name}@${version}`);\n\nconst resolvedIn =\n (keys: readonly string[]) =>\n (entry: string): boolean =>\n Str.includes(WILDCARD)(entry) ||\n pipe(\n Option.fromNullishOr(SCOPED_NAME.exec(entry)),\n Option.flatMap(({ groups }) => Option.fromUndefinedOr(groups)),\n Option.match({\n onNone: () => true,\n onSome: ({ name = \"\", versions }) =>\n Arr.match(versionsOf(versions), {\n onEmpty: () => hasPackage(keys)(name),\n onNonEmpty: Arr.some(lockedVersion(keys, name)),\n }),\n }),\n );\n\nconst lockedKeys = (root: string): Effect.Effect<Option.Option<readonly string[]>> =>\n lockedPackages(root).pipe(Effect.orElseSucceed(() => Option.none()));\n\nconst usedReferences = Effect.fn(\"usedReferences\")(function* usedReferences(\n root: string,\n settings: Fields,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const manifests = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((name) => MANIFEST.test(name)),\n ),\n (name) => files.readFile(files.join(root, name)),\n { concurrency: READ_CONCURRENCY },\n );\n const fromManifests = pipe(\n Arr.getSomes(manifests),\n Arr.flatMap((text) => Option.toArray(decodeManifest(text))),\n Arr.flatMap(referencesIn),\n );\n const fromOverrides = pipe(\n fieldsOf(settings[\"overrides\"]),\n Rec.toEntries,\n Arr.flatMap(referenceOf),\n );\n return new Set([...fromManifests, ...fromOverrides]);\n});\n\nconst lineOf =\n (source: string) =>\n (needle: RegExp): number =>\n pipe(\n Str.split(source, \"\\n\"),\n Arr.findFirstIndex((line) => needle.test(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst quoted = (name: string): string =>\n Str.replaceAll(/[$()*+.?[\\\\\\]^{|}]/gu, String.raw`\\$&`)(name);\n\nconst entryLine = (name: string): RegExp => new RegExp(`^\\\\s+[\"']?${quoted(name)}[\"']?:`, \"u\");\n\nconst excludeLine = (entry: string): RegExp =>\n new RegExp(`^\\\\s+-\\\\s+[\"']?${quoted(entry)}[\"']?\\\\s*$`, \"u\");\n\ninterface Located {\n readonly file: string;\n readonly at: (needle: RegExp) => number;\n}\n\nconst problemAt =\n ({ file, at }: Located, rule: RuleName, message: string) =>\n (name: string, needle: RegExp): Problem => ({\n file,\n line: at(needle),\n column: FIRST_COLUMN,\n rule,\n message: `\\`${name}\\` ${message}`,\n });\n\nconst unusedIn = (\n located: Located,\n settings: Fields,\n isUsed: (reference: string) => boolean,\n): readonly Problem[] =>\n pipe(\n catalogEntries(settings),\n Arr.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)),\n Arr.map(({ name }) => problemAt(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))),\n );\n\nconst staleIn = (\n located: Located,\n settings: Fields,\n keys: Option.Option<readonly string[]>,\n): readonly Problem[] => {\n const excludes = Option.getOrElse(\n decodeStrings(settings[\"minimumReleaseAgeExclude\"]),\n (): readonly string[] => [],\n );\n return pipe(\n Option.toArray(keys),\n Arr.flatMap((locked) =>\n pipe(\n excludes,\n Arr.filter((entry) => !resolvedIn(locked)(entry)),\n ),\n ),\n Arr.map((entry) => problemAt(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))),\n );\n};\n\nconst findingsIn = Effect.fn(\"findingsIn\")(function* findingsIn(\n root: string,\n file: string,\n settings: Fields,\n) {\n const files = yield* RepositoryFiles;\n const read = yield* files.readFile(file);\n const located: Located = { file, at: lineOf(Option.getOrElse(read, () => \"\")) };\n const used = yield* usedReferences(root, settings);\n const keys = yield* lockedKeys(root);\n return [\n ...unusedIn(located, settings, (reference) => used.has(reference)),\n ...staleIn(located, settings, keys),\n ];\n});\n\n/** @internal */\nexport const checkCatalogEntries = Effect.fn(\"checkCatalogEntries\")(function* checkCatalogEntries(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* workspaceManifest(root);\n const catalogs = yield* Option.match(manifest, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE), fieldsOf(settings)),\n });\n const uncataloged = yield* Option.match(manifest, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: () => uncatalogedDependencies(root),\n });\n return [...catalogs, ...uncataloged];\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst ENTRY_RULE: RuleName = \"unlocked-skill\";\nconst VISIBLE_RULE: RuleName = \"skill-source-visible\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst RENOVATE_FILE = \"renovate.json\";\nconst SOURCE = \"masseater/skills\";\nconst PRESET = \"github>masseater/ecosystems//libs/vite-plus-adopt/renovate\";\nconst START = 0;\nconst LOCAL_PREFIX = \"./\";\nconst REGEX_SPECIAL = /[.*+?^${}()|[\\]\\\\/]/gu;\n\nconst Source = Schema.Struct({\n commit: Schema.optional(Schema.String),\n skills: Schema.Union([Schema.Literal(\"all\"), Schema.Array(Schema.String)]),\n});\nconst SkillsConfig = Schema.Struct({\n skills: Schema.Record(Schema.String, Source),\n});\nconst decodeSkills = Schema.decodeUnknownOption(SkillsConfig);\n\nconst taggedError = Schema.TaggedError;\n\nclass SkillsConfigUnreadable extends taggedError<\n SkillsConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"SkillsConfigUnreadable\", { file: Schema.String }) {}\n\ntype Sources = Readonly<Record<string, typeof Source.Type>>;\n\ninterface Declared {\n readonly file: string;\n readonly text: string;\n readonly sources: Sources;\n}\n\nconst problemAt =\n (rule: RuleName, file: string, text: string) =>\n (anchor: string, message: string): Problem => ({\n file,\n ...positionOf(text)(\n pipe(\n Str.indexOf(anchor)(text),\n Option.getOrElse(() => START),\n ),\n ),\n rule,\n message,\n });\n\nconst declaredSkills = Effect.fn(\"declaredSkills\")(function* declaredSkills(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<Declared>();\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => SkillsConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(\n config,\n Option.flatMap(decodeSkills),\n Option.map(({ skills }): Declared => ({ file, text: text.value, sources: skills })),\n );\n});\n\nconst entryProblems = ({ file, text, sources }: Declared): readonly Problem[] => {\n const at = problemAt(ENTRY_RULE, file, text);\n return pipe(\n Rec.get(sources, SOURCE),\n Option.match({\n onNone: () => [\n at(\n \"skills\",\n `does not install ${SOURCE}. Add \"${SOURCE}\": { commit, root: \"plugins/masseater-skills/skills\", skills: \"all\" } to skills.`,\n ),\n ],\n onSome: (source) =>\n pipe(\n Option.liftPredicate(source, ({ skills }) => skills !== \"all\"),\n Option.map(() =>\n at(\n `\"${SOURCE}\"`,\n `picks skills from ${SOURCE} by name. Write skills: \"all\", so every repository gets each new skill with the next digest update.`,\n ),\n ),\n Option.toArray,\n ),\n }),\n );\n};\n\nconst literalPattern = (repository: string, commit: string): RegExp =>\n new RegExp(\n `\"${Str.replaceAll(REGEX_SPECIAL, String.raw`\\$&`)(repository)}\": \\\\{\\\\s*commit: \"${commit}\"`,\n \"u\",\n );\n\nconst visibleProblems = ({ file, text, sources }: Declared): readonly Problem[] =>\n pipe(\n Rec.toEntries(sources),\n Arr.filter(([repository]) => !Str.startsWith(LOCAL_PREFIX)(repository)),\n Arr.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? \"\").test(text)),\n Arr.map(([repository]) =>\n problemAt(\n VISIBLE_RULE,\n file,\n text,\n )(\n repository,\n `declares ${repository} in a form the Renovate preset cannot read. Write \"${repository}\": { commit: \"<sha>\", ... } with commit first and as a string literal.`,\n ),\n ),\n );\n\nconst presetProblems = Effect.fn(\"presetProblems\")(function* presetProblems(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, RENOVATE_FILE);\n const text = yield* files.readFile(file);\n const extended = pipe(text, Option.exists(Str.includes(`\"${PRESET}\"`)));\n if (extended) {\n return [];\n }\n return [\n problemAt(\n VISIBLE_RULE,\n file,\n Option.getOrElse(text, () => \"\"),\n )(\n \"extends\",\n `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`,\n ),\n ];\n});\n\n/** @internal */\nexport const checkSkillEntry = Effect.fn(\"checkSkillEntry\")(function* checkSkillEntry(\n root: string,\n) {\n const declared = yield* declaredSkills(root);\n if (Option.isNone(declared)) {\n return [];\n }\n const preset = yield* presetProblems(root);\n return [...entryProblems(declared.value), ...visibleProblems(declared.value), ...preset];\n});\n","import { fileURLToPath } from \"node:url\";\n\nimport { findSkillFiles } from \"@tanstack/intent\";\nimport { Array as Arr, Effect, Option, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { publishedProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"published-skills\";\nconst KEYWORD = \"tanstack-intent\";\nconst SKILLS = \"skills\";\nconst MANIFEST_FILE = \"package.json\";\nconst SKILL_FILE = \"SKILL.md\";\nconst SUCCEEDED = 0;\nconst INTENT_CLI = fileURLToPath(new URL(\"./cli.mjs\", import.meta.resolve(\"@tanstack/intent\")));\n\nconst problemAt = problemInFile(RULE);\n\nconst skillDirectoriesIn = (\n files: typeof RepositoryFiles.Service,\n directory: string,\n): readonly string[] =>\n pipe(\n findSkillFiles(files.join(directory, SKILLS)),\n Arr.filter((file) => files.basename(file) === SKILL_FILE),\n Arr.map((file) => files.relative(directory, files.dirname(file))),\n );\n\nconst isShipped =\n (listed: readonly string[]) =>\n (skill: string): boolean =>\n Arr.contains(listed, SKILLS) || Arr.contains(listed, skill);\n\nconst packagingMessages = (\n { keywords, files }: WorkspaceProject,\n skills: readonly string[],\n): readonly string[] => {\n const keyword = pipe(\n Option.liftPredicate(keywords, (own) => !Arr.contains(own, KEYWORD)),\n Option.map(\n () =>\n `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`,\n ),\n );\n const unshipped = pipe(\n files,\n Option.map((listed) =>\n pipe(\n skills,\n Arr.filter((skill) => !isShipped(listed)(skill)),\n ),\n ),\n Option.filter((left) => Arr.isReadonlyArrayNonEmpty(left)),\n Option.map(\n (left) =>\n `leaves ${Arr.join(left, \", \")} out of files, so the published package does not ship them. List them in files.`,\n ),\n );\n return Arr.getSomes([keyword, unshipped]);\n};\n\nconst validationOf = Effect.fn(\"validationOf\")(function* validationOf(directory: string) {\n const handle = yield* ChildProcess.make(\"node\", [INTENT_CLI, \"validate\", SKILLS], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [output, status] = yield* Effect.all(\n [handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n return Option.liftPredicate(Str.trim(output), () => Number(status) !== SUCCEEDED);\n}, Effect.scoped);\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n project: WorkspaceProject,\n) {\n const files = yield* RepositoryFiles;\n const directory = files.join(root, project.directory);\n const manifest = files.join(directory, MANIFEST_FILE);\n const skills = skillDirectoriesIn(files, directory);\n if (!Arr.isReadonlyArrayNonEmpty(skills)) {\n return [\n problemAt(\n manifest,\n `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`,\n ),\n ];\n }\n const validation = yield* validationOf(directory).pipe(\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return [\n ...pipe(\n packagingMessages(project, skills),\n Arr.map((message) => problemAt(manifest, message)),\n ),\n ...pipe(\n validation,\n Option.map((output) =>\n problemAt(files.join(directory, SKILLS), `fails intent validate:\\n${output}`),\n ),\n Option.toArray,\n ),\n ];\n});\n\n/** @internal */\nexport const checkPublishedSkills = Effect.fn(\"checkPublishedSkills\")(\n function* checkPublishedSkills(root: string) {\n const projects = yield* publishedProjects(root);\n const problems = yield* Effect.forEach(projects, (project) => problemsIn(root, project), {\n concurrency: 1,\n });\n return Arr.flatten(problems);\n },\n);\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"skill-file\";\nconst SKILL_FILE = /(?:^|\\/)SKILL\\.md$/u;\nconst INSTALLED = /(?:^|\\/)\\.(?:agents|claude|codex)\\/skills\\//u;\nconst FIXTURE = /(?:^|\\/)fixtures\\//u;\nconst MARKDOWN = \".md\";\nconst LICENSE_FILE = /^LICEN[CS]E(?:\\.[^/]+)?$/iu;\nconst FRONTMATTER = /^---\\n(?<yaml>[\\s\\S]*?)\\n---\\n/u;\nconst HEADING = /^# (?<title>.+)$/mu;\nconst NAME_KEY = /^name:/mu;\nconst LICENSE_KEY = /^license:/mu;\nconst CODE = /```[\\s\\S]*?```|`[^`\\n]*`/gu;\nconst LINK = /\\]\\((?<target>[^)\\s]+)\\)/gu;\nconst EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\\/)|[<>{}]/iu;\nconst FRAGMENT = /#.*$/u;\nconst GITHUB = \"https://github.com/\";\nconst COMMIT_LINK = /\\/(?:blob|tree)\\/[0-9a-f]{40}(?:\\/|$)/u;\nconst BLANK = /\\s+/u;\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\n\nconst Metadata = Schema.Struct({ \"derived-from\": Schema.optional(Schema.String) });\nconst Frontmatter = Schema.Struct({\n name: Schema.optional(Schema.String),\n license: Schema.optional(Schema.Unknown),\n metadata: Schema.optional(Metadata),\n});\nconst decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);\n\ninterface Skill {\n readonly file: string;\n readonly directory: string;\n readonly source: string;\n}\n\nconst offsetOf = (source: string, pattern: RegExp | string): number =>\n pipe(\n Str.search(pattern)(source),\n Option.getOrElse(() => START),\n );\n\nconst frontmatterOf = (source: string): Option.Option<typeof Frontmatter.Type> =>\n pipe(\n groupOf(\"yaml\")(FRONTMATTER.exec(source)),\n Option.flatMap(Option.liftThrowable((yaml: string): unknown => parse(yaml))),\n Option.flatMap(decodeFrontmatter),\n );\n\nconst bodyStartOf = (source: string): number =>\n pipe(\n Option.fromNullishOr(FRONTMATTER.exec(source)),\n Option.map((found) => found[START].length),\n Option.getOrElse(() => START),\n );\n\nconst headingText = (heading: Option.Option<string>): string =>\n pipe(\n heading,\n Option.map((title) => `\"# ${title}\"`),\n Option.getOrElse(() => \"missing\"),\n );\n\nconst nameProblems = (\n { source, directory }: Skill,\n name: string,\n folder: string,\n): readonly { readonly index: number; readonly message: string }[] => {\n const bodyStart = bodyStartOf(source);\n const body = Str.slice(bodyStart)(source);\n const heading = groupOf(\"title\")(HEADING.exec(body));\n return [\n ...pipe(\n Option.liftPredicate(name, (found) => found !== folder),\n Option.map((found) => ({\n index: offsetOf(source, NAME_KEY),\n message: `The frontmatter name \"${found}\" differs from the directory ${directory}. Give the skill the name of its directory.`,\n })),\n Option.toArray,\n ),\n ...pipe(\n Option.liftPredicate(heading, (found) => !Option.contains(found, name)),\n Option.map((found) => ({\n index: bodyStart + offsetOf(body, HEADING),\n message: `The first heading is ${headingText(found)}. Start the body with \"# ${name}\", the frontmatter name.`,\n })),\n Option.toArray,\n ),\n ];\n};\n\nconst derivedProblems = (\n source: string,\n derived: string,\n): readonly { readonly index: number; readonly message: string }[] =>\n pipe(\n Str.split(Str.trim(derived), BLANK),\n Arr.filter((url) => Str.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)),\n Arr.map((url) => ({\n index: offsetOf(source, url),\n message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`,\n })),\n );\n\nconst frontmatterProblems = (skill: Skill, folder: string): readonly Problem[] =>\n pipe(\n frontmatterOf(skill.source),\n Option.map((frontmatter) => [\n ...pipe(\n Option.fromUndefinedOr(frontmatter.name),\n Option.map((name) => nameProblems(skill, name, folder)),\n Option.getOrElse(() => []),\n ),\n ...pipe(\n Option.fromUndefinedOr(frontmatter.license),\n Option.map(() => ({\n index: offsetOf(skill.source, LICENSE_KEY),\n message:\n \"The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it.\",\n })),\n Option.toArray,\n ),\n ...pipe(\n Option.fromUndefinedOr(frontmatter.metadata),\n Option.flatMap((metadata) => Option.fromUndefinedOr(metadata[\"derived-from\"])),\n Option.map((derived) => derivedProblems(skill.source, derived)),\n Option.getOrElse(() => []),\n ),\n ]),\n Option.getOrElse(() => []),\n Arr.map(({ index, message }): Problem => ({\n file: skill.file,\n ...positionOf(skill.source)(index),\n rule: RULE,\n message,\n })),\n );\n\ninterface Link {\n readonly target: string;\n readonly index: number;\n}\n\nconst linkOf = (found: RegExpMatchArray): readonly Link[] =>\n pipe(\n groupOf(\"target\")(found),\n Option.filter((target) => !EXTERNAL.test(target)),\n Option.map((target) => Str.replace(FRAGMENT, \"\")(target)),\n Option.filter(Str.isNonEmpty),\n Option.map((target): Link => ({ target, index: found.index ?? START })),\n Option.toArray,\n );\n\ntype Range = readonly [start: number, end: number];\n\nconst rangeOf = (found: RegExpMatchArray): Range => {\n const start = found.index ?? START;\n return [start, start + found[START].length];\n};\n\nconst isOutside =\n (ranges: readonly Range[]) =>\n ({ index }: Link): boolean =>\n !pipe(\n ranges,\n Arr.some(([start, end]) => index >= start && index < end),\n );\n\nconst linksIn = (source: string): readonly Link[] => {\n const code = pipe(Arr.fromIterable(Str.matchAll(CODE)(source)), Arr.map(rangeOf));\n return pipe(\n Arr.fromIterable(Str.matchAll(LINK)(source)),\n Arr.flatMap(linkOf),\n Arr.filter(isOutside(code)),\n );\n};\n\nconst linkProblems = Effect.fn(\"linkProblems\")(function* linkProblems(file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return [];\n }\n const source = text.value;\n const directory = files.dirname(file);\n const isMissing = ({ target }: Link): Effect.Effect<boolean> =>\n files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));\n const missing = yield* Effect.filter(linksIn(source), isMissing);\n return pipe(\n missing,\n Arr.map(({ target, index }): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: `links to ${target}, which does not exist. Fix the path or remove the link.`,\n })),\n );\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n listed: readonly string[],\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const directory = files.dirname(name);\n const inside = pipe(listed, Arr.filter(Str.startsWith(`${directory}${SEPARATOR}`)));\n const text = yield* files.readFile(file);\n const documents = pipe(\n inside,\n Arr.filter(Str.endsWith(MARKDOWN)),\n Arr.map((entry) => files.join(root, entry)),\n );\n const links = yield* Effect.forEach(documents, linkProblems, {\n concurrency: READ_CONCURRENCY,\n });\n const licenses = pipe(\n inside,\n Arr.filter((entry) => files.dirname(entry) === directory),\n Arr.filter((entry) => LICENSE_FILE.test(files.basename(entry))),\n Arr.map((entry): Problem => ({\n file: files.join(root, entry),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message:\n \"is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it.\",\n })),\n );\n return [\n ...pipe(\n text,\n Option.map((source) =>\n frontmatterProblems({ file, directory, source }, files.basename(directory)),\n ),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n ...licenses,\n ...Arr.flatten(links),\n ];\n});\n\n/** @internal */\nexport const checkSkillFiles = Effect.fn(\"checkSkillFiles\")(function* checkSkillFiles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const skills = pipe(\n listed,\n Arr.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)),\n );\n const found = yield* Effect.forEach(skills, (name) => problemsIn(root, listed, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\nimport { parse } from \"yaml\";\n\nimport { fieldsOf, namedCatalogsOf } from \"#/entities/package/index.ts\";\nimport type { Fields } from \"#/entities/package/index.ts\";\n\nexport interface VersionEntry {\n readonly key: string;\n readonly name: string;\n readonly spec: string;\n}\n\nconst MANIFEST_SECTIONS = [\"dependencies\", \"devDependencies\", \"optionalDependencies\", \"engines\"];\nconst CARGO_SECTIONS = [\"dependencies\", \"dev-dependencies\", \"build-dependencies\"];\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\nconst decodeString = Schema.decodeUnknownOption(Schema.String);\nconst decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));\n\nconst decodeSpec = (value: unknown): Option.Option<string> =>\n Option.orElse(decodeString(value), () =>\n Option.map(decodeVersioned(value), ({ version }) => version),\n );\n\nconst PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));\n\nconst decodePackageManager = Schema.decodeUnknownOption(PackageManager);\n\nconst fieldOf =\n (name: string) =>\n (value: unknown): unknown =>\n fieldsOf(value)[name];\n\nconst entriesIn =\n (section: string) =>\n (held: unknown): readonly VersionEntry[] =>\n pipe(\n Rec.toEntries(fieldsOf(held)),\n Arr.flatMap(([name, value]) =>\n pipe(\n decodeSpec(value),\n Option.map((spec) => ({ key: `${section}:${name}`, name, spec })),\n Option.toArray,\n ),\n ),\n );\n\nconst sectionsIn =\n (sections: readonly string[]) =>\n (fields: Fields): readonly VersionEntry[] =>\n pipe(\n sections,\n Arr.flatMap((section) => entriesIn(section)(fields[section])),\n );\n\nconst packageManagerOf = (value: unknown): readonly VersionEntry[] =>\n pipe(\n decodePackageManager(value),\n Option.map((raw) => {\n const [name, version = \"\"] = Str.split(raw, \"@\");\n return { key: `packageManager:${name}`, name, spec: version };\n }),\n Option.toArray,\n );\n\nexport const manifestEntries = (text: string): readonly VersionEntry[] => {\n const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);\n return [\n ...sectionsIn(MANIFEST_SECTIONS)(manifest),\n ...packageManagerOf(manifest[\"packageManager\"]),\n ];\n};\n\nconst catalogsIn = (settings: Fields): readonly VersionEntry[] =>\n pipe(\n namedCatalogsOf(settings),\n Arr.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)),\n );\n\nexport const workspaceEntries = (text: string): readonly VersionEntry[] => {\n const settings = Option.liftThrowable(() => parse(text) as unknown)().pipe(\n Option.getOrUndefined,\n fieldsOf,\n );\n return [...sectionsIn([\"catalog\", \"overrides\"])(settings), ...catalogsIn(settings)];\n};\n\nconst parseToml = (text: string): Fields =>\n pipe(\n Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(),\n Option.map(fieldsOf),\n Option.getOrElse(() => ({})),\n );\n\nconst singleEntry = (key: string, value: unknown): readonly VersionEntry[] =>\n pipe(\n decodeSpec(value),\n Option.map((spec) => ({ key, name: key, spec })),\n Option.toArray,\n );\n\nexport const cargoEntries = (text: string): readonly VersionEntry[] => {\n const cargo = parseToml(text);\n return [\n ...sectionsIn(CARGO_SECTIONS)(cargo),\n ...entriesIn(\"workspace.dependencies\")(fieldOf(\"dependencies\")(cargo[\"workspace\"])),\n ...singleEntry(\"rust-version\", fieldOf(\"rust-version\")(cargo[\"package\"])),\n ];\n};\n\nexport const toolchainEntries = (text: string): readonly VersionEntry[] =>\n singleEntry(\"channel\", fieldOf(\"channel\")(parseToml(text)[\"toolchain\"]));\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { baseRevision } from \"#/shared/lib/base-revision.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport {\n cargoEntries,\n manifestEntries,\n toolchainEntries,\n workspaceEntries,\n} from \"./version-entries.ts\";\nimport type { VersionEntry } from \"./version-entries.ts\";\n\nconst RULE: RuleName = \"version-downgrade\";\nconst READ_CONCURRENCY = 16;\n\nconst READERS: readonly (readonly [RegExp, (text: string) => readonly VersionEntry[]])[] = [\n [/(?:^|\\/)package\\.json$/u, manifestEntries],\n [/^pnpm-workspace\\.yaml$/u, workspaceEntries],\n [/(?:^|\\/)Cargo\\.toml$/u, cargoEntries],\n [/(?:^|\\/)rust-toolchain\\.toml$/u, toolchainEntries],\n];\n\nconst lowestOf = (spec: string): Option.Option<semver.SemVer> =>\n pipe(\n Option.liftThrowable(() => semver.minVersion(spec))(),\n Option.flatMap(Option.fromNullishOr),\n Option.orElse(() => Option.fromNullishOr(semver.coerce(spec))),\n );\n\nconst isLower = (before: string, after: string): boolean =>\n pipe(\n Option.all([lowestOf(before), lowestOf(after)]),\n Option.match({\n onNone: () => false,\n onSome: ([old, current]) => semver.lt(current, old),\n }),\n );\n\nconst FIRST_LINE = 1;\n\nconst lineOf = (text: string, { name, spec }: VersionEntry): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes(name)(line) && Str.includes(spec)(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst message = (before: VersionEntry, after: VersionEntry): string =>\n `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;\n\ninterface Compared {\n readonly file: string;\n readonly text: string;\n readonly before: readonly VersionEntry[];\n readonly after: readonly VersionEntry[];\n}\n\nconst downgradesIn = ({ file, text, before, after }: Compared): readonly Problem[] => {\n const previous = Rec.fromEntries(\n pipe(\n before,\n Arr.map((entry) => [entry.key, entry] as const),\n ),\n );\n return pipe(\n after,\n Arr.flatMap((entry) =>\n pipe(\n Rec.get(previous, entry.key),\n Option.filter((old) => isLower(old.spec, entry.spec)),\n Option.map((old): Problem => ({\n file,\n line: lineOf(text, entry),\n column: FIRST_LINE,\n rule: RULE,\n message: message(old, entry),\n })),\n Option.toArray,\n ),\n ),\n );\n};\n\n/** @internal */\nexport const checkDowngrades = Effect.fn(\"checkDowngrades\")(function* checkDowngrades(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const base = yield* baseRevision(root);\n if (Option.isNone(base)) {\n return [];\n }\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.flatMap((name) =>\n pipe(\n READERS,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.map(([, read]) => [name, read] as const),\n Option.toArray,\n ),\n ),\n ),\n ([name, read]) =>\n Effect.gen(function* compare() {\n const file = files.join(root, name);\n const current = yield* files.readFile(file);\n const previous = yield* files.readAtRevision(root, base.value, name);\n return pipe(\n Option.all([previous, current]),\n Option.map(([before, after]) =>\n downgradesIn({ file, text: after, before: read(before), after: read(after) }),\n ),\n Option.getOrElse((): readonly Problem[] => []),\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RENOVATE_FILE = /^(?:\\.github\\/|\\.gitlab\\/)?(?:renovate\\.json5?|\\.renovaterc(?:\\.json5?)?)$/u;\nconst AUTOMERGE_OFF = /[\"']?platformAutomerge[\"']?\\s*:\\s*false/gu;\nconst VERSION_CAP = /[\"']?allowedVersions[\"']?\\s*:\\s*[\"'](?<range>[^\"']*<[^\"']*)[\"']/gu;\nconst AUTOMERGE_RULE: RuleName = \"renovate-platform-automerge\";\nconst CAP_RULE: RuleName = \"renovate-version-cap\";\nconst PRESET_RULE: RuleName = \"renovate-msch-preset\";\nconst PRESET = \"github>masseater/ecosystems//libs/msch/renovate\";\nconst START = 0;\nconst READ_CONCURRENCY = 16;\nconst AUTOMERGE_MESSAGE =\n \"sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.\";\nconst CAP_MESSAGE =\n \"caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.\";\n\nconst PRESET_MESSAGE = `does not extend \\`${PRESET}\\`, so Renovate writes ranges that the \\`version-range\\` check rejects. Add it to \\`extends\\`.`;\n\nconst offsetsOf = (pattern: RegExp, source: string): readonly number[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))),\n );\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n const at = positionOf(source);\n const found = (pattern: RegExp, rule: RuleName, message: string): readonly Problem[] =>\n pipe(\n offsetsOf(pattern, source),\n Arr.map((offset): Problem => ({ file, ...at(offset), rule, message })),\n );\n return [\n ...found(AUTOMERGE_OFF, AUTOMERGE_RULE, AUTOMERGE_MESSAGE),\n ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),\n ...pipe(\n [{ file, ...at(START), rule: PRESET_RULE, message: PRESET_MESSAGE }],\n Arr.filter(() => !Str.includes(`\"${PRESET}\"`)(source)),\n ),\n ];\n};\n\n/** @internal */\nexport const checkRenovateSettings = Effect.fn(\"checkRenovateSettings\")(\n function* checkRenovateSettings(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((name) => RENOVATE_FILE.test(name)),\n ),\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(\n Effect.map(\n Option.match({ onNone: () => [], onSome: (source) => problemsIn(file, source) }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { baseName, baseRevision } from \"#/shared/lib/base-revision.ts\";\nimport { manifestTexts } from \"#/shared/lib/manifest-texts.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unbumped-package\";\nconst UNSHIPPED =\n /(?:\\.test\\.[\\w.]+$|(?:^|\\/)(?:fixtures|__tests__|tests?)\\/|(?:^|\\/)(?:AGENTS|CLAUDE|CHANGELOG)\\.md$)/u;\nconst UNVERSIONED = \"0.0.0\";\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst READ_CONCURRENCY = 16;\n\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n version: Schema.String,\n private: Schema.optional(Schema.Boolean),\n }),\n);\n\ninterface Package {\n readonly file: string;\n readonly directory: string;\n readonly name: string;\n readonly version: string;\n readonly text: string;\n}\n\nconst LAST_SEGMENT = /[^/]*$/u;\n\nconst directoryOf = (file: string): string => Str.replace(LAST_SEGMENT, \"\")(file);\n\nconst decodeManifest = Schema.decodeUnknownOption(Manifest);\n\nconst packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodeManifest(text),\n Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED),\n Option.map(({ name, version }): Package => ({\n file,\n directory: directoryOf(file),\n name,\n version,\n text,\n })),\n );\n\nconst versionAt = (name: string, text: Option.Option<string>): Option.Option<string> =>\n pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.filter((manifest) => manifest.name === name),\n Option.map(({ version }) => version),\n Option.filter((version) => semver.valid(version) !== null),\n );\n\nconst versionLine = (text: string): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes('\"version\"')(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst shippedChange = (directory: string, changed: readonly string[]): boolean =>\n pipe(\n changed,\n Arr.some((name) => Str.startsWith(directory)(name) && !UNSHIPPED.test(name)),\n );\n\nconst higher = (left: string, right: string): string => {\n if (semver.gt(right, left)) {\n return right;\n }\n return left;\n};\n\nconst floorOf = (versions: readonly Option.Option<string>[]): Option.Option<string> => {\n let floor = Option.none<string>();\n for (const version of Arr.getSomes(versions)) {\n floor = Option.match(floor, {\n onNone: () => Option.some(version),\n onSome: (lowest) => Option.some(higher(version, lowest)),\n });\n }\n return floor;\n};\n\nconst message = ({ name, version }: Package, floor: string): string =>\n `${name} changed, but its version ${version} is not above ${floor}, the version of the base or of main. Another change may already publish ${floor}. Bump the version above ${floor}.`;\n\n/** @internal */\nexport const checkPackageVersions = Effect.fn(\"checkPackageVersions\")(\n function* checkPackageVersions(root: string) {\n const files = yield* RepositoryFiles;\n const base = yield* baseRevision(root);\n if (Option.isNone(base)) {\n return [];\n }\n const tip = yield* baseName;\n const changed = yield* files.changedFiles(root, base.value);\n const manifests = yield* manifestTexts(root);\n const packages = pipe(\n manifests,\n Arr.map(({ file, text }) => packageAt(file, text)),\n );\n const found = yield* Effect.forEach(\n pipe(\n Arr.getSomes(packages),\n Arr.filter(({ directory }) => shippedChange(directory, changed)),\n ),\n (pack) =>\n Effect.gen(function* compare() {\n const before = yield* files.readAtRevision(root, base.value, pack.file);\n const claimed = yield* files.readAtRevision(root, tip, pack.file);\n const floor = floorOf([versionAt(pack.name, before), versionAt(pack.name, claimed)]);\n return pipe(\n floor,\n Option.filter((lowest) => !semver.gt(pack.version, lowest)),\n Option.map((lowest): Problem => ({\n file: files.join(root, pack.file),\n line: versionLine(pack.text),\n column: FIRST_COLUMN,\n rule: RULE,\n message: message(pack, lowest),\n })),\n Option.toArray,\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst HIDDEN =\n /[\\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;\n\nconst NUL = \"\\0\";\nconst START = 0;\nconst HEX = 16;\nconst CODE_POINT_WIDTH = 4;\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"hidden-unicode\";\n\nconst hexOf = (character: string): string =>\n pipe(\n Str.codePointAt(START)(character),\n Option.getOrElse(() => START),\n (code) => code.toString(HEX),\n Str.toUpperCase,\n Str.padStart(CODE_POINT_WIDTH, \"0\"),\n );\n\nconst problemOf =\n (file: string, source: string) =>\n (found: RegExpMatchArray): Problem => {\n const hex = hexOf(found[START]);\n return {\n file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\\\u${hex}.`,\n };\n };\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n if (Str.includes(NUL)(source)) {\n return [];\n }\n return pipe(Arr.fromIterable(Str.matchAll(HIDDEN)(source)), Arr.map(problemOf(file, source)));\n};\n\n/** @internal */\nexport const checkHiddenUnicode = Effect.fn(\"checkHiddenUnicode\")(function* checkHiddenUnicode(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(file, source),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { fileURLToPath } from \"node:url\";\n\nimport {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE, readManifest } from \"#/entities/package/index.ts\";\nimport type { Manifest } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { isScannedText, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nexport interface AppliedPackage {\n readonly name: string;\n readonly bins: readonly string[];\n}\n\nconst MSCH = \"@r_masseater/msch\";\nconst SCOPE = \"@r_masseater/\";\nconst RULE: RuleName = \"applied-package\";\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst NOT_FOUND = -1;\nconst SEPARATOR = \"/\";\n\nconst BY_LENGTH = Order.mapInput(Order.Number, (text: string) => text.length);\n\nconst BinMap = Schema.Record(Schema.String, Schema.String);\nconst BinField = Schema.Struct({\n bin: Schema.optional(Schema.Union([Schema.String, BinMap])),\n});\nconst decodeBinField = Schema.decodeUnknownOption(Schema.fromJsonString(BinField));\n\nconst escaped = (text: string): string =>\n Str.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, String.raw`\\$&`)(text);\n\nconst declaredNames = (manifest: Manifest): readonly string[] =>\n pipe(\n [manifest.dependencies, manifest.devDependencies, manifest.peerDependencies],\n Arr.flatMap((field) => Rec.keys(field ?? {})),\n );\n\nconst binsIn = (name: string, text: string): readonly string[] =>\n pipe(\n decodeBinField(text),\n Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)),\n Option.match({\n onNone: (): readonly string[] => [],\n onSome: (bin) => {\n if (Predicate.isString(bin)) {\n return [pipe(name, Str.split(SEPARATOR), Arr.lastNonEmpty)];\n }\n return Rec.keys(bin);\n },\n }),\n );\n\nconst manifestOf = Option.liftThrowable((name: string): string =>\n fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE}`)),\n);\n\nconst installedPackage = Effect.fn(\"installedPackage\")(function* installedPackage(name: string) {\n const files = yield* RepositoryFiles;\n const text = yield* pipe(\n manifestOf(name),\n Option.match({\n onNone: () => Effect.succeed(Option.none<string>()),\n onSome: (file) => files.readFile(file),\n }),\n );\n return {\n name,\n bins: pipe(\n text,\n Option.map((source) => binsIn(name, source)),\n Option.getOrElse((): readonly string[] => []),\n ),\n };\n});\n\nconst appliedByMsch = Effect.fn(\"appliedByMsch\")(function* appliedByMsch() {\n const files = yield* RepositoryFiles;\n const manifest = yield* pipe(\n manifestOf(MSCH),\n Option.match({\n onNone: () => Effect.succeed(Option.none<Manifest>()),\n onSome: (file) => readManifest(files.dirname(file)),\n }),\n );\n const names = pipe(\n manifest,\n Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n Arr.filter(Str.startsWith(SCOPE)),\n );\n return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });\n});\n\nconst problemAt =\n (file: string, source: string) =>\n (index: number, name: string): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: `msch applies ${name}. Remove this use and let msch apply it.`,\n });\n\nconst specifierPattern = ({ name }: AppliedPackage): RegExp =>\n new RegExp(`[\"'\\`]${escaped(name)}(?=[\"'\\`/])`, \"gu\");\n\nconst binPattern = (bin: string): RegExp =>\n new RegExp(`(?<![\\\\w./@:-])${escaped(bin)}(?=[ \\\\t\"'\\`]|$)`, \"gmu\");\n\nconst usesIn =\n (applied: readonly AppliedPackage[]) =>\n ({ file }: Listed, source: string): readonly Problem[] =>\n pipe(\n applied,\n Arr.flatMap((entry) =>\n pipe(\n [specifierPattern(entry), ...pipe(entry.bins, Arr.map(binPattern))],\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map((found) => problemAt(file, source)(found.index ?? NOT_FOUND, entry.name)),\n ),\n ),\n );\n\nconst ownerOf =\n (directories: readonly string[]) =>\n (name: string): string =>\n pipe(\n directories,\n Arr.filter(\n (directory) => directory === \"\" || Str.startsWith(`${directory}${SEPARATOR}`)(name),\n ),\n Arr.match({ onEmpty: () => \"\", onNonEmpty: Arr.max(BY_LENGTH) }),\n );\n\nconst isScannedSource = (entry: Listed): boolean =>\n isScannedText(entry) && !Str.endsWith(MANIFEST_FILE)(entry.name) && entry.name !== WORKSPACE_FILE;\n\nconst consumersIn = Effect.fn(\"consumersIn\")(function* consumersIn(\n root: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n directories,\n Effect.filter((directory) =>\n readManifest(files.join(root, directory)).pipe(\n Effect.map(\n Option.exists(\n (manifest) => manifest.name !== MSCH && Arr.contains(declaredNames(manifest), MSCH),\n ),\n ),\n ),\n ),\n );\n});\n\nconst manifestUses = Effect.fn(\"manifestUses\")(function* manifestUses(\n root: string,\n appliedNames: readonly string[],\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, MANIFEST_FILE);\n const text = yield* files.readFile(file);\n const manifest = yield* readManifest(files.join(root, directory));\n return pipe(\n Option.all({ source: text, declared: manifest }),\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: ({ source, declared }) =>\n pipe(\n declaredNames(declared),\n Arr.filter((name) => Arr.contains(appliedNames, name)),\n Arr.flatMap((name) =>\n pipe(\n Str.indexOf(`\"${name}\"`)(source),\n Option.map((index) => problemAt(file, source)(index, name)),\n Option.toArray,\n ),\n ),\n ),\n }),\n );\n});\n\ninterface Scope {\n readonly root: string;\n readonly applied: readonly AppliedPackage[];\n readonly directories: readonly string[];\n readonly consumers: readonly string[];\n}\n\nconst sourceUses = Effect.fn(\"sourceUses\")(function* sourceUses({\n root,\n applied,\n directories,\n consumers,\n}: Scope) {\n const owner = ownerOf(directories);\n const listed = yield* listedFiles(root);\n const sources = pipe(\n listed,\n Arr.filter((entry) => isScannedSource(entry) && Arr.contains(consumers, owner(entry.name))),\n );\n return yield* scanText(sources, usesIn(applied));\n});\n\n/** @internal */\nexport const appliedPackageProblems = Effect.fn(\"appliedPackageProblems\")(\n function* appliedPackageProblems(root: string, applied: readonly AppliedPackage[]) {\n if (!Arr.isReadonlyArrayNonEmpty(applied)) {\n return [];\n }\n const workspaces = yield* workspaceDirectories(root);\n const directories = [\"\", ...workspaces];\n const consumers = yield* consumersIn(root, directories);\n const appliedNames = pipe(\n applied,\n Arr.map(({ name }) => name),\n );\n const manifestProblems = yield* Effect.forEach(\n consumers,\n (directory) => manifestUses(root, appliedNames, directory),\n {\n concurrency: 1,\n },\n );\n const sourceProblems = yield* sourceUses({ root, applied, directories, consumers });\n return [...Arr.flatten(manifestProblems), ...sourceProblems];\n },\n);\n\n/** @internal */\nexport const checkAppliedPackages = Effect.fn(\"checkAppliedPackages\")(\n function* checkAppliedPackages(root: string) {\n const applied = yield* appliedByMsch();\n return yield* appliedPackageProblems(root, applied);\n },\n);\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, presentFiles } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nconst RULE: RuleName = \"replaced-tool\";\nconst FIRST = 1;\nconst TASKS = \"Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`\";\nconst HOOKS = \"the hooks in .vite-hooks/ that `vp config` installs\";\nconst ALCHEMY = \"the Alchemy stack in alchemy.run.ts\";\n\ninterface ReplacedTool {\n readonly pattern: RegExp;\n readonly tool: string;\n readonly replacement: string;\n}\n\nconst REPLACED: readonly ReplacedTool[] = [\n { pattern: /(?:^|\\/)turbo\\.jsonc?$/u, tool: \"Turborepo\", replacement: TASKS },\n { pattern: /(?:^|\\/)nx\\.json$/u, tool: \"Nx\", replacement: TASKS },\n { pattern: /(?:^|\\/)\\.husky\\//u, tool: \"husky\", replacement: HOOKS },\n {\n pattern: /(?:^|\\/)(?:\\.?lefthook(?:-local)?\\.(?:ya?ml|toml|json)|\\.lefthook\\/)/u,\n tool: \"lefthook\",\n replacement: HOOKS,\n },\n {\n pattern: /(?:^|\\/)\\.?knip\\.(?:jsonc?|[cm]?[jt]s)$/u,\n tool: \"knip\",\n replacement: \"fallow\",\n },\n { pattern: /(?:^|\\/)\\.jscpd\\.json$/u, tool: \"jscpd\", replacement: \"fallow\" },\n {\n pattern: /(?:^|\\/)(?:\\.eslintrc(?:\\.\\w+)?|\\.eslintignore|eslint\\.config\\.[cm]?[jt]s)$/u,\n tool: \"ESLint\",\n replacement: \"`lint` in vite.config.ts, run with `vp check`\",\n },\n {\n pattern: /(?:^|\\/)(?:\\.prettierrc(?:\\.\\w+)?|\\.prettierignore|prettier\\.config\\.[cm]?[jt]s)$/u,\n tool: \"Prettier\",\n replacement: \"`fmt` in vite.config.ts, run with `vp check`\",\n },\n {\n pattern: /(?:^|\\/)jest\\.config\\.(?:json|[cm]?[jt]s)$/u,\n tool: \"Jest\",\n replacement: \"`test` in vite.config.ts, run with `vp test`\",\n },\n { pattern: /(?:^|\\/)wrangler\\.(?:toml|jsonc?)$/u, tool: \"wrangler\", replacement: ALCHEMY },\n { pattern: /(?:^|\\/)Pulumi(?:\\.[\\w-]+)?\\.ya?ml$/u, tool: \"Pulumi\", replacement: ALCHEMY },\n { pattern: /\\.tf(?:vars)?$/u, tool: \"Terraform\", replacement: ALCHEMY },\n {\n pattern: /(?:^|\\/)skills-lock\\.json$/u,\n tool: \"the skills CLI\",\n replacement: \"the `skills` section of vite.config.ts, installed by `msch --prepare`\",\n },\n {\n pattern: /(?:^|\\/)\\.claude\\/rules\\//u,\n tool: \".claude/rules\",\n replacement: \"the root AGENTS.md and the skills in masseater/skills\",\n },\n];\n\nconst problemFor = ({ name, file }: Listed): Option.Option<Problem> =>\n pipe(\n REPLACED,\n Arr.findFirst(({ pattern }) => pattern.test(name)),\n Option.map(({ tool, replacement }) => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`,\n })),\n );\n\n/** @internal */\nexport const checkReplacedTools = Effect.fn(\"checkReplacedTools\")(function* checkReplacedTools(\n root: string,\n) {\n const listed = yield* listedFiles(root);\n const present = yield* presentFiles(\n pipe(\n listed,\n Arr.filter((entry) => Option.isSome(problemFor(entry))),\n ),\n );\n return pipe(\n present,\n Arr.flatMap((entry) => Option.toArray(problemFor(entry))),\n );\n});\n","import { join, parent } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nconst FOREIGN_LOCKFILE =\n /(?:^|\\/)(?:package-lock\\.json|npm-shrinkwrap\\.json|yarn\\.lock|bun\\.lockb?)$/u;\nconst PLUGIN_LOCKFILE = /(?:^|\\/)bun\\.lock$/u;\nconst PLUGIN_MANIFEST = \".claude-plugin/plugin.json\";\n\nconst installedByClaudeCode =\n (present: readonly Listed[]) =>\n ({ name }: Listed): boolean =>\n PLUGIN_LOCKFILE.test(name) &&\n pipe(\n present,\n Arr.some((entry) => entry.name === join(parent(name))(PLUGIN_MANIFEST)),\n );\n\nexport const unneededLockfile =\n (present: readonly Listed[]) =>\n (entry: Listed): boolean =>\n FOREIGN_LOCKFILE.test(entry.name) && !installedByClaudeCode(present)(entry);\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { unneededLockfile } from \"./lockfiles.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst PNPM_DIRECTORY = \".pnpm/\";\nconst SEPARATOR = \"/\";\n\nconst CARGO_MANIFEST_FILE = /(?:^|\\/)Cargo\\.toml$/u;\nconst CARGO_LOCK_FILE = /(?:^|\\/)Cargo\\.lock$/u;\nconst PNPM_OUTPUT = /(?:^|\\/)\\.pnpm\\//u;\nconst CARGO_WORKSPACE = /^\\[workspace\\]/mu;\nconst LEGACY_CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config$/u;\nconst CARGO_CONFIG_FILE = /(?:^|\\/)\\.cargo\\/config\\.toml$/u;\nconst PNPM_CARGO_START = /# >>> pnpm-managed cargo sources >>>/u;\nconst PNPM_CARGO_BLOCK =\n /# >>> pnpm-managed cargo sources >>>[\\s\\S]*?# <<< pnpm-managed cargo sources <<<\\n?/gu;\n\nconst SETUP_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])rustup[ \\t]+(?:toolchain[ \\t]+install|install|update|default|override[ \\t]+set|target[ \\t]+add|component[ \\t]+add)\\b/gu,\n /(?<![\\w./@-])cargo[ \\t]+(?:vendor|fetch)\\b/gu,\n /\\buses:\\s*[\"']?(?:dtolnay\\/rust-toolchain|actions-rust-lang\\/setup-rust-toolchain|actions-rs\\/toolchain|moonrepo\\/setup-rust)\\b/gu,\n];\n\nconst INSTALL_PATTERNS: readonly RegExp[] = [/(?<![\\w./@-])cargo[ \\t]+b?install\\b/gu];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:rust|rustup)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst START = 0;\nconst LAST_SEGMENT = 1;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"unneeded-file\";\nconst SETUP_RULE: RuleName = \"unneeded-setup\";\nconst CARGO_RULE: RuleName = \"cargo-outside-pnpm\";\n\nconst CargoSettings = Schema.Struct({ enabled: Schema.optionalKey(Schema.Boolean) });\nconst WorkspaceFile = Schema.Struct({ cargo: Schema.optionalKey(CargoSettings) });\nconst decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);\n\nconst cargoEnabled = (manifest: unknown): boolean =>\n pipe(\n decodeWorkspaceFile(manifest),\n Option.flatMap(({ cargo }) => Option.fromUndefinedOr(cargo)),\n Option.flatMap(({ enabled }) => Option.fromUndefinedOr(enabled)),\n Option.getOrElse(() => false),\n );\n\nconst problemAtStart =\n (rule: RuleName, message: string) =>\n ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule,\n message,\n });\n\nconst foreignLockfile = problemAtStart(\n FILE_RULE,\n \"pnpm-lock.yaml is this repository's lockfile, and pnpm never reads this one. Delete it.\",\n);\n\nconst nestedCargoLock = problemAtStart(\n FILE_RULE,\n \"Cargo reads only the Cargo.lock beside the workspace's Cargo.toml, and pnpm install writes that one. Delete this one.\",\n);\n\nconst legacyCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .cargo/config.toml, and Cargo warns when .cargo/config sits beside it. Move its settings into .cargo/config.toml and delete it.\",\n);\n\nconst pnpmOutput = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .pnpm/ from Cargo.lock and rust-toolchain.toml. Add this .pnpm directory to .gitignore and keep it out of the repository.\",\n);\n\nconst pnpmCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes this .cargo/config.toml, and it holds nothing else. Add /.cargo/config.toml to .gitignore and keep it out of the repository.\",\n);\n\nconst generatedCargoConfig = (entry: Listed, source: string): readonly Problem[] => {\n if (!CARGO_CONFIG_FILE.test(entry.name) || !PNPM_CARGO_START.test(source)) {\n return [];\n }\n if (Str.isNonEmpty(Str.trim(Str.replaceAll(PNPM_CARGO_BLOCK, \"\")(source)))) {\n return [];\n }\n return [pnpmCargoConfig(entry)];\n};\n\nconst cargoOutsidePnpm = problemAtStart(\n CARGO_RULE,\n `pnpm does not manage these crates. Set \\`cargo: { enabled: true }\\` in ${WORKSPACE_FILE} so pnpm install fetches the crates and the Rust toolchain.`,\n);\n\nconst setupProblem =\n ({ file }: Listed, source: string, advice: (command: string) => string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: SETUP_RULE,\n message: advice(Str.trim(found[WHOLE_MATCH])),\n });\n\nconst removeSetup = (command: string): string =>\n `pnpm install already installs the toolchain in rust-toolchain.toml and vendors the crates in Cargo.lock. Remove \\`${command}\\`.`;\n\nconst buildInstead = (command: string): string =>\n `\\`${command}\\` fetches crates that pnpm does not vendor. Add the tool as a dependency of a Cargo workspace that pnpm vendors, and build its binary there with \\`cargo build -p <crate> --bin <name>\\`.`;\n\nconst setupPatternsFor = (entry: Listed): readonly RegExp[] => {\n if (isToolVersions(entry)) {\n return [...SETUP_PATTERNS, ...TOOL_PATTERNS];\n }\n return SETUP_PATTERNS;\n};\n\nconst matchesOf =\n (source: string) =>\n (patterns: readonly RegExp[]): readonly RegExpMatchArray[] =>\n pipe(\n patterns,\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n );\n\nconst setupProblems = (entry: Listed, source: string): readonly Problem[] => {\n const found = matchesOf(source);\n const installs = pipe(\n found(INSTALL_PATTERNS),\n Arr.map(setupProblem(entry, source, buildInstead)),\n );\n return pipe(\n found(setupPatternsFor(entry)),\n Arr.map(setupProblem(entry, source, removeSetup)),\n Arr.appendAll(installs),\n Arr.appendAll(generatedCargoConfig(entry, source)),\n );\n};\n\nconst matches =\n (pattern: RegExp) =>\n ({ name }: Listed): boolean =>\n pattern.test(name);\n\nconst isCargoManifest = matches(CARGO_MANIFEST_FILE);\nconst isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);\nconst isPnpmOutput = matches(PNPM_OUTPUT);\n\nconst directoryOf = (name: string): string =>\n pipe(Str.split(name, SEPARATOR), Arr.dropRight(LAST_SEGMENT), Arr.join(SEPARATOR));\n\nconst ancestorsOf = (directory: string): readonly string[] => {\n const parts = Str.split(directory, SEPARATOR);\n return pipe(\n Arr.makeBy(parts.length, (depth) => Arr.join(Arr.take(parts, depth), SEPARATOR)),\n Arr.filter((ancestor) => ancestor !== directory),\n );\n};\n\nconst readsCargoLock =\n (manifests: readonly string[], workspaces: readonly string[]) =>\n ({ name }: Listed): boolean => {\n const directory = directoryOf(name);\n const insideWorkspace = pipe(\n ancestorsOf(directory),\n Arr.some((ancestor) => Arr.contains(workspaces, ancestor)),\n );\n return (\n Arr.contains(manifests, directory) &&\n (Arr.contains(workspaces, directory) || !insideWorkspace)\n );\n };\n\nconst isWorkspaceManifest = (source: Option.Option<string>): boolean =>\n Option.exists(source, (text) => CARGO_WORKSPACE.test(text));\n\nconst directoriesOf = (entries: readonly Listed[]): readonly string[] =>\n pipe(\n entries,\n Arr.map(({ name }) => directoryOf(name)),\n );\n\nconst cargoWorkspaces = Effect.fn(\"cargoWorkspaces\")(function* cargoWorkspaces(\n manifests: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n const roots = yield* pipe(\n manifests,\n Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))),\n );\n return directoriesOf(roots);\n});\n\nconst pnpmDirectoryOf = ({ name }: Listed): string =>\n pipe(\n name,\n Str.indexOf(PNPM_DIRECTORY),\n Option.getOrElse(() => START),\n (end) => Str.slice(START, end)(name),\n );\n\nconst pnpmOutputs = (present: readonly Listed[]): readonly Problem[] =>\n pipe(\n present,\n Arr.filter(isPnpmOutput),\n Arr.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)),\n Arr.map(pnpmOutput),\n );\n\nconst byDepth: Order.Order<Listed> = Order.mapInput(\n Order.Number,\n ({ name }: Listed) => Str.split(name, \"/\").length,\n);\n\nconst cargoProblems = (\n present: readonly Listed[],\n enabled: boolean,\n): Effect.Effect<readonly Problem[], never, RepositoryFiles> => {\n if (!enabled) {\n return Effect.succeed(\n pipe(\n present,\n Arr.filter(isCargoManifest),\n Arr.match({\n onEmpty: (): readonly Problem[] => [],\n onNonEmpty: (manifests) => [cargoOutsidePnpm(Arr.min(manifests, byDepth))],\n }),\n ),\n );\n }\n return Effect.gen(function* enabledCargoProblems() {\n const manifests = pipe(present, Arr.filter(isCargoManifest));\n const workspaces = yield* cargoWorkspaces(manifests);\n const reads = readsCargoLock(directoriesOf(manifests), workspaces);\n const setup = yield* scanText(pipe(present, Arr.filter(isScannedText)), setupProblems);\n return [\n ...pipe(\n present,\n Arr.filter((entry) => CARGO_LOCK_FILE.test(entry.name) && !reads(entry)),\n Arr.map(nestedCargoLock),\n ),\n ...pipe(present, Arr.filter(isLegacyCargoConfig), Arr.map(legacyCargoConfig)),\n ...pnpmOutputs(present),\n ...setup,\n ];\n });\n};\n\nconst unneededIn = Effect.fn(\"unneededIn\")(function* unneededIn(root: string, enabled: boolean) {\n const listed = yield* listedFiles(root);\n const present = yield* presentFiles(listed);\n const lockfiles = pipe(present, Arr.filter(unneededLockfile(present)), Arr.map(foreignLockfile));\n if (!pipe(present, Arr.some(isCargoManifest))) {\n return lockfiles;\n }\n const cargo = yield* cargoProblems(present, enabled);\n return [...lockfiles, ...cargo];\n});\n\n/** @internal */\nexport const checkUnneededFiles = Effect.fn(\"checkUnneededFiles\")(function* checkUnneededFiles(\n root: string,\n) {\n const workspace = yield* workspaceManifest(root);\n if (Option.isNone(workspace)) {\n return [];\n }\n return yield* unneededIn(root, cargoEnabled(workspace.value));\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"effect-diagnostics-once\";\nconst PLUGIN = \"@effect/language-service\";\nconst CONFIG_PATHSPEC = \":(glob)**/tsconfig*.json\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst START = 0;\n\nconst Plugin = Schema.Struct({\n name: Schema.optional(Schema.String),\n diagnostics: Schema.optional(Schema.Unknown),\n});\nconst Plugins = Schema.Array(Plugin);\nconst CompilerOptions = Schema.Struct({ plugins: Schema.optional(Plugins) });\nconst Config = Schema.Struct({ compilerOptions: Schema.optional(CompilerOptions) });\nconst decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config));\n\nconst MESSAGE = `The \\`${PLUGIN}\\` plugin reports the Effect diagnostics during the type check, and the \\`effecttsgo\\` lint rules that msch enables report the same ones again. Set \\`\"diagnostics\": false\\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;\n\nconst reportsDiagnostics = (plugin: typeof Plugin.Type): boolean =>\n plugin.name === PLUGIN && plugin.diagnostics !== false;\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n decodeConfig(source),\n Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)),\n Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)),\n Option.filter(Arr.some(reportsDiagnostics)),\n Option.map((): Problem => ({\n file: entry.file,\n ...positionOf(source)(\n pipe(\n Str.indexOf(`\"${PLUGIN}\"`)(source),\n Option.getOrElse(() => START),\n ),\n ),\n rule: RULE,\n message: MESSAGE,\n })),\n Option.toArray,\n );\n\n/** @internal */\nexport const checkEffectDiagnostics = Effect.fn(\"checkEffectDiagnostics\")(\n function* checkEffectDiagnostics(root: string) {\n const files = yield* RepositoryFiles;\n const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED]);\n return yield* scanText(\n pipe(\n configs,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n problemsIn,\n );\n },\n);\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport {\n MANIFEST_FILE,\n manifestSpecifiers,\n fieldsOf,\n manifestPattern,\n offsetIn,\n quoted,\n specifiedIn,\n} from \"#/entities/package/index.ts\";\nimport type { Fields, Specified } from \"#/entities/package/index.ts\";\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"version-range\";\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst ALIAS = /^npm:(?:@[^/@]+\\/)?[^@]+@(?<version>.+)$/u;\nconst PROTOCOL = /^[a-z+]+:/u;\nconst PATH_LIKE = \"/\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst MESSAGE =\n \"is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.\";\n\nconst versionOf = (specifier: string): string =>\n Option.getOrElse(groupOf(\"version\")(ALIAS.exec(specifier)), () => specifier);\n\n/** @internal */\nexport const isRange = (specifier: string): boolean => {\n const version = versionOf(specifier);\n return (\n !PROTOCOL.test(version) && !Str.includes(PATH_LIKE)(version) && semver.valid(version) === null\n );\n};\n\nconst problemsFor =\n (file: string, source: string, pattern: (found: Specified) => RegExp) =>\n (found: readonly Specified[]): readonly Problem[] =>\n pipe(\n found,\n Arr.filter(({ specifier }) => isRange(specifier)),\n Arr.map((range): Problem => ({\n file,\n ...positionOf(source)(offsetIn(source)(pattern(range))),\n rule: RULE,\n message: `\\`${range.name}\\` \\`${range.specifier}\\` ${MESSAGE}`,\n })),\n );\n\nconst catalogPattern = ({ name }: Specified): RegExp =>\n new RegExp(`^\\\\s+[\"']?${quoted(name)}[\"']?:`, \"mu\");\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] =>\n problemsFor(entry.file, source, manifestPattern)(manifestSpecifiers(source));\n\nconst catalogSpecifiers = (settings: Fields): readonly Specified[] => [\n ...specifiedIn(settings[\"catalog\"]),\n ...pipe(fieldsOf(settings[\"catalogs\"]), Rec.values, Arr.flatMap(specifiedIn)),\n];\n\nconst catalogProblems = Effect.fn(\"catalogProblems\")(function* catalogProblems(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, WORKSPACE_FILE);\n const settings = yield* workspaceManifest(root);\n const source = yield* files.readFile(file);\n return pipe(\n Option.all({ settings, source }),\n Option.map(({ settings: held, source: text }) =>\n problemsFor(file, text, catalogPattern)(catalogSpecifiers(fieldsOf(held))),\n ),\n Option.getOrElse((): readonly Problem[] => []),\n );\n});\n\n/** @internal */\nexport const checkExactVersions = Effect.fn(\"checkExactVersions\")(function* checkExactVersions(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n const listed = pipe(\n manifests,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n const fromManifests = yield* scanText(listed, manifestProblems);\n const fromCatalogs = yield* catalogProblems(root);\n return [...fromManifests, ...fromCatalogs];\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { MANIFEST_FILE, publishedManifestOf } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"pack-publint\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst PACK_KEY = \"pack:\";\nconst START = 0;\nconst READ_CONCURRENCY = 16;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });\nconst isStrict = Schema.is(StrictPack);\nconst PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });\nconst decodePackConfig = Schema.decodeUnknownOption(PackConfig);\n\nconst taggedError = Schema.TaggedError;\n\nclass PackConfigUnreadable extends taggedError<\n PackConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"PackConfigUnreadable\", { file: Schema.String }) {}\n\nconst runsStrictPublint = (config: unknown): boolean =>\n pipe(\n decodePackConfig(config),\n Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)),\n Option.map((pack): readonly unknown[] => Arr.ensure(pack)),\n Option.exists(Arr.some(isStrict)),\n );\n\nconst problemFor = (file: string, source: string): Problem => ({\n file,\n ...positionOf(source)(Option.getOrElse(Str.indexOf(PACK_KEY)(source), () => START)),\n rule: RULE,\n message:\n \"This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import.\",\n});\n\nconst strictPublintIn = Effect.fn(\"strictPublintIn\")(function* strictPublintIn(configFile: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(configFile),\n catch: () => PackConfigUnreadable.make({ file: configFile }),\n }).pipe(Effect.option);\n return Option.exists(config, runsStrictPublint);\n});\n\nconst configProblems = Effect.fn(\"configProblems\")(function* configProblems(configFile: string) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(configFile);\n if (Option.isNone(source)) {\n return [];\n }\n const strict = yield* strictPublintIn(configFile);\n if (strict) {\n return [];\n }\n return [problemFor(configFile, source.value)];\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n manifestName: string,\n) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(files.join(root, manifestName));\n const manifest = publishedManifestOf(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));\n});\n\n/** @internal */\nexport const checkPackSettings = Effect.fn(\"checkPackSettings\")(function* checkPackSettings(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n const found = yield* Effect.forEach(manifests, (name) => problemsIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { workspaceProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"plugin-marketplace\";\nconst PLUGIN_DIRECTORY = \".claude-plugin\";\nconst PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;\nconst MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;\nconst INDENT = 2;\n\nconst OwnerSchema = Schema.Struct({ name: Schema.String, url: Schema.optionalKey(Schema.String) });\nconst Person = Schema.Union([Schema.String, OwnerSchema]);\nconst RootManifest = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n description: Schema.optionalKey(Schema.String),\n author: Schema.optionalKey(Person),\n }),\n);\nconst PluginManifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));\nconst NpmSource = Schema.Struct({ source: Schema.Literal(\"npm\"), package: Schema.String });\nconst PluginSchema = Schema.Struct({\n name: Schema.String,\n source: Schema.Union([Schema.String, NpmSource]),\n description: Schema.String,\n});\nconst MetadataSchema = Schema.Struct({ description: Schema.String });\nconst Marketplace = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n owner: OwnerSchema,\n metadata: Schema.optionalKey(MetadataSchema),\n plugins: Schema.Array(PluginSchema),\n }),\n { space: INDENT },\n);\n\nconst decodeRoot = Schema.decodeUnknownOption(RootManifest);\nconst decodePlugin = Schema.decodeUnknownOption(PluginManifest);\nconst encodeMarketplace = Schema.encodeEffect(Marketplace);\n\ntype Plugin = typeof PluginSchema.Type;\ntype Owner = typeof OwnerSchema.Type;\n\nconst marketplaceName = (packageName: string): string =>\n pipe(\n Str.toLowerCase(packageName),\n Str.replace(/^@/u, \"\"),\n Str.replaceAll(/[^a-z0-9]+/gu, \"-\"),\n Str.replaceAll(/^-+|-+$/gu, \"\"),\n );\n\nconst ownerOf = (author: typeof Person.Type): Owner => {\n if (Predicate.isString(author)) {\n return { name: author };\n }\n return author;\n};\n\nconst sourceOf = (project: WorkspaceProject): Plugin[\"source\"] =>\n pipe(\n project.packageName,\n Option.filter(() => project.published),\n Option.match({\n onNone: (): Plugin[\"source\"] => `./${project.directory}`,\n onSome: (name): Plugin[\"source\"] => ({ source: \"npm\", package: name }),\n }),\n );\n\nconst pluginIn = Effect.fn(\"pluginIn\")(function* pluginIn(root: string, project: WorkspaceProject) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, project.directory, PLUGIN_FILE));\n return pipe(\n text,\n Option.flatMap(decodePlugin),\n Option.map(({ name }): Plugin => ({\n name,\n source: sourceOf(project),\n description: Option.getOrElse(project.description, () => \"\"),\n })),\n );\n});\n\nconst problem = problemInFile(RULE);\n\nconst pluginsIn = Effect.fn(\"pluginsIn\")(function* pluginsIn(root: string) {\n const projects = yield* workspaceProjects(root);\n const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), {\n concurrency: \"unbounded\",\n });\n return Arr.getSomes(found);\n});\n\nconst described = (\n description: string | undefined,\n): { readonly metadata?: { readonly description: string } } =>\n pipe(\n Option.fromUndefinedOr(description),\n Option.match({\n onNone: () => ({}),\n onSome: (text) => ({ metadata: { description: text } }),\n }),\n );\n\nconst ownerIn = Effect.fn(\"ownerIn\")(function* ownerIn(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeRoot),\n Option.flatMap(({ name, description, author }) =>\n pipe(\n Option.fromUndefinedOr(author),\n Option.map((found) => ({\n name: marketplaceName(name),\n owner: ownerOf(found),\n ...described(description),\n })),\n ),\n ),\n );\n});\n\nconst rewrite = Effect.fn(\"rewrite\")(function* rewrite(file: string, expected: string) {\n const files = yield* RepositoryFiles;\n const written = yield* files.readFile(file);\n if (Option.exists(written, (text) => text === expected)) {\n return [];\n }\n yield* files.writeFile(file, expected);\n return [\n problem(\n file,\n `${MARKETPLACE_FILE} is generated from the workspaces that have ${PLUGIN_FILE}. msch rewrote it; commit the result.`,\n ),\n ];\n});\n\nconst withoutPlugins = Effect.fn(\"withoutPlugins\")(function* withoutPlugins(file: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.exists(file);\n if (!present) {\n return [];\n }\n return [problem(file, `No workspace has ${PLUGIN_FILE}. Delete ${MARKETPLACE_FILE}.`)];\n});\n\n/** @internal */\nexport const checkPluginMarketplace = Effect.fn(\"checkPluginMarketplace\")(\n function* checkPluginMarketplace(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, MARKETPLACE_FILE);\n const plugins = yield* pluginsIn(root);\n if (!Arr.isReadonlyArrayNonEmpty(plugins)) {\n return yield* withoutPlugins(file);\n }\n const header = yield* ownerIn(root);\n if (Option.isNone(header)) {\n return [\n problem(\n files.join(root, MANIFEST_FILE),\n `Workspaces ship Claude Code plugins, so ${MARKETPLACE_FILE} lists them. Add \"author\" to the root ${MANIFEST_FILE}; it becomes the marketplace owner.`,\n ),\n ];\n }\n const text = yield* encodeMarketplace({ ...header.value, plugins });\n return yield* rewrite(file, `${text}\\n`);\n },\n);\n","import { Array as Arr, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { PublishedFile, PublishedManifest } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"package-homepage\";\nconst BRANCH = \"main\";\nconst ROOT_DIRECTORY = \".\";\nconst START = 0;\nconst KEYS = ['\"homepage\"', '\"repository\"', '\"name\"'] as const;\n\nconst RepositoryObject = Schema.Struct({\n url: Schema.String,\n directory: Schema.optional(Schema.String),\n});\nconst decodeRepository = Schema.decodeUnknownOption(RepositoryObject);\n\nconst repositoryMissing = (directory: string): string =>\n `Published packages declare \\`repository\\` as \\`{ \"type\": \"git\", \"url\": \"git+https://github.com/<owner>/<repository>.git\", \"directory\": \"${directory}\" }\\` so that npm and \\`npm repo\\` link to the source.`;\n\nconst directoryWrong = (directory: string): string =>\n `In a monorepo \\`repository.directory\\` names the package directory, so npm links to the package and not to the repository root. Set it to \"${directory}\".`;\n\nconst homepageWrong = (homepage: string): string =>\n `\\`homepage\\` is the link npm shows as the package's home, and the repository root is not the package. Set it to \"${homepage}\".`;\n\nconst repositoryUrlOf = (url: string): string =>\n pipe(url, Str.replace(/^git\\+/u, \"\"), Str.replace(/\\.git$/u, \"\"));\n\nconst homepageOf = (url: string, directory: string): string =>\n `${repositoryUrlOf(url)}/tree/${BRANCH}/${directory}#readme`;\n\nconst repositoryMessages =\n (manifest: PublishedManifest, directory: string) =>\n (repository: typeof RepositoryObject.Type): readonly string[] => {\n const expected = homepageOf(repository.url, directory);\n const wrongDirectory = directoryWrong(directory);\n const wrongHomepage = homepageWrong(expected);\n return Arr.getSomes([\n Option.liftPredicate(wrongDirectory, () => repository.directory !== directory),\n Option.liftPredicate(wrongHomepage, () => manifest.homepage !== expected),\n ]);\n };\n\nconst messagesOf = (manifest: PublishedManifest, directory: string): readonly string[] =>\n pipe(\n decodeRepository(manifest.repository),\n Option.match({\n onNone: () => [repositoryMissing(directory)],\n onSome: repositoryMessages(manifest, directory),\n }),\n );\n\nconst firstKeyIndex = (source: string): number =>\n pipe(\n KEYS,\n Arr.findFirst((key) => Str.includes(key)(source)),\n Option.flatMap((key) => Str.indexOf(key)(source)),\n Option.getOrElse(() => START),\n );\n\n/** @internal */\nexport const homepageProblems =\n (dirname: (name: string) => string) =>\n ({ entry, source, manifest }: PublishedFile): readonly Problem[] =>\n pipe(\n Option.some(dirname(entry.name)),\n Option.filter((directory) => directory !== ROOT_DIRECTORY),\n Option.map((directory) => messagesOf(manifest, directory)),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((message) =>\n problemAtIndex(RULE)(entry.file, source)(firstKeyIndex(source), message),\n ),\n );\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport type { PublishedFile } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"package-scope\";\nconst SCOPE = \"@r_masseater/\";\nconst NAME_KEY = '\"name\"';\nconst START = 0;\n\nconst unscopedName = ({ manifest }: PublishedFile): Option.Option<string> =>\n pipe(\n Option.fromUndefinedOr(manifest.name),\n Option.filter((name) => !Str.startsWith(SCOPE)(name)),\n );\n\nconst nameIndex = (source: string): number =>\n pipe(\n Str.indexOf(NAME_KEY)(source),\n Option.getOrElse(() => START),\n );\n\nconst messageFor = (name: string): string =>\n `Packages are published only under the ${SCOPE} scope. Rename \"${name}\" to \"${SCOPE}${Str.replace(/^@[^/]+\\//u, \"\")(name)}\".`;\n\n/** @internal */\nexport const scopeProblems = (found: PublishedFile): readonly Problem[] =>\n pipe(\n unscopedName(found),\n Option.map((name) =>\n problemAtIndex(RULE)(found.entry.file, found.source)(\n nameIndex(found.source),\n messageFor(name),\n ),\n ),\n Option.toArray,\n );\n","import { Effect } from \"effect\";\n\nimport { scanPublishedManifests } from \"#/entities/package/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { homepageProblems } from \"./package-homepage.ts\";\nimport { scopeProblems } from \"./package-scope.ts\";\n\n/** @internal */\nexport const checkPublishedManifests = Effect.fn(\"checkPublishedManifests\")(\n function* checkPublishedManifests(root: string) {\n const files = yield* RepositoryFiles;\n const homepage = homepageProblems(files.dirname);\n return yield* scanPublishedManifests(root, (found) => [\n ...scopeProblems(found),\n ...homepage(found),\n ]);\n },\n);\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { isToolVersions, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"node-version\";\nconst MINIMUM = 26;\nconst SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;\nconst MANIFEST = /(?:^|\\/)package\\.json$/u;\nconst VERSION_FILE = /(?:^|\\/)(?:\\.node-version|\\.nvmrc)$/u;\nconst DOCKERFILE = /(?:^|\\/)(?:Dockerfile|Containerfile)[^/]*$/u;\nconst STEP_FILE = /^\\.github\\/.*\\.ya?ml$|(?:^|\\/)action\\.ya?ml$/u;\nconst PINNED_VERSION = /^\\s*v?(?<major>\\d+)/u;\nconst BASE_IMAGE = /^FROM[ \\t]+(?:--\\S+[ \\t]+)*(?:[\\w.-]+(?::\\d+)?\\/)*node:(?<major>\\d+)/gimu;\nconst SETUP_INPUT = /\\bnode-version:[ \\t]*[\"']?v?(?<major>\\d+)/gu;\nconst TOOL_VERSION =\n /^[ \\t]*[\"']?(?:node|nodejs)[\"']?[ \\t]*(?:=[ \\t]*[\"']?|[ \\t]+)v?(?<major>\\d+)/gmu;\nconst RANGE_FLOOR = /^(?:>=|\\^|~|=)?[ \\t]*v?(?<major>\\d+)/u;\nconst ALTERNATIVE = \"||\";\nconst ENGINES_KEY = '\"engines\"';\nconst START = 0;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst Engines = Schema.Struct({ node: Schema.optional(Schema.String) });\nconst Manifest = Schema.Struct({\n private: Schema.optional(Schema.Boolean),\n publishConfig: Schema.optional(Schema.Unknown),\n engines: Schema.optional(Engines),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\nconst majorOf = (found: RegExpMatchArray | null): Option.Option<number> =>\n pipe(groupOf(\"major\")(found), Option.map(Number));\n\nconst isOld = (major: number): boolean => major < MINIMUM;\n\nconst floorOf = (alternative: string): Option.Option<number> =>\n majorOf(RANGE_FLOOR.exec(Str.trim(alternative)));\n\nconst floorIsOld = (alternative: string): boolean =>\n pipe(floorOf(alternative), Option.match({ onNone: () => true, onSome: isOld }));\n\nconst admitsOld = (range: string): boolean =>\n pipe(Str.split(range, ALTERNATIVE), Arr.some(floorIsOld));\n\ninterface Found {\n readonly entry: Listed;\n readonly source: string;\n readonly index: number;\n}\n\nconst problemAt = ({ entry, source, index }: Found, message: string): Problem =>\n problemAtIndex(RULE)(entry.file, source)(index, message);\n\nconst offsetOf = (source: string, text: string): number =>\n pipe(\n Str.indexOf(text)(source),\n Option.getOrElse(() => START),\n );\n\nconst unstatedProblem = (entry: Listed, source: string): Problem =>\n problemAt(\n { entry, source, index: START },\n `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to \">=${String(MINIMUM)}\".`,\n );\n\nconst rangeProblem =\n (entry: Listed, source: string) =>\n (range: string): Problem =>\n problemAt(\n { entry, source, index: offsetOf(source, ENGINES_KEY) },\n `${SUPPORTED} engines.node is \"${range}\", which admits an older one. Set it to \">=${String(MINIMUM)}\".`,\n );\n\nconst isPublished = (manifest: typeof Manifest.Type): boolean =>\n manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);\n\nconst rangeOf = (manifest: typeof Manifest.Type): Option.Option<string> =>\n pipe(\n Option.fromUndefinedOr(manifest.engines),\n Option.flatMap(({ node }) => Option.fromUndefinedOr(node)),\n );\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] => {\n const manifest = decodeManifest(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n const range = rangeOf(manifest.value);\n if (Option.isNone(range) && isPublished(manifest.value)) {\n return [unstatedProblem(entry, source)];\n }\n return pipe(\n range,\n Option.filter(admitsOld),\n Option.map(rangeProblem(entry, source)),\n Option.toArray,\n );\n};\n\nconst pinnedProblems =\n (pattern: RegExp) =>\n (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.filter((found) => Option.exists(majorOf(found), isOld)),\n Arr.map((found) =>\n problemAt(\n { entry, source, index: found.index ?? START },\n `${SUPPORTED} \\`${Str.trim(found[START])}\\` pins an older one. Raise it to ${String(MINIMUM)} or later.`,\n ),\n ),\n );\n\nconst versionFileProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n majorOf(PINNED_VERSION.exec(source)),\n Option.filter(isOld),\n Option.map((major) =>\n problemAt(\n { entry, source, index: START },\n `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`,\n ),\n ),\n Option.toArray,\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] => {\n if (MANIFEST.test(entry.name)) {\n return manifestProblems(entry, source);\n }\n if (VERSION_FILE.test(entry.name)) {\n return versionFileProblems(entry, source);\n }\n if (DOCKERFILE.test(entry.name)) {\n return pinnedProblems(BASE_IMAGE)(entry, source);\n }\n if (isToolVersions(entry)) {\n return pinnedProblems(TOOL_VERSION)(entry, source);\n }\n return pinnedProblems(SETUP_INPUT)(entry, source);\n};\n\nconst isVersionSource = (entry: Listed): boolean =>\n VERSION_FILE.test(entry.name) ||\n DOCKERFILE.test(entry.name) ||\n STEP_FILE.test(entry.name) ||\n isToolVersions(entry);\n\n/** @internal */\nexport const checkNodeVersion = Effect.fn(\"checkNodeVersion\")(function* checkNodeVersion(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* listedFiles(root);\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n const sources = [\n ...pipe(listed, Arr.filter(isVersionSource)),\n ...pipe(\n manifests,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n ];\n return yield* scanText(sources, problemsIn);\n});\n","import { isInside } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n cratesIn,\n deployEntries,\n nestedValues,\n owningWorkspace,\n RUN_TASKS,\n stringsIn,\n workspaceConfigOf,\n workspaceDirectories,\n workspaceLinks,\n} from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceLink } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unused-workspace\";\nconst CARGO_FILE = \"Cargo.toml\";\nconst ROOT_DIRECTORY = \"\";\nconst TASK_SEPARATOR = \"#\";\nconst START = 0;\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\nconst LIBRARY_KINDS: readonly string[] = [\"lib\", \"rlib\", \"proc-macro\"];\nconst PROGRAM_KINDS: readonly string[] = [\"bin\", \"cdylib\", \"staticlib\", \"dylib\"];\n\nconst Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n private: Schema.optional(Schema.Boolean),\n exports: Schema.optional(Schema.Unknown),\n main: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface Member {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly library: boolean;\n readonly entry: boolean;\n}\n\nconst isDependedOn =\n (links: readonly WorkspaceLink[]) =>\n ({ directory }: Member): boolean =>\n pipe(\n links,\n Arr.some(({ from, to }) => to === directory && from !== directory),\n );\n\nconst isKind =\n (kinds: readonly string[]) =>\n (kind: string): boolean =>\n Arr.contains(kinds, kind);\n\nconst isLibraryCrate = ({ kinds }: { readonly kinds: readonly string[] }): boolean =>\n pipe(kinds, Arr.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Arr.some(isKind(PROGRAM_KINDS)));\n\ninterface CargoFacts {\n readonly libraries: readonly string[];\n readonly links: readonly WorkspaceLink[];\n}\n\nconst NO_CARGO: CargoFacts = { libraries: [], links: [] };\n\nconst cargoFacts = Effect.fn(\"cargoFacts\")(function* cargoFacts(\n root: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const cargo = yield* files.exists(files.join(root, CARGO_FILE));\n if (!cargo) {\n return NO_CARGO;\n }\n const crates = yield* cratesIn(root);\n const ownerOf = (path: string): Option.Option<string> =>\n owningWorkspace(directories)(files.relative(root, path));\n const linksOf = (manifest: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const owner = ownerOf(files.dirname(manifest));\n const linkTo = (path: string): Option.Option<WorkspaceLink> =>\n Option.zipWith(owner, ownerOf(path), (from, to) => ({ from, to }));\n return pipe(\n paths,\n Arr.flatMap((path) => Option.toArray(linkTo(path))),\n );\n };\n return {\n libraries: pipe(\n crates,\n Arr.filter(isLibraryCrate),\n Arr.flatMap(({ manifest }) => Option.toArray(ownerOf(files.dirname(manifest)))),\n ),\n links: pipe(\n crates,\n Arr.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)),\n ),\n };\n});\n\nconst workspaceOfTask = (text: string): Option.Option<string> =>\n pipe(\n Str.indexOf(TASK_SEPARATOR)(text),\n Option.map((at) => Str.slice(START, at)(text)),\n Option.filter(Str.isNonEmpty),\n );\n\nconst taskTargets = Effect.fn(\"taskTargets\")(function* taskTargets(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n return pipe(\n config,\n Option.map(({ program }) =>\n pipe(\n nestedValues(RUN_TASKS)(program),\n Arr.flatMap(stringsIn),\n Arr.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\ninterface MemberRequest {\n readonly root: string;\n readonly directory: string;\n readonly crateLibraries: readonly string[];\n readonly deployed: readonly string[];\n}\n\nconst memberOf = Effect.fn(\"memberOf\")(function* memberOf(request: MemberRequest) {\n const { root, directory, crateLibraries, deployed } = request;\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map((manifest): Member => ({\n directory,\n name: Option.fromUndefinedOr(manifest.name),\n library:\n Predicate.isNotUndefined(manifest.exports) ||\n Predicate.isNotUndefined(manifest.main) ||\n Arr.contains(crateLibraries, directory),\n entry:\n manifest.private !== true ||\n Predicate.isNotUndefined(manifest.bin) ||\n pipe(deployed, Arr.some(isInside(directory))),\n })),\n );\n});\n\nconst linksTo =\n (members: readonly Member[], from: string) =>\n (name: string): readonly WorkspaceLink[] =>\n pipe(\n members,\n Arr.filter((member) => Option.contains(member.name, name)),\n Arr.map(({ directory }): WorkspaceLink => ({ from, to: directory })),\n );\n\nconst taskLinks = Effect.fn(\"taskLinks\")(function* taskLinks(\n root: string,\n members: readonly Member[],\n) {\n const sources = [\n ROOT_DIRECTORY,\n ...pipe(\n members,\n Arr.map(({ directory }) => directory),\n ),\n ];\n const found = yield* Effect.forEach(\n sources,\n (from) => {\n const toLinks = Arr.flatMap(linksTo(members, from));\n return taskTargets(root, from).pipe(Effect.map(toLinks));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\n/** @internal */\nexport const checkUnusedWorkspaces = Effect.fn(\"checkUnusedWorkspaces\")(\n function* checkUnusedWorkspaces(root: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(root);\n const [cargo, deployed, lockedLinks] = yield* Effect.all(\n [cargoFacts(root, directories), deployEntries(root), workspaceLinks(root)],\n { concurrency: \"unbounded\" },\n );\n const found = yield* Effect.forEach(\n directories,\n (directory) => memberOf({ root, directory, crateLibraries: cargo.libraries, deployed }),\n { concurrency: READ_CONCURRENCY },\n );\n const members = Arr.getSomes(found);\n const tasks = yield* taskLinks(root, members);\n const links = [...lockedLinks, ...cargo.links, ...tasks];\n return pipe(\n members,\n Arr.filter(({ library, entry }) => library && !entry),\n Arr.filter((member) => !isDependedOn(links)(member)),\n Arr.map(({ directory }): Problem => ({\n file: files.join(root, directory, MANIFEST_FILE),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${directory} is a private library, and no other workspace depends on it through package.json, a Cargo path dependency or a task. Delete it, or depend on it from the code that uses it.`,\n })),\n );\n },\n);\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nimport { WORKSPACE_SECTIONS, cargoDeviations, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { Deviations } from \"./deviation-entries.ts\";\n\nconst RULE: RuleName = \"upstream-deviation-place\";\nconst MANIFEST = \"package.json\";\nconst NESTED_WORKSPACE = \"/pnpm-workspace.yaml\";\nconst NESTED_CARGO = \"/Cargo.toml\";\nconst CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config(?:\\.toml)?$/u;\nconst MANAGER_FIELDS = [\"overrides\", \"resolutions\"] as const;\nconst START = 0;\nconst PLACE =\n \"Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.\";\n\nconst Fields = Schema.Record(Schema.String, Schema.Unknown);\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({\n pnpm: Schema.optional(Fields),\n overrides: Schema.optional(Schema.Unknown),\n resolutions: Schema.optional(Schema.Unknown),\n }),\n);\nconst decodeManifest = Schema.decodeUnknownOption(Manifest);\n\ninterface Field {\n readonly name: string;\n readonly key: string;\n}\n\nconst isManifest = (name: string): boolean =>\n name === MANIFEST || Str.endsWith(`/${MANIFEST}`)(name);\n\nconst keyIndex = (source: string, key: string): number =>\n Option.getOrElse(Str.indexOf(`\"${key}\"`)(source), () => START);\n\nconst fieldsIn = (source: string): readonly Field[] =>\n pipe(\n decodeManifest(source),\n Option.match({\n onNone: (): readonly Field[] => [],\n onSome: (manifest) => {\n const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));\n const pnpmFields = pipe(\n WORKSPACE_SECTIONS,\n Arr.filter((key) => Rec.has(pnpm, key)),\n Arr.map((key) => ({ name: `pnpm.${key}`, key })),\n );\n const managerFields = pipe(\n MANAGER_FIELDS,\n Arr.filter((key) => Option.isSome(Option.fromUndefinedOr(manifest[key]))),\n Arr.map((key) => ({ name: key, key })),\n );\n return [...pnpmFields, ...managerFields];\n },\n }),\n );\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n fieldsIn(source),\n Arr.map(({ name, key }) =>\n problemAtIndex(RULE)(entry.file, source)(\n keyIndex(source, key),\n `${name} in package.json is not allowed. ${PLACE} Move it there.`,\n ),\n ),\n );\n\nconst firstEntryProblem = (\n entry: Listed,\n source: string,\n deviations: Deviations,\n): readonly Problem[] =>\n pipe(\n Arr.head(deviations.entries),\n Option.map(({ index }) =>\n problemAtIndex(RULE)(entry.file, source)(\n index,\n `This file is not read for upstream deviations. ${PLACE}`,\n ),\n ),\n Option.toArray,\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] => {\n if (isManifest(entry.name)) {\n return manifestProblems(entry, source);\n }\n if (Str.endsWith(NESTED_WORKSPACE)(entry.name)) {\n return firstEntryProblem(entry, source, workspaceDeviations(source));\n }\n return firstEntryProblem(entry, source, cargoDeviations(source));\n};\n\nconst isScanned = ({ name }: Listed): boolean =>\n isManifest(name) ||\n Str.endsWith(NESTED_WORKSPACE)(name) ||\n Str.endsWith(NESTED_CARGO)(name) ||\n CARGO_CONFIG.test(name);\n\n/** @internal */\nexport const checkScatteredDeviations = Effect.fn(\"checkScatteredDeviations\")(\n function* checkScatteredDeviations(root: string) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScanned)), problemsIn);\n },\n);\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { workspaceProjects } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"workspace-description\";\nconst FIRST = 1;\n\n/** @internal */\nexport const checkWorkspaceDescriptions = Effect.fn(\"checkWorkspaceDescriptions\")(\n function* checkWorkspaceDescriptions(root: string) {\n const files = yield* RepositoryFiles;\n const projects = yield* workspaceProjects(root);\n return pipe(\n projects,\n Arr.filter(({ description }) => Option.isNone(description)),\n Arr.map(({ directory }): Problem => ({\n file: files.join(root, directory, MANIFEST_FILE),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message:\n 'Add a one-line \"description\" that says what this workspace is for. Agents find existing tools by these descriptions, so a workspace without one is invisible to them.',\n })),\n );\n },\n);\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkEffectDiagnostics } from \"#/features/check-effect-diagnostics/index.ts\";\nimport { checkExactVersions } from \"#/features/check-exact-versions/index.ts\";\nimport { checkPackSettings } from \"#/features/check-pack-settings/index.ts\";\nimport { checkPluginMarketplace } from \"#/features/check-plugin-marketplace/index.ts\";\nimport { checkPublishedManifests } from \"#/features/check-published-manifest/index.ts\";\nimport { checkNodeVersion } from \"#/features/check-runtime-version/index.ts\";\nimport { checkUnusedWorkspaces } from \"#/features/check-unused-workspaces/index.ts\";\nimport {\n checkScatteredDeviations,\n checkUpstreamExits,\n} from \"#/features/check-upstream-exits/index.ts\";\nimport { checkWorkspaceDescriptions } from \"#/features/check-workspace-descriptions/index.ts\";\n\n/** @internal */\nexport const checkManifests = Effect.fn(\"checkManifests\")(function* checkManifests(root: string) {\n const found = yield* Effect.all(\n [\n checkNodeVersion(root),\n checkPublishedManifests(root),\n checkPackSettings(root),\n checkUnusedWorkspaces(root),\n checkExactVersions(root),\n checkUpstreamExits(root),\n checkScatteredDeviations(root),\n checkEffectDiagnostics(root),\n checkWorkspaceDescriptions(root),\n checkPluginMarketplace(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkComments } from \"#/features/ban-comments/index.ts\";\nimport { checkDocker, checkPython } from \"#/features/ban-tools/index.ts\";\nimport { checkCatalogEntries } from \"#/features/check-catalog-entries/index.ts\";\nimport { checkGitSubpath, checkPackageRegistry } from \"#/features/check-overrides/index.ts\";\nimport {\n checkPublishedSkills,\n checkSkillEntry,\n checkSkillFiles,\n} from \"#/features/check-skills/index.ts\";\nimport {\n checkDowngrades,\n checkPackageVersions,\n checkRenovateSettings,\n} from \"#/features/check-version-downgrades/index.ts\";\nimport { checkHiddenUnicode } from \"#/features/find-invisible-characters/index.ts\";\nimport {\n checkAppliedPackages,\n checkReplacedTools,\n checkUnneededFiles,\n} from \"#/features/find-unneeded-files/index.ts\";\n\nimport { checkManifests } from \"./manifest-checks.ts\";\n\n/** @internal */\nexport const checkTrackedText = Effect.fn(\"checkTrackedText\")(function* checkTrackedText(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkHiddenUnicode(root),\n checkPython(root),\n checkDocker(root),\n checkUnneededFiles(root),\n checkReplacedTools(root),\n checkManifests(root),\n checkSkillFiles(root),\n checkSkillEntry(root),\n checkPublishedSkills(root),\n checkComments(root),\n checkAppliedPackages(root),\n checkGitSubpath(root),\n checkDowngrades(root),\n checkPackageVersions(root),\n checkRenovateSettings(root),\n checkCatalogEntries(root),\n checkPackageRegistry(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkOverrides } from \"#/features/check-overrides/index.ts\";\nimport { checkPlacement } from \"#/features/check-placement/index.ts\";\nimport { checkWorkspaces } from \"#/features/check-repository-layout/index.ts\";\nimport { checkPublishedPackages } from \"#/features/measure-install-size/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { checkBuilds } from \"./build-checks.ts\";\nimport { checkSources } from \"./source-checks.ts\";\nimport { checkToolUse } from \"./tool-use.ts\";\nimport { checkTrackedText } from \"./tracked-text.ts\";\n\n/** @internal */\nexport const checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkSources>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n | ReturnType<typeof checkWorkspaces>\n | ReturnType<typeof checkToolUse>\n >,\n Effect.Services<\n | ReturnType<typeof checkSources>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkSources(root),\n checkOverrides(root),\n checkTrackedText(root),\n checkPlacement(root),\n checkPublishedPackages(root),\n checkWorkspaces(root),\n checkToolUse(root),\n checkBuilds(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","#!/usr/bin/env node\nimport { VpToolsError, runVpa } from \"@r_masseater/vite-plus-adopt\";\nimport { Array as Arr, Effect, Schema, Stdio, Stream, pipe } from \"effect\";\n\nimport { checkAll } from \"#/app/all-checks.ts\";\nimport { ProblemsFound, writeStdout } from \"#/app/output.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst NO_PROBLEMS = 0;\nconst ONE_FAILURE = 1;\nconst NO_CONFIG = \"config-missing\";\n\nconst writeProblems = (\n root: string,\n problems: readonly Problem[],\n): Effect.Effect<void, never, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n });\n\nconst writeStderr = Effect.fn(\"writeStderr\")(function* writeStderr(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n});\n\nconst failuresOf = (\n args: readonly string[],\n kind: string,\n message: string,\n): Effect.Effect<number, never, Stdio.Stdio> => {\n if (Arr.isReadonlyArrayEmpty(args) && kind === NO_CONFIG) {\n return Effect.succeed(NO_PROBLEMS);\n }\n return writeStderr(`${message}\\n`).pipe(Effect.as(ONE_FAILURE));\n};\n\ntype VpaRun = ReturnType<typeof runVpa>;\n\nconst toolChecks = (\n root: string,\n args: readonly string[],\n): Effect.Effect<\n number,\n Exclude<Effect.Error<VpaRun>, VpToolsError>,\n Effect.Services<VpaRun> | Stdio.Stdio\n> =>\n runVpa(root, args).pipe(\n Effect.as(NO_PROBLEMS),\n Effect.catchIf(Schema.is(VpToolsError), (failure) =>\n failuresOf(args, failure.kind, failure.message),\n ),\n );\n\nconst failWhenAny = (count: number): Effect.Effect<void, ProblemsFound> => {\n if (count > NO_PROBLEMS) {\n return Effect.fail(ProblemsFound.make({ count }));\n }\n return Effect.void;\n};\n\nconst writeJson = Effect.fn(\"writeJson\")(function* writeJson(root: string) {\n const found = yield* checkAll(root);\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(sortProblems(found));\n return yield* writeStdout(text);\n});\n\nconst checkEverything = Effect.fn(\"checkEverything\")(function* checkEverything(root: string) {\n const found = yield* checkAll(root);\n const problems = sortProblems(found);\n yield* writeProblems(root, problems);\n const toolFailures = yield* toolChecks(root, []);\n return yield* failWhenAny(problems.length + toolFailures);\n});\n\nconst msch = Effect.gen(function* msch() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const root = files.resolve(\".\");\n if (args.includes(JSON_FLAG)) {\n return yield* writeJson(root);\n }\n if (Arr.isReadonlyArrayNonEmpty(args)) {\n return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));\n }\n return yield* checkEverything(root);\n});\n\nrunCli(msch);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,eAAe,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU,OAAO,QAAQ,KAAK;CAC9B,KAAK;CACL,OAAO,OAAO;CACd,OAAO,OAAO;AAChB,CAAC;AACD,MAAM,aAAa,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,kBAAkB;CACvC,YAAY,OAAO,MAAM,OAAO,OAAO;AACzC,CAAC;AAED,MAAM,qBAAqB,OAAO,oBAAoB,YAAY;AAClE,MAAM,mBAAmB,OAAO,oBAAoB,UAAU;AAU9D,MAAM,WAAW,YACf,KACE,aAAa,SAAS,CAAC,CAAC,OAAO,GAC/BA,MAAI,SAAS,UACX,KACE,iBAAiB,KAAK,GACtB,OAAO,KAAK,EAAE,iBAAiB,UAAU,GACzC,OAAO,gBAAoC,CAAC,CAAC,CAC/C,CACF,GACAA,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ClC,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,eAAe,WAAW,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC;CAC/F,OAAO,OAAO,YAAY,IAAI;AAChC,CAAC;AAED,MAAM,kBAAkB,OAAO,GAAG,iBAAiB,CAAC,CAAC,UAAU,gBAAgB,MAAc;CAC3F,MAAM,QAAQ,OAAO,SAAS,IAAI;CAClC,MAAM,WAAW,aAAa,KAAK;CACnC,OAAO,cAAc,MAAM,QAAQ;CACnC,MAAM,eAAe,OAAO,WAAW,MAAM,CAAC,CAAC;CAC/C,OAAO,OAAO,YAAY,SAAS,SAAS,YAAY;AAC1D,CAAC;AAED,MAAM,OAAO,OAAO,IAAI,UAAU,OAAO;CACvC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,OAAO,MAAM,QAAQ,GAAG;CAC9B,IAAI,KAAK,SAAA,QAAkB,GACzB,OAAO,OAAO,UAAU,IAAI;CAE9B,IAAIA,MAAI,wBAAwB,IAAI,GAClC,OAAO,OAAO,WAAW,MAAM,IAAI,CAAC,CAAC,KAAK,OAAO,QAAQ,WAAW,CAAC;CAEvE,OAAO,OAAO,gBAAgB,IAAI;AACpC,CAAC;AAED,OAAO,IAAI"}
1
+ {"version":3,"file":"cli.mjs","names":["Arr","ALTERNATIVE","SCOPE","SPECIAL","patternOf","Arr","Str","SEPARATOR","SUCCESS","crateOf","Arr","Str","Arr","Arr","Str","Bool","NO_PROBLEMS","keyOf","Arr","Arr","Rec","Str","QUOTES","WORKSPACE_FILE","SUCCEEDED","taggedError","Str","Arr","problemsFor","LOCKFILE","READ_CONCURRENCY","Arr","RULE","WHOLE_MATCH","problemAt","Str","problemsIn","Arr","RULE","WHOLE_MATCH","problemsIn","Arr","Str","RULE","WHOLE_MATCH","problemsIn","Arr","Str","RULE","WORKSPACE_FILE","START","Str","Arr","EXCLUDED","isPublished","MANIFEST_FILE","Arr","RULE","ROOT","NEGATION","COMMENT","FIRST","READ_CONCURRENCY","Str","entryOf","Arr","entriesIn","MANIFEST_FILE","RULE","FIRST","READ_CONCURRENCY","SCRIPT","TEST_FILE","EXCLUDED","Manifest","decodeManifest","byLength","problemFor","groupsOf","Arr","Str","ownerOf","MANIFEST_FILE","problemIn","READ_CONCURRENCY","Arr","FIRST","RULE","Str","problemFor","RULE","FIRST","READ_CONCURRENCY","MESSAGE","Arr","RULE","SEPARATOR","FIRST","READ_CONCURRENCY","Str","Arr","ROOT_WORKSPACE","FIRST","SEPARATOR","EXCLUDED","Arr","byLength","fileProblem","ownerOf","Str","fileProblem","RULE","ROOT_DIRECTORY","READ_CONCURRENCY","MISSING_MESSAGE","decodeKey","Arr","childrenOf","problemIn","fileProblem","RULE","CONFIG_FILE","SEPARATOR","READ_CONCURRENCY","AGENT_DOCS","MANIFEST","RootConfig","taggedError","Str","problemFor","MISSING_MESSAGE","Arr","problemIn","RULE","READ_CONCURRENCY","MESSAGE","problemIn","Arr","RULE","MANIFEST_FILE","TEST_FILE","MESSAGE","Arr","Str","problemFor","RULE","SEPARATOR","FIRST","MARKDOWN","MESSAGE","Str","Arr","RULE","READ_CONCURRENCY","START","MARKETPLACE","RELATIVE","Marketplace","messageFor","Arr","Str","patternOf","problemsIn","Arr","RULE","READ_CONCURRENCY","Str","Arr","ownerOf","problemFor","problemIn","RULE","FIRST","MESSAGE","Arr","ENTRY_RULE","ENTRY_MESSAGE","entryProblems","MANIFEST_FILE","Arr","problemAt","SEPARATOR","NEXT","MANIFEST","SOURCE_PREFIX","Arr","Str","kindOf","NEXT","Arr","SLICE_RULE","ENTRY_RULE","SEPARATOR","NEXT","WORD_SEPARATOR","FEATURES","SOURCE","SCRIPT","englishVerbs","SLICE_MESSAGE","ENTRY_MESSAGE","Str","Arr","misnamedSlice","ownerOf","fileProblem","ENTRY_RULE","READ_CONCURRENCY","EXCLUDED","NONE","Arr","entryProblems","fileProblem","problemsOf","kindOf","RULE","FIRST","problemOf","Arr","Manifest","decodeManifest","Rec","Arr","MANIFEST_FILE","Arr","WORKFLOW_DIRECTORY","SEPARATOR","READ_CONCURRENCY","FIRST","COMMAND","Manifest","decodeManifest","Str","Arr","Rec","entriesOf","MANIFEST_FILE","isCommand","problemsIn","START","Arr","Str","quoted","START","WILDCARD","decodeStrings","Arr","Rec","Str","WILDCARD","SEPARATOR","FIRST","Arr","Str","WRAP_OFFSET","WILDCARD","SEPARATOR","RELATIVE","childrenOf","Arr","Str","listed","RULE","WORKSPACE_FILE","READ_CONCURRENCY","isMissing","Arr","Str","problemOf","problemsIn","RULE","MANIFEST_FILE","CARGO_FILE","CONFIG_FILE","SEPARATOR","FIRST","READ_CONCURRENCY","problemFor","problemIn","Arr","Str","RULE","FALLOW_CONFIG","PAIR","WRAP_OFFSET","READ_CONCURRENCY","MESSAGE","decodeKey","Arr","childrenOf","Str","problemsIn","RULE","WILDCARD","SEPARATOR","READ_CONCURRENCY","Arr","childrenOf","Str","problemsIn","RULE","CONFIG_FILE","FIRST","NEXT","Str","Arr","problemsIn","RULE","CONFIG_FILE","FIRST","READ_CONCURRENCY","problemIn","Arr","RULE","READ_CONCURRENCY","commandText","Arr","Str","problemsOf","Rec","RULE","READ_CONCURRENCY","Arr","problemsOf","Arr","isText","offsetOf","entriesOf","Arr","ROOT","LOCAL","SEPARATOR","LINE","FILTER_KEYS","QUOTED","Arr","Str","directoryOf","linesOf","entriesOf","RULE","READ_CONCURRENCY","SEPARATOR","Str","Arr","isMissing","problemOf","problemsIn","START","READ_CONCURRENCY","SEPARATOR","keysOf","Arr","problemAt","entriesOf","Str","patternOf","named","namesIn","Arr","Rec","SCOPE","SEPARATOR","Str","Arr","SUBPATH_IMPORT","WILDCARD","Arr","Rec","Str","referenceOf","referencesIn","MANIFEST_FILE","EMPTY","PeerMeta","decodeManifest","Rec","Arr","MANIFEST_FILE","Num","Str","DEPENDENCIES_KEY","START","Arr","listed","Str","Num","Rec","problemsOf","workspaceProblems","MANIFEST_FILE","Str","Arr","taggedError","Str","Arr","Rec","Manifest","Arr","Rec","manifestOf","sourcesOf","declaredBy","RULE","START","Arr","Str","problemFor","RULE","BUNDLE_CONCURRENCY","START","FIRST","Arr","messageOf","keyIndex","Str","RULE","CODE","READ_CONCURRENCY","messageOf","problemsIn","Arr","problemAt","Arr","BUNDLE_CONCURRENCY","Arr","declaredBy","bundleProblem","MANIFEST_FILE","manifestOf","RULE","FIRST","parse","Arr","lineOf","Str","messageOf","RULE","problemFor","problemOf","Arr","Arr","Arr","Arr","Str","packageOf","specifierOf","Arr","RULE","Arr","problemOf","Arr","problemIn","lineOf","Arr","Str","problemAt","ownerOf","lineOf","Arr","packageOf","Arr","Arr","problemAt","Arr","childrenOf","Arr","problemAt","Arr","Arr","Str","lineOf","canDerive","Arr","Rec","Arr","Rec","problemOf","EXTENSION","SEPARATOR","ROOT","Str","Arr","Rec","problemOf","Arr","Rec","problemOf","Arr","MANIFEST","SEPARATOR","decodeManifest","Str","Arr","directoriesOf","mentions","Arr","scopeOf","RULE","messageOf","Arr","problemOf","problemAt","RULE","Arr","problemOf","problemAt","RULE","SETTINGS_FILE","GITHUB","Source","Plugins","SettingsSchema","decodeSettings","marketplace.name","marketplace.plugins","Arr","problem","Rec","RULE","SETTINGS_FILE","READ_CONCURRENCY","START","referenceOf","referencesIn","Arr","Str","problemsIn","RULE","SEPARATOR","TASK_SEPARATOR","LOCAL_PREFIX","ONE","START","Str","Arr","ancestorsOf","Rec","problemsIn","RULE","FIRST_COLUMN","Arr","taggedError","CONFIG_FILE","FIRST","Arr","READ_CONCURRENCY","RULE","MESSAGE","Arr","Str","READ_CONCURRENCY","Arr","START","QUOTED","RULE","MESSAGE","Str","Arr","problemsIn","Arr","SEPARATOR","BLANK","Str","Arr","GITHUB","SECOND","INLINE_CODE","Arr","Str","commandProblems","FENCE","Arr","Str","ROOT_DIRECTORY","EXCLUDED","MANIFEST_FILE","READ_CONCURRENCY","START","FIRST","decodeJson","offsetOf","Str","Rec","Arr","childrenOf","RULE","problemOf","Arr","RULE","Arr","MESSAGE","Str","commandProblems","Arr","RULE","MESSAGE","RULE","MESSAGE","Arr","RULE","FIRST","MESSAGE","Arr","RULE","MESSAGE","Arr","RULE","MESSAGE","Arr","Arr","taggedError","Str","Arr","NEXT","Arr","parseSql","Num","Str","START","Rec","Arr","Str","parseDocument","SHEBANG","READERS","Str","Arr","RULE","UNUSED_RULE","CONFIG_FILE","READ_CONCURRENCY","START","MESSAGE","taggedError","Str","Arr","problemOf","FIRST_LINE","FIRST_COLUMN","WHOLE_MATCH","Str","Arr","SPAWN_PATTERNS","COMMAND_PATTERNS","Arr","RULE","ROOT_DIRECTORY","PLUGIN_MANIFEST","MESSAGE","Arr","Str","problemsIn","offsetIn","MANIFEST_FILE","WORKSPACE_FILE","MANIFEST","FIRST_LINE","FIRST_COLUMN","READ_CONCURRENCY","decodeString","Rec","Arr","Str","referenceOf","decodeManifest","lineOf","problemAt","CONFIG_FILE","RENOVATE_FILE","PRESET","START","taggedError","problemAt","Str","Rec","Arr","RULE","SKILL_FILE","problemAt","Arr","Str","problemsIn","RULE","MARKDOWN","NAME_KEY","SEPARATOR","START","FIRST","READ_CONCURRENCY","offsetOf","Str","parse","Arr","rangeOf","linksIn","problemsIn","Rec","Arr","Str","parse","RULE","READ_CONCURRENCY","FIRST_LINE","Str","Arr","message","Rec","START","READ_CONCURRENCY","Arr","Str","problemsIn","RULE","FIRST_LINE","FIRST_COLUMN","READ_CONCURRENCY","Manifest","LAST_SEGMENT","directoryOf","Str","decodeManifest","Arr","floorOf","baseName","SCOPE","RULE","WORKSPACE_FILE","SEPARATOR","Str","Arr","Rec","MANIFEST_FILE","problemAt","ownerOf","RULE","FIRST","problemFor","Arr","Arr","WORKSPACE_FILE","START","Str","Arr","RULE","START","MESSAGE","Arr","Str","Rec","problemsIn","START","READ_CONCURRENCY","RULE","Str","problemsIn","Arr","Arr","RULE","EXCLUDED","START","Config","MESSAGE","problemsIn","Arr","Str","RULE","EXCLUDED","Str","Arr","offsetIn","quoted","manifestProblems","Rec","MANIFEST_FILE","RULE","START","READ_CONCURRENCY","EXCLUDED","Arr","Str","problemsIn","MANIFEST_FILE","RULE","Str","Arr","MANIFEST_FILE","RULE","ROOT_DIRECTORY","START","Str","Arr","RULE","START","Str","RULE","MANIFEST","START","Manifest","decodeManifest","Str","Arr","manifestProblems","problemsIn","MANIFEST_FILE","RULE","START","FIRST","Manifest","decodeManifest","Arr","Str","MANIFEST_FILE","RULE","Str","Arr","Rec","Arr","MANIFEST_FILE","Arr","Arr","Arr","Arr"],"sources":["../src/entities/workspace/model/run-tasks.ts","../src/entities/workspace/model/workspace-names.ts","../src/entities/workspace/model/cargo-crates.ts","../src/features/check-overrides/model/override-findings.ts","../src/entities/project/model/implementation.ts","../src/features/check-overrides/model/override-records.ts","../src/features/check-overrides/model/override-resolution.ts","../src/features/check-overrides/model/overrides.ts","../src/shared/lib/scanned-files.ts","../src/features/check-overrides/model/git-subpath.ts","../src/features/check-overrides/model/restricted-rules.ts","../src/features/check-overrides/model/type-exemptions.ts","../src/features/check-overrides/model/package-registry.ts","../src/entities/package/model/stack-catalog.ts","../src/entities/package/model/published-manifest.ts","../src/features/check-placement/model/colocated-git-patterns.ts","../src/features/check-placement/model/colocated-tests.ts","../src/shared/lib/agent-docs.ts","../src/features/check-placement/model/agent-docs-length.ts","../src/features/check-placement/model/claude-link.ts","../src/features/check-placement/model/dangling-links.ts","../src/features/check-placement/model/member-sources.ts","../src/features/check-placement/model/readme-file.ts","../src/features/check-placement/model/deployed-readme.ts","../src/features/check-placement/model/nested-docs.ts","../src/features/check-placement/model/published-readme.ts","../src/features/check-placement/model/published-tests.ts","../src/features/check-placement/model/root-docs.ts","../src/features/check-placement/model/root-readme.ts","../src/features/check-placement/model/doc-placement.ts","../src/features/check-placement/model/docs-mirror.ts","../src/features/check-placement/model/ignored-sources.ts","../src/features/check-placement/model/public-entries.ts","../src/features/check-placement/model/rust-layout.ts","../src/features/check-placement/model/rust-syntax.ts","../src/features/check-placement/model/english-verbs.json","../src/features/check-placement/model/source-names.ts","../src/features/check-placement/model/rust-modules.ts","../src/features/check-placement/model/shadcn-ui-alias.ts","../src/features/check-placement/model/source-aliases.ts","../src/features/check-placement/model/placement-checks.ts","../src/features/check-repository-layout/model/command-entries.ts","../src/features/check-repository-layout/model/path-mention.ts","../src/features/check-repository-layout/model/cargo-paths.ts","../src/features/check-repository-layout/model/path-existence.ts","../src/features/check-repository-layout/model/tsconfig-paths.ts","../src/features/check-repository-layout/model/config-paths.ts","../src/features/check-repository-layout/model/crates.ts","../src/features/check-repository-layout/model/deploy-entry-patterns.ts","../src/features/check-repository-layout/model/fallow-entries.ts","../src/features/check-repository-layout/model/root-workspace-paths.ts","../src/features/check-repository-layout/model/hidden-verify.ts","../src/features/check-repository-layout/model/shared-uncached-tasks.ts","../src/features/check-repository-layout/model/unlocked-tasks.ts","../src/features/check-repository-layout/model/task-checks.ts","../src/features/check-repository-layout/model/workflow-nodes.ts","../src/features/check-repository-layout/model/workflow-references.ts","../src/features/check-repository-layout/model/workflow-paths.ts","../src/features/check-repository-layout/model/workflow-scale.ts","../src/features/check-repository-layout/model/workspace-checks.ts","../src/shared/lib/keys.ts","../src/shared/lib/package-name.ts","../src/features/measure-install-size/model/import-graph.ts","../src/features/measure-install-size/model/installed-closure.ts","../src/features/measure-install-size/model/install-size.ts","../src/shared/lib/bundle-error.ts","../src/features/check-tree-shaking/model/consumer-bundle.ts","../src/features/check-tree-shaking/model/manifest.ts","../src/features/check-tree-shaking/model/optional-peers.ts","../src/features/check-tree-shaking/model/side-effects.ts","../src/features/check-tree-shaking/model/top-level-effects.ts","../src/features/check-tree-shaking/model/usage.ts","../src/features/check-tree-shaking/model/tree-shaking.ts","../src/features/check-typescript-generation/model/typescript-generation.ts","../src/features/check-worker-bundles/model/worker-bundles.ts","../src/app/build-checks.ts","../src/features/check-value-owners/model/slots.ts","../src/features/check-value-owners/model/flows.ts","../src/features/check-value-owners/model/free-literals.ts","../src/features/check-value-owners/model/name-lists.ts","../src/features/check-value-owners/model/outside-names.ts","../src/features/check-value-owners/model/owners.ts","../src/features/check-value-owners/model/derivation.ts","../src/features/check-value-owners/model/property-match.ts","../src/features/check-value-owners/model/shapes.ts","../src/features/check-value-owners/model/sites.ts","../src/features/check-value-owners/model/value-checks.ts","../src/features/check-value-owners/model/analysis.ts","../src/features/check-value-owners/model/cache.ts","../src/features/check-value-owners/model/duplicates.ts","../src/features/check-value-owners/model/declared-names.ts","../src/features/check-value-owners/model/listed-paths.ts","../src/features/check-value-owners/model/subset-lists.ts","../src/features/check-value-owners/model/hand-lists.ts","../src/features/check-value-owners/model/repository-names.ts","../src/features/check-value-owners/model/check.ts","../src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts","../src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts","../src/app/source-checks.ts","../src/shared/config/masseater-marketplace.json","../src/features/check-agent-settings/model/known-plugins.ts","../src/features/check-agent-settings/model/missing-hooks.ts","../src/features/check-documented-commands/model/task-graph.ts","../src/features/check-documented-commands/model/commands.ts","../src/features/check-legacy-web/model/legacy-web.ts","../src/shared/lib/section-check.ts","../src/features/check-markdown/model/markdown.ts","../src/features/check-scripts/model/shell-scripts.ts","../src/shared/lib/workflow-files.ts","../src/shared/lib/workflow-run.ts","../src/features/check-scripts/model/workflows.ts","../src/features/check-scripts/model/script-checks.ts","../src/features/check-structure/model/structure.ts","../src/features/check-vite-plus/model/command-words.ts","../src/features/check-vite-plus/model/command-problems.ts","../src/features/check-vite-plus/model/doc-sources.ts","../src/features/check-vite-plus/model/command-sources.ts","../src/features/check-vite-plus/model/package-scripts.ts","../src/features/check-vite-plus/model/vite-plus-block.ts","../src/features/check-vite-plus/model/vite-plus-checks.ts","../src/features/check-workflows/model/workflow-yaml.ts","../src/features/check-workflows/model/full-history-checkout.ts","../src/features/check-workflows/model/publish-trigger.ts","../src/features/check-workflows/model/release-please.ts","../src/features/check-workflows/model/workflow-queue.ts","../src/features/check-workflows/model/workflow-commits.ts","../src/features/check-workflows/model/workflow-lint.ts","../src/app/tool-use.ts","../src/shared/lib/comment-directives.ts","../src/features/ban-comments/model/found-comment.ts","../src/features/ban-comments/model/config-comments.ts","../src/features/ban-comments/model/comment-readers.ts","../src/features/ban-comments/model/reader-of.ts","../src/features/ban-comments/model/comments.ts","../src/features/ban-tools/model/banned-tool.ts","../src/features/ban-tools/model/docker.ts","../src/features/ban-tools/model/python.ts","../src/features/check-catalog-entries/model/uncataloged-dependencies.ts","../src/features/check-catalog-entries/model/catalog-entries.ts","../src/features/check-skills/model/skill-entry.ts","../src/features/check-skills/model/published-skills.ts","../src/features/check-skills/model/skill-files.ts","../src/features/check-version-downgrades/model/version-entries.ts","../src/features/check-version-downgrades/model/version-downgrade.ts","../src/features/check-version-downgrades/model/renovate-settings.ts","../src/features/check-version-downgrades/model/package-versions.ts","../src/features/find-unneeded-files/model/applied-packages.ts","../src/features/find-unneeded-files/model/replaced-tools.ts","../src/features/find-unneeded-files/model/lockfiles.ts","../src/features/find-unneeded-files/model/unneeded-files.ts","../src/features/check-markdown-directives/model/directives.ts","../src/features/find-invisible-characters/model/hidden-unicode.ts","../src/app/document-checks.ts","../src/features/check-effect-diagnostics/model/effect-diagnostics.ts","../src/features/check-exact-versions/model/exact-versions.ts","../src/features/check-pack-settings/model/pack-settings.ts","../src/features/check-plugin-marketplace/model/plugin-marketplace.ts","../src/features/check-published-manifest/model/package-homepage.ts","../src/features/check-published-manifest/model/package-scope.ts","../src/features/check-published-manifest/model/published-manifests.ts","../src/features/check-runtime-version/model/node-version.ts","../src/features/check-unused-workspaces/model/unused-workspaces.ts","../src/features/check-upstream-exits/model/scattered-deviations.ts","../src/features/check-workspace-descriptions/model/workspace-descriptions.ts","../src/app/manifest-checks.ts","../src/app/tracked-text.ts","../src/app/all-checks.ts","../bin/msch.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { KeySchema, nestedValues } from \"./config-literal.ts\";\nimport { workspaceConfigOf } from \"./workspace-config-source.ts\";\nimport { RUN_TASKS } from \"./workspace-tasks.ts\";\n\nconst TaskProperty = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n start: Schema.Finite,\n});\nconst TaskObject = Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n});\n\nconst decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);\nconst decodeTaskObject = Schema.decodeUnknownOption(TaskObject);\n\nexport type RunTask = typeof TaskProperty.Type;\n\nexport interface RunTasks {\n readonly file: string;\n readonly source: string;\n readonly tasks: readonly RunTask[];\n}\n\nconst tasksIn = (program: unknown): readonly RunTask[] =>\n pipe(\n nestedValues(RUN_TASKS)(program),\n Arr.flatMap((tasks) =>\n pipe(\n decodeTaskObject(tasks),\n Option.map(({ properties }) => properties),\n Option.getOrElse((): readonly unknown[] => []),\n ),\n ),\n Arr.flatMap((property) => Option.toArray(decodeTaskProperty(property))),\n );\n\nexport const runTasksOf = Effect.fn(\"runTasksOf\")(function* runTasksOf(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n return pipe(\n config,\n Option.map(({ file, source, program }): RunTasks => ({\n file,\n source,\n tasks: tasksIn(program),\n })),\n );\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceProjects } from \"./workspace-projects.ts\";\nimport type { WorkspaceProject } from \"./workspace-projects.ts\";\n\nconst ALTERNATIVE = \"|\";\nconst SCOPE = /^@[^/]+\\//u;\nconst SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\n\nexport interface NamedWorkspace {\n readonly directory: string;\n readonly names: readonly string[];\n readonly packageName: Option.Option<string>;\n}\n\n/** @internal */\nexport const patternOf = (names: readonly string[]): RegExp => {\n const alternatives = pipe(names, Arr.map(Str.replaceAll(SPECIAL, String.raw`\\$&`)));\n return new RegExp(\n `(?<![\\\\p{L}\\\\p{N}_-])(?:${Arr.join(alternatives, ALTERNATIVE)})(?![\\\\p{L}\\\\p{N}_-])`,\n \"gu\",\n );\n};\n\nconst namedIn =\n (basename: (directory: string) => string) =>\n ({ directory, packageName }: WorkspaceProject): NamedWorkspace => {\n const unscoped = pipe(packageName, Option.map(Str.replace(SCOPE, \"\")));\n const names = pipe(\n [Option.some(directory), Option.some(basename(directory)), packageName, unscoped],\n Arr.getSomes,\n Arr.dedupe,\n );\n return { directory, names, packageName };\n };\n\n/** @internal */\nexport const namedWorkspaces = Effect.fn(\"namedWorkspaces\")(function* namedWorkspaces(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const projects = yield* workspaceProjects(root);\n return pipe(projects, Arr.map(namedIn((directory) => files.basename(directory))));\n});\n","import { Array as Arr, Effect, Option, Schema, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nconst SEPARATOR = \"/\";\nconst SUCCESS = 0;\n\nconst CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });\nconst CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });\nconst CrateEntry = Schema.Struct({\n name: Schema.String,\n version: Schema.String,\n manifest_path: Schema.String,\n targets: Schema.Array(CrateTarget),\n dependencies: Schema.Array(CrateDependency),\n});\nconst CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));\nconst decodeCrateList = Schema.decodeUnknownEffect(CrateList);\n\nexport interface Crate {\n readonly name: string;\n readonly version: string;\n readonly manifest: string;\n readonly kinds: readonly string[];\n readonly pathDependencies: readonly string[];\n}\n\nconst crateOf = (crate: typeof CrateEntry.Type): Crate => ({\n name: crate.name,\n version: crate.version,\n manifest: crate.manifest_path,\n kinds: pipe(\n crate.targets,\n Arr.flatMap(({ kind }) => kind),\n Arr.dedupe,\n ),\n pathDependencies: pipe(\n crate.dependencies,\n Arr.flatMap(({ path }) => Option.toArray(Option.fromUndefinedOr(path))),\n ),\n});\n\n/** @internal */\nexport const cratesIn = Effect.fn(\"cratesIn\")(function* cratesIn(root: string) {\n const handle = yield* ChildProcess.make(\n \"cargo\",\n [\"metadata\", \"--no-deps\", \"--format-version\", \"1\", \"--offline\"],\n { cwd: root, extendEnv: true, stdin: \"ignore\" },\n );\n const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n if (code !== SUCCESS) {\n return [];\n }\n const list = yield* decodeCrateList(output);\n return pipe(list.packages, Arr.map(crateOf));\n}, Effect.scoped);\n\n/** @internal */\nexport const owningWorkspace =\n (directories: readonly string[]) =>\n (directory: string): Option.Option<string> => {\n const owners = pipe(\n directories,\n Arr.filter(\n (workspace) =>\n directory === workspace || Str.startsWith(`${workspace}${SEPARATOR}`)(directory),\n ),\n );\n return Arr.last(Arr.sort(owners, Str.Order));\n };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport type { OverrideKey, OverrideReport } from \"./override-resolution.ts\";\n\nconst describeVersions = (versions: readonly string[]): string =>\n Option.getOrElse(\n Option.liftPredicate(Arr.join(versions, \",\"), (joined) => joined !== \"\"),\n () => \"-\",\n );\n\nconst describeChanges = (report: OverrideReport): string => {\n const versions = pipe(\n report.changes,\n Arr.map(\n (change) =>\n `${change.name} ${describeVersions(change.before)} -> ${describeVersions(change.after)}`,\n ),\n );\n const contexts = Arr.filter([\"the peer contexts\"], () => report.peerContextsChanged);\n return Arr.join([...versions, ...contexts], \"; \");\n};\n\nexport interface LocatedOverride extends OverrideKey {\n readonly file: string;\n}\n\nexport const overrideProblem =\n (located: LocatedOverride) =>\n (report: OverrideReport): Option.Option<Problem> => {\n const at = { file: located.file, line: located.line, column: located.column };\n if (report.verdict === \"unused\") {\n return Option.some({\n ...at,\n rule: \"unused-override\",\n message: `Every package resolves the same way without the override ${report.key}. Remove it.`,\n });\n }\n if (report.verdict === \"verify\") {\n return Option.some({\n ...at,\n rule: \"removable-override\",\n message: `Removing the override ${report.key} changes ${describeChanges(report)} without new peer issues or advisories. Remove it and run verify.`,\n });\n }\n return Option.none();\n };\n","import { Array as Arr, Boolean as Bool, Effect, String as Str, pipe } from \"effect\";\n\nimport { contentKey } from \"#/shared/lib/pass-records.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { installedPackages, nearestManifestDirectory } from \"./inputs.ts\";\n\nconst MANIFEST_ENTRY = \"package.json\";\nconst SOURCE_ENTRY = \"src\";\nconst LOWER_LAYERS = [\"entities\", \"shared\"] as const;\nconst PATH_SEPARATOR = \"/\";\nconst NOT_INSTALLED: readonly string[] = [];\n\nconst walked = (directory: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* walkFrom() {\n const files = yield* RepositoryFiles;\n const found = yield* files.walkDirectory(directory);\n return pipe(\n found,\n Arr.map((file) => files.join(directory, file)),\n );\n });\n\nconst sourceFiles = Effect.fn(\"sourceFiles\")(function* sourceFiles(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const source = files.join(root, SOURCE_ENTRY);\n const layers = pipe(\n LOWER_LAYERS,\n Arr.map((layer) => files.join(source, layer)),\n );\n const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, {\n concurrency: 1,\n });\n return Arr.flatten(nested);\n});\n\nconst bundleParts = Effect.fn(\"bundleParts\")(function* bundleParts(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const bundled = yield* walked(moduleDirectory);\n return { listed: [files.join(root, MANIFEST_ENTRY), ...bundled], installed: NOT_INSTALLED };\n});\n\nconst sourceParts = Effect.fn(\"sourceParts\")(function* sourceParts(\n root: string,\n moduleDirectory: string,\n) {\n const listed = yield* sourceFiles(root, moduleDirectory);\n const installed = yield* installedPackages(root, root);\n return { listed, installed };\n});\n\n/** @internal */\nexport const implementationOf = Effect.fn(\"implementationOf\")(function* implementationOf(\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const root = yield* nearestManifestDirectory(moduleDirectory);\n const fromSource = Str.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(\n moduleDirectory,\n );\n const parts = yield* Bool.match(fromSource, {\n onFalse: () => bundleParts(root, moduleDirectory),\n onTrue: () => sourceParts(root, moduleDirectory),\n });\n return {\n files: pipe(\n Arr.sort(parts.listed, Str.Order),\n Arr.map((file) => [files.relative(root, file), file] as const),\n ),\n installed: parts.installed,\n };\n});\n\nexport const implementationFingerprint = Effect.fn(\"implementationFingerprint\")(\n function* implementationFingerprint(moduleDirectory: string) {\n const implementation = yield* implementationOf(moduleDirectory);\n return yield* contentKey(implementation.installed, implementation.files);\n },\n);\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport { implementationFingerprint } from \"#/entities/project/index.ts\";\nimport { contentKey, keepOnly, recordsIn } from \"#/shared/lib/pass-records.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RECORDS = [NODE_MODULES, \".cache\", \"msch\", \"overrides\"] as const;\nconst NO_PROBLEMS: readonly Problem[] = [];\n\nconst keyOf = Effect.fn(\"keyOf\")(function* keyOf(root: string, inputs: readonly string[]) {\n const files = yield* RepositoryFiles;\n const implementation = yield* implementationFingerprint(import.meta.dirname);\n return yield* contentKey(\n [implementation],\n pipe(\n inputs,\n Arr.map((file) => [file, files.join(root, file)] as const),\n ),\n );\n});\n\nexport const unlessPassed = Effect.fn(\"unlessPassed\")(function* unlessPassed<Failure, Services>(\n root: string,\n inputs: readonly string[],\n check: Effect.Effect<readonly Problem[], Failure, Services>,\n) {\n const files = yield* RepositoryFiles;\n const key = yield* keyOf(root, inputs);\n const records = yield* recordsIn(files.join(root, ...RECORDS));\n if (Arr.contains(records.passed, key)) {\n yield* Effect.annotateCurrentSpan({ \"msch.overrides.recorded\": true });\n return NO_PROBLEMS;\n }\n const problems = yield* check;\n if (Arr.isReadonlyArrayEmpty(problems)) {\n yield* keepOnly(records, [key]);\n }\n return problems;\n});\n","import { Array as Arr, Option, Order, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst VerdictSchema = Schema.Literals([\"unused\", \"keep\", \"verify\"]);\n\nconst PackageChangeSchema = Schema.Struct({\n name: Schema.String,\n before: Schema.Array(Schema.String),\n after: Schema.Array(Schema.String),\n});\n\nconst OverrideReportSchema = Schema.Struct({\n key: Schema.String,\n verdict: VerdictSchema,\n changes: Schema.Array(PackageChangeSchema),\n peerContextsChanged: Schema.Boolean,\n peerIssues: Schema.Array(Schema.String),\n advisories: Schema.Array(Schema.String),\n});\n\nexport type OverrideReport = typeof OverrideReportSchema.Type;\ntype PackageChange = typeof PackageChangeSchema.Type;\n\nconst PeerParentSchema = Schema.Struct({ name: Schema.String, version: Schema.String });\n\nconst PeerIssueSchema = Schema.Struct({\n parents: Schema.Array(PeerParentSchema),\n wantedRange: Schema.String,\n foundVersion: Schema.optionalKey(Schema.String),\n});\n\ntype PeerIssue = typeof PeerIssueSchema.Type;\n\nconst ProjectPeerIssuesSchema = Schema.Struct({\n bad: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n missing: Schema.Record(Schema.String, Schema.Array(PeerIssueSchema)),\n conflicts: Schema.Array(Schema.String),\n});\n\ntype ProjectPeerIssues = typeof ProjectPeerIssuesSchema.Type;\n\nconst PeerIssuesLog = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.Literal(\"pnpm:peer-dependency-issues\"),\n issuesByProjects: Schema.Record(Schema.String, ProjectPeerIssuesSchema),\n }),\n);\n\nexport interface Findings {\n readonly peerIssues: readonly string[];\n readonly advisories: readonly string[];\n}\n\nexport interface Resolution extends Findings {\n readonly versions: Readonly<Record<string, readonly string[]>>;\n readonly snapshots: readonly string[];\n}\n\nconst AdvisorySchema = Schema.Struct({\n module_name: Schema.String,\n github_advisory_id: Schema.String,\n});\n\nconst AuditReport = Schema.fromJsonString(\n Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }),\n);\n\nconst SCOPE_PREFIX = \"@\";\nconst NAME_START = 0;\nconst SEPARATOR_LENGTH = 1;\nconst PEER_CONTEXT_START = \"(\";\n\nconst sorted = (values: readonly string[]): readonly string[] =>\n Arr.sort(Arr.dedupe(values), Order.String);\n\nconst describeIssue =\n (project: string, kind: string) =>\n ([peer, issues]: readonly [string, readonly PeerIssue[]]): readonly string[] =>\n pipe(\n issues,\n Arr.map((issue) => {\n const dependent = Option.match(Arr.last(issue.parents), {\n onNone: () => project,\n onSome: (parent) => `${parent.name}@${parent.version}`,\n });\n const found = Option.getOrElse(Option.fromUndefinedOr(issue.foundVersion), () => \"none\");\n return `${project}: ${kind} peer ${peer}@${issue.wantedRange} of ${dependent}, found ${found}`;\n }),\n );\n\nconst issuesOfProject = ([project, issues]: readonly [\n string,\n ProjectPeerIssues,\n]): readonly string[] => [\n ...pipe(Rec.toEntries(issues.bad), Arr.flatMap(describeIssue(project, \"unmet\"))),\n ...pipe(Rec.toEntries(issues.missing), Arr.flatMap(describeIssue(project, \"missing\"))),\n ...pipe(\n issues.conflicts,\n Arr.map((peer) => `${project}: conflicting peer ${peer}`),\n ),\n];\n\nexport const peerIssuesIn = (output: string): readonly string[] =>\n sorted(\n pipe(\n Str.split(output, \"\\n\"),\n Arr.map((line) => Schema.decodeOption(PeerIssuesLog)(line)),\n Arr.getSomes,\n Arr.flatMap((log) => pipe(Rec.toEntries(log.issuesByProjects), Arr.flatMap(issuesOfProject))),\n ),\n );\n\nexport const advisoriesIn = (output: string): readonly string[] =>\n Option.match(Schema.decodeOption(AuditReport)(output), {\n onNone: () => [],\n onSome: (report) =>\n sorted(\n pipe(\n Rec.values(report.advisories),\n Arr.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`),\n ),\n ),\n });\n\nconst separatorOf = (key: string): Option.Option<number> => {\n if (!Str.startsWith(SCOPE_PREFIX)(key)) {\n return Str.indexOf(SCOPE_PREFIX)(key);\n }\n return pipe(\n Str.slice(SEPARATOR_LENGTH)(key),\n Str.indexOf(SCOPE_PREFIX),\n Option.map((index) => index + SEPARATOR_LENGTH),\n );\n};\n\nconst withoutPeerContext = (version: string): string =>\n Option.match(Str.indexOf(PEER_CONTEXT_START)(version), {\n onNone: () => version,\n onSome: (start) => Str.slice(NAME_START, start)(version),\n });\n\nconst packageOf = (key: string): Option.Option<readonly [string, string]> =>\n Option.map(separatorOf(key), (separator) => [\n Str.slice(NAME_START, separator)(key),\n withoutPeerContext(Str.slice(separator + SEPARATOR_LENGTH)(key)),\n ]);\n\nexport const resolutionOf =\n (findings: Findings) =>\n (depPaths: readonly string[]): Resolution => {\n const packages = Arr.getSomes(\n pipe(\n depPaths,\n Arr.map((key) => packageOf(key)),\n ),\n );\n const versions = Rec.map(\n Arr.groupBy(packages, ([name]) => name),\n (entries) =>\n sorted(\n pipe(\n entries,\n Arr.map(([, version]) => version),\n ),\n ),\n );\n return { ...findings, versions, snapshots: sorted(depPaths) };\n };\n\nconst changesBetween = (baseline: Resolution, candidate: Resolution): readonly PackageChange[] =>\n pipe(\n sorted([...Rec.keys(baseline.versions), ...Rec.keys(candidate.versions)]),\n Arr.map((name) => ({\n name,\n before: baseline.versions[name] ?? [],\n after: candidate.versions[name] ?? [],\n })),\n Arr.filter((change) => Arr.join(change.before, \" \") !== Arr.join(change.after, \" \")),\n );\n\nconst growsThePackageSet = (change: PackageChange): boolean =>\n change.after.length > change.before.length;\n\nconst needsTheOverride = (\n found: Pick<OverrideReport, \"changes\" | \"peerIssues\" | \"advisories\">,\n): boolean =>\n pipe(\n found.changes,\n Arr.some((change) => growsThePackageSet(change)),\n ) ||\n Arr.isReadonlyArrayNonEmpty(found.peerIssues) ||\n Arr.isReadonlyArrayNonEmpty(found.advisories);\n\nexport const judge =\n (baseline: Resolution) =>\n (key: string, candidate: Resolution): OverrideReport => {\n const changes = changesBetween(baseline, candidate);\n const peerIssues = Arr.difference(candidate.peerIssues, baseline.peerIssues);\n const advisories = Arr.difference(candidate.advisories, baseline.advisories);\n const peerContextsChanged =\n Arr.join(baseline.snapshots, \" \") !== Arr.join(candidate.snapshots, \" \");\n const found = { key, changes, peerContextsChanged, peerIssues, advisories };\n if (!Arr.isReadonlyArrayNonEmpty(changes) && !peerContextsChanged) {\n return { ...found, verdict: \"unused\" };\n }\n if (needsTheOverride(found)) {\n return { ...found, verdict: \"keep\" };\n }\n return { ...found, verdict: \"verify\" };\n };\n\nexport const BASELINE_PROBE = \"msch-baseline-probe\";\nconst REMOVED_DEPENDENCY = \"-\";\nconst QUOTES = ['\"', \"'\"];\nconst PREVIOUS = 1;\n\nexport type Overrides = Readonly<Record<string, string>>;\n\nexport interface OverrideKey {\n readonly key: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst keyStart =\n (source: string) =>\n (index: number): number => {\n const before = Str.slice(index - PREVIOUS, index)(source);\n return index - Number(Arr.contains(QUOTES, before)) * PREVIOUS;\n };\n\nexport const overrideKeysOf =\n (source: string) =>\n (overrides: Overrides): readonly OverrideKey[] => {\n const at = positionOf(source);\n return pipe(\n Rec.keys(overrides),\n Arr.flatMap((key) =>\n pipe(\n Str.indexOf(key)(source),\n Option.map((index) => ({ key, ...at(keyStart(source)(index)) })),\n Option.toArray,\n ),\n ),\n );\n };\n\nexport const withoutOverride =\n (key: string) =>\n (overrides: Overrides): Overrides =>\n Rec.remove(overrides, key);\n\nexport const withBaselineProbe = (overrides: Overrides): Overrides => ({\n ...overrides,\n [BASELINE_PROBE]: REMOVED_DEPENDENCY,\n});\n","import { updateWorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-writer\";\nimport {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { lockedPackages, workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { overrideProblem } from \"./override-findings.ts\";\nimport { unlessPassed } from \"./override-records.ts\";\nimport {\n BASELINE_PROBE,\n advisoriesIn,\n judge,\n overrideKeysOf,\n peerIssuesIn,\n resolutionOf,\n withBaselineProbe,\n withoutOverride,\n} from \"./override-resolution.ts\";\nimport type { OverrideKey, Overrides } from \"./override-resolution.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst RESOLUTION_FILES = [\"*package.json\", WORKSPACE_FILE, LOCKFILE, \".npmrc\", \"patches/*\"];\nconst RESOLUTION_CONCURRENCY = 2;\nconst SUCCEEDED = 0;\n\nconst taggedError = Schema.TaggedError;\n\nclass OverrideResolutionFailed extends taggedError<\n OverrideResolutionFailed,\n { readonly brand: unique symbol }\n>()(\"OverrideResolutionFailed\", { override: Schema.String, output: Schema.String }) {}\n\ntype CandidateFailure = OverrideResolutionFailed | PlatformError.PlatformError;\ntype CandidateServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\ninterface Workspace {\n readonly root: string;\n readonly files: readonly string[];\n readonly overrides: Overrides;\n}\n\nconst textOf = <Failure>(\n stream: Stream.Stream<Uint8Array, Failure>,\n): Effect.Effect<string, Failure> => stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst resolveIn = Effect.fn(\"resolveIn\")(function* resolveIn(directory: string, override: string) {\n const handle = yield* ChildProcess.make(\n \"vp\",\n [\"install\", \"--lockfile-only\", \"--ignore-scripts\", \"--\", \"--reporter=ndjson\"],\n { cwd: directory, env: { CI: \"true\" }, extendEnv: true, stdin: \"ignore\" },\n );\n const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n if (Number(status) !== SUCCEEDED) {\n return yield* OverrideResolutionFailed.make({ override, output });\n }\n return output;\n});\n\nconst auditIn = Effect.fn(\"auditIn\")(function* auditIn(directory: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"pm\", \"audit\", \"--json\"], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], {\n concurrency: \"unbounded\",\n });\n return advisoriesIn(report);\n}, Effect.scoped);\n\nconst trackedResolutionFiles = Effect.fn(\"trackedResolutionFiles\")(function* trackedFiles(\n root: string,\n) {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", \"--\", ...RESOLUTION_FILES], {\n cwd: root,\n });\n const listed = yield* textOf(handle.stdout);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n}, Effect.scoped);\n\nconst copyFiles = Effect.fn(\"copyFiles\")(function* copyFiles(\n workspace: Workspace,\n directory: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const copyOne = (file: string): Effect.Effect<void, PlatformError.PlatformError> => {\n const source = path.join(workspace.root, file);\n const target = path.join(directory, file);\n const copy = fs.copyFile(source, target);\n const write = fs\n .makeDirectory(path.dirname(target), { recursive: true })\n .pipe(Effect.andThen(copy));\n return Effect.when(write, fs.exists(source));\n };\n yield* Effect.forEach(workspace.files, copyOne, { concurrency: 1, discard: true });\n});\n\nconst depPathsIn = (\n directory: string,\n override: string,\n): Effect.Effect<readonly string[], OverrideResolutionFailed> =>\n lockedPackages(directory).pipe(\n Effect.mapBoth({\n onSuccess: Option.getOrElse((): readonly string[] => []),\n onFailure: ({ reason }) => OverrideResolutionFailed.make({ override, output: reason }),\n }),\n );\n\nconst resolutionWith = Effect.fn(\"resolutionWith\")(function* resolutionWith(\n workspace: Workspace,\n override: string,\n overrides: Overrides,\n) {\n const fs = yield* FileSystem.FileSystem;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-overrides-\" });\n yield* copyFiles(workspace, directory);\n yield* Effect.tryPromise({\n try: () =>\n updateWorkspaceManifest(directory, { updatedFields: { overrides: { ...overrides } } }),\n catch: (cause) => OverrideResolutionFailed.make({ override, output: String(cause) }),\n });\n const output = yield* resolveIn(directory, override);\n const depPaths = yield* depPathsIn(directory, override);\n yield* Effect.annotateCurrentSpan({ \"msch.override\": override });\n const advisories = yield* auditIn(directory);\n return resolutionOf({ peerIssues: peerIssuesIn(output), advisories })(depPaths);\n}, Effect.scoped);\n\nconst problemsFor = Effect.fn(\"problemsFor\")(function* problemsFor(\n workspace: Workspace,\n keys: readonly OverrideKey[],\n) {\n const path = yield* Path.Path;\n const { root, overrides } = workspace;\n const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));\n const judgeAgainstBaseline = judge(baseline);\n const file = path.join(root, WORKSPACE_FILE);\n const problemOf = (\n located: OverrideKey,\n ): Effect.Effect<Option.Option<Problem>, CandidateFailure, CandidateServices> =>\n resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(\n Effect.map((candidate) =>\n overrideProblem({ ...located, file })(judgeAgainstBaseline(located.key, candidate)),\n ),\n );\n const problems = yield* Effect.forEach(keys, problemOf, {\n concurrency: RESOLUTION_CONCURRENCY,\n });\n return Arr.getSomes(problems);\n});\n\n/** @internal */\nexport const checkOverrides = Effect.fn(\"checkOverrides\")(function* checkOverrides(root: string) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE)).pipe(Effect.option);\n const manifest = yield* workspaceManifest(root);\n const overrides: Overrides = pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)),\n Option.getOrElse((): Overrides => ({})),\n );\n const keys = pipe(\n source,\n Option.map((text) => overrideKeysOf(text)(overrides)),\n Option.getOrElse((): readonly OverrideKey[] => []),\n );\n if (!Arr.isReadonlyArrayNonEmpty(keys)) {\n return [];\n }\n const files = yield* trackedResolutionFiles(root);\n return yield* unlessPassed(root, files, problemsFor({ root, files, overrides }, keys));\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst READ_CONCURRENCY = 64;\n\nexport interface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nexport const isScannedText = ({ name }: Listed): boolean =>\n SCANNED_FILE.test(name) && !LOCKFILE.test(name);\n\nexport const isToolVersions = ({ name }: Listed): boolean => TOOL_VERSIONS.test(name);\n\n/** @internal */\nexport const listedFiles = Effect.fn(\"listedFiles\")(function* listedFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n return pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n});\n\n/** @internal */\nexport const presentFiles = Effect.fn(\"presentFiles\")(function* presentFiles(\n listed: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n listed,\n Effect.filter(({ file }) => files.exists(file)),\n );\n});\n\n/** @internal */\nexport const scanText = Effect.fn(\"scanText\")(function* scanText(\n listed: readonly Listed[],\n problemsIn: (entry: Listed, source: string) => readonly Problem[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n listed,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst DEPENDENCY_FILE = /(?:^|\\/)(?:package\\.json|pnpm-workspace\\.ya?ml)$/u;\nconst GIT_SUBPATH = /(?<![^\\s\"':])[^\\s\"'#]+#(?:[^\\s\"'&]*&)*path:[^\\s\"']*/gu;\nconst RULE: RuleName = \"git-subpath-dependency\";\nconst WHOLE_MATCH = 0;\n\nconst problemAt =\n ({ file }: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: RULE,\n message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \\`${Str.trim(found[WHOLE_MATCH])}\\`.`,\n });\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(Arr.fromIterable(Str.matchAll(GIT_SUBPATH)(source)), Arr.map(problemAt(entry, source)));\n\nconst isDependencyFile = ({ name }: Listed): boolean => DEPENDENCY_FILE.test(name);\n\n/** @internal */\nexport const checkGitSubpath = Effect.fn(\"checkGitSubpath\")(function* checkGitSubpath(\n root: string,\n) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isDependencyFile)), problemsIn);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { isScannedText, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"unnamed-restriction\";\nconst WHOLE_MATCH = 0;\nconst RESTRICTED = \"no-restricted-\";\nconst UNNAMED = new RegExp(`(?:[\\\\w@-]+/)?${RESTRICTED}(?:imports|properties)\\\\b`, \"gu\");\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(UNNAMED)(source)),\n Arr.map((found): Problem => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: RULE,\n message: `${found[WHOLE_MATCH]} 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.`,\n })),\n );\n\n/** @internal */\nexport const checkRestrictedRules = Effect.fn(\"checkRestrictedRules\")(\n function* checkRestrictedRules(root: string) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScannedText)), problemsIn);\n },\n);\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { isScannedText, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"named-type-exemption\";\nconst WHOLE_MATCH = 0;\nconst ORIGINS = \"file|lib|package\";\nconst SPECIFIER = new RegExp(`[\"']?\\\\bfrom[\"']?\\\\s*:\\\\s*[\"'](?:${ORIGINS})[\"']`, \"gu\");\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(SPECIFIER)(source)),\n Arr.map((found): Problem => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: RULE,\n message:\n \"exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration.\",\n })),\n );\n\n/** @internal */\nexport const checkTypeExemptions = Effect.fn(\"checkTypeExemptions\")(function* checkTypeExemptions(\n root: string,\n) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScannedText)), problemsIn);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"package-registry\";\nconst REGISTRY = \"https://npm.flatt.tech/\";\nconst TRAILING_SLASH = /\\/$/u;\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst NPMRC = /(?:^|\\/)\\.npmrc$/u;\nconst WORKSPACE_REGISTRY = /^registry:/mu;\nconst NPMRC_REGISTRY = /^[ \\t]*registry[ \\t]*=[ \\t]*(?<value>\\S*)/gmu;\nconst START = 0;\nconst REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;\n\nconst decodeRegistry = Schema.decodeUnknownOption(\n Schema.Struct({ registry: Schema.optional(Schema.String) }),\n);\n\nconst registryOf = (manifest: unknown): Option.Option<string> =>\n pipe(\n decodeRegistry(manifest),\n Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)),\n );\n\nconst withoutSlash = Str.replace(TRAILING_SLASH, \"\");\n\nconst isGuarded = (registry: string): boolean => withoutSlash(registry) === withoutSlash(REGISTRY);\n\nconst offsetIn = (found: RegExpExecArray | null): number =>\n pipe(\n Option.fromNullishOr(found),\n Option.map(({ index }) => index),\n Option.getOrElse(() => START),\n );\n\nconst workspaceProblem = (\n file: string,\n source: string,\n registry: Option.Option<string>,\n): Problem => ({\n file,\n ...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),\n rule: RULE,\n message: Option.match(registry, {\n onNone: () => `${REASON} Set \\`registry: ${REGISTRY}\\` in ${WORKSPACE_FILE}.`,\n onSome: (value) => `${REASON} \\`registry\\` is ${value}. Set it to ${REGISTRY}.`,\n }),\n});\n\nconst npmrcProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(NPMRC_REGISTRY)(source)),\n Arr.filter((found) => !Option.exists(groupOf(\"value\")(found), isGuarded)),\n Arr.map((found) => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `${REASON} This .npmrc overrides it with \\`${Str.trim(found[START])}\\`. Remove the line.`,\n })),\n );\n\nconst checkWorkspace = Effect.fn(\"checkWorkspace\")(function* checkWorkspace(root: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* workspaceManifest(root);\n if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) {\n return [];\n }\n const registry = registryOf(manifest.value);\n const file = files.join(root, WORKSPACE_FILE);\n const read = yield* files.readFile(file);\n const source = Option.getOrElse(read, () => \"\");\n return [workspaceProblem(file, source, registry)];\n});\n\n/** @internal */\nexport const checkPackageRegistry = Effect.fn(\"checkPackageRegistry\")(\n function* checkPackageRegistry(root: string) {\n const listed = yield* listedFiles(root);\n const overrides = yield* scanText(\n pipe(\n listed,\n Arr.filter(({ name }) => NPMRC.test(name)),\n ),\n npmrcProblems,\n );\n const workspace = yield* checkWorkspace(root);\n return [...workspace, ...overrides];\n },\n);\n","export const STACK_CATALOG = \"catalog:stack\";\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\n\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst PublishedManifestSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n private: Schema.optional(Schema.Boolean),\n publishConfig: Schema.optional(Schema.Unknown),\n homepage: Schema.optional(Schema.Unknown),\n repository: Schema.optional(Schema.Unknown),\n});\n\nexport type PublishedManifest = typeof PublishedManifestSchema.Type;\n\nexport interface PublishedFile {\n readonly entry: Listed;\n readonly source: string;\n readonly manifest: PublishedManifest;\n}\n\nexport interface PublishedFile {\n readonly entry: Listed;\n readonly source: string;\n readonly manifest: PublishedManifest;\n}\n\nconst decodePublishedManifest = Schema.decodeUnknownOption(\n Schema.fromJsonString(PublishedManifestSchema),\n);\n\nconst isPublished = (manifest: PublishedManifest): boolean =>\n manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);\n\nexport const publishedManifestOf = (\n source: Option.Option<string>,\n): Option.Option<PublishedManifest> =>\n pipe(source, Option.flatMap(decodePublishedManifest), Option.filter(isPublished));\n\n/** @internal */\nexport const scanPublishedManifests = Effect.fn(\"scanPublishedManifests\")(\n function* scanPublishedManifests(\n root: string,\n problemsIn: (found: PublishedFile) => readonly Problem[],\n ) {\n const files = yield* RepositoryFiles;\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n return yield* scanText(\n pipe(\n manifests,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n (entry, source) =>\n pipe(\n publishedManifestOf(Option.some(source)),\n Option.map((manifest) => problemsIn({ entry, source, manifest })),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n );\n },\n);\n","import { SEPARATOR, isInside } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"colocated-git-patterns\";\nconst PATTERN_FILES = [\":(glob)**/.gitignore\", \":(glob)**/.gitattributes\"] as const;\nconst ROOT = \".\";\nconst NEGATION = \"!\";\nconst COMMENT = \"#\";\nconst ANY_DEPTH = \"**\";\nconst FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR}`;\nconst LEADING_SLASHES = /^\\/+/u;\nconst TRAILING_SLASHES = /\\/+$/u;\nconst SPACES = /\\s+/u;\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\n\ninterface PatternEntry {\n readonly file: string;\n readonly kind: string;\n readonly directory: string;\n readonly line: number;\n readonly pattern: string;\n readonly values: string;\n}\n\nconst withoutPrefix = (prefix: string, text: string): string => {\n if (Str.startsWith(prefix)(text)) {\n return Str.slice(prefix.length)(text);\n }\n return text;\n};\n\nconst isAnchored = (pattern: string): boolean => {\n const body = withoutPrefix(NEGATION, pattern);\n return pipe(body, Str.replace(TRAILING_SLASHES, \"\"), Str.includes(SEPARATOR));\n};\n\nconst segmentsOf = ({ directory, pattern }: PatternEntry): readonly string[] => {\n const body = withoutPrefix(NEGATION, pattern);\n const trimmed = pipe(body, Str.replace(LEADING_SLASHES, \"\"), Str.replace(TRAILING_SLASHES, \"\"));\n const own = Str.split(SEPARATOR)(trimmed);\n if (directory === ROOT) {\n return own;\n }\n return [...Str.split(SEPARATOR)(directory), ...own];\n};\n\nconst depthOf = (directory: string): number => Str.split(SEPARATOR)(directory).length;\n\nconst entryOf =\n (file: string, kind: string, directory: string) =>\n (line: string, index: number): Option.Option<PatternEntry> => {\n const [pattern, ...values] = pipe(Str.trim(line), Str.split(SPACES));\n if (Str.isEmpty(pattern) || Str.startsWith(COMMENT)(pattern)) {\n return Option.none();\n }\n return Option.some({\n file,\n kind,\n directory,\n line: index + FIRST,\n pattern,\n values: Arr.join(values, \" \"),\n });\n };\n\nconst entriesIn = Effect.fn(\"entriesIn\")(function* entriesIn(root: string, file: string) {\n const files = yield* RepositoryFiles;\n const absolute = files.join(root, file);\n const text = yield* files.readFile(absolute);\n const toEntry = entryOf(absolute, files.basename(file), files.dirname(file));\n return pipe(\n Option.getOrElse(text, () => \"\"),\n Str.split(\"\\n\"),\n Arr.map(toEntry),\n Arr.getSomes,\n );\n});\n\nconst patternProblem = (entry: PatternEntry, message: string): Problem =>\n problemAtPosition(RULE)(entry.file, { line: entry.line, column: FIRST }, message);\n\nconst misplacedMessage = (kind: string, workspaces: readonly string[]): string => {\n if (workspaces.length === FIRST) {\n const workspace = Arr.join(workspaces, \"\");\n return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;\n }\n return `matches paths inside the workspaces ${Arr.join(workspaces, \", \")}. Move it to the ${kind} of each workspace that needs it, or start it with **/ when it belongs to a tool any workspace can use.`;\n};\n\nconst matchedAtDepth = Effect.fn(\"matchedAtDepth\")(function* matchedAtDepth(\n root: string,\n segments: readonly string[],\n depth: number,\n) {\n const files = yield* RepositoryFiles;\n const leading = Arr.take(segments, depth);\n if (Arr.contains(leading, ANY_DEPTH)) {\n return [];\n }\n const manifests = yield* files.matchingFiles(root, [\n `:(glob)${Arr.join(leading, SEPARATOR)}${SEPARATOR}${MANIFEST_FILE}`,\n ]);\n return pipe(\n manifests,\n Arr.map((manifest) => files.dirname(manifest)),\n );\n});\n\nconst deepestOf = (inner: readonly string[]): readonly string[] =>\n pipe(\n inner,\n Arr.filter((workspace) => !pipe(inner, Arr.some(isInside(workspace)))),\n );\n\nconst matchedWorkspaces = Effect.fn(\"matchedWorkspaces\")(function* matchedWorkspaces(\n root: string,\n workspaces: readonly string[],\n entry: PatternEntry,\n) {\n const segments = segmentsOf(entry);\n const candidates = pipe(\n workspaces,\n Arr.filter(isInside(entry.directory)),\n Arr.filter((workspace) => depthOf(workspace) < segments.length),\n );\n const depths = pipe(candidates, Arr.map(depthOf), Arr.dedupe);\n const matched = yield* Effect.forEach(depths, (depth) => matchedAtDepth(root, segments, depth), {\n concurrency: 1,\n });\n const flat = Arr.flatten(matched);\n return pipe(\n candidates,\n Arr.filter((workspace) => Arr.contains(flat, workspace)),\n deepestOf,\n );\n});\n\nconst misplaced = Effect.fn(\"misplaced\")(function* misplaced(\n root: string,\n workspaces: readonly string[],\n entry: PatternEntry,\n) {\n if (!isAnchored(entry.pattern)) {\n return Option.none<Problem>();\n }\n const deepest = yield* matchedWorkspaces(root, workspaces, entry);\n if (Arr.isReadonlyArrayEmpty(deepest)) {\n return Option.none<Problem>();\n }\n return Option.some(patternProblem(entry, misplacedMessage(entry.kind, deepest)));\n});\n\nconst isFloating = (pattern: string): boolean =>\n !Str.startsWith(NEGATION)(pattern) &&\n (!isAnchored(pattern) || Str.startsWith(FLOATING_PREFIX)(pattern));\n\nconst ownLevelName = (pattern: string): Option.Option<string> => {\n if (isFloating(pattern)) {\n return Option.some(pattern);\n }\n const name = withoutPrefix(SEPARATOR, pattern);\n return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));\n};\n\nconst sameName = (outer: string, name: string): boolean => {\n if (outer === name) {\n return true;\n }\n return Str.endsWith(SEPARATOR)(name) && `${outer}${SEPARATOR}` === name;\n};\n\nconst coveredBy =\n (entry: PatternEntry, name: string) =>\n (outer: PatternEntry): boolean =>\n outer.kind === entry.kind &&\n outer.values === entry.values &&\n isFloating(outer.pattern) &&\n isInside(outer.directory)(entry.directory) &&\n sameName(outer.pattern, name);\n\nconst outerName = ({ directory, kind }: PatternEntry): string => {\n if (directory === ROOT) {\n return `the root ${kind}`;\n }\n return `${directory}/${kind}`;\n};\n\nconst repeated =\n (entries: readonly PatternEntry[]) =>\n (entry: PatternEntry): Option.Option<Problem> => {\n const outer = pipe(\n ownLevelName(entry.pattern),\n Option.flatMap((name) => pipe(entries, Arr.findFirst(coveredBy(entry, name)))),\n );\n return pipe(\n outer,\n Option.map((found) =>\n patternProblem(\n entry,\n `repeats ${found.pattern} from ${outerName(found)}, which already applies here. Delete it.`,\n ),\n ),\n );\n };\n\n/** @internal */\nexport const checkColocatedGitPatterns = Effect.fn(\"checkColocatedGitPatterns\")(\n function* checkColocatedGitPatterns(root: string) {\n const files = yield* RepositoryFiles;\n const patternFiles = yield* files.matchingFiles(root, PATTERN_FILES);\n const read = yield* Effect.forEach(patternFiles, (file) => entriesIn(root, file), {\n concurrency: READ_CONCURRENCY,\n });\n const entries = Arr.flatten(read);\n const workspaces = yield* workspaceDirectories(root);\n const misplacedFound = yield* Effect.forEach(\n entries,\n (entry) => misplaced(root, workspaces, entry),\n { concurrency: READ_CONCURRENCY },\n );\n const repeatedFound = pipe(entries, Arr.map(repeated(entries)));\n return Arr.getSomes([...misplacedFound, ...repeatedFound]);\n },\n);\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, publicEntriesOf } from \"#/entities/package/index.ts\";\nimport type { EntryManifest } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"colocated-test\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 64;\nconst ROOT_SUBPATH = \".\";\nconst NAME_GROUP = \"name\";\nconst SPECIFIER_GROUP = \"specifier\";\nconst SCRIPT = /\\.[cm]?[jt]sx?$/u;\nconst TEST_FILE = /\\.test\\.[cm]?[jt]sx?$/u;\nconst MANIFEST_NAME = /package\\.json$/u;\nconst SEPARATE_TEST_DIRECTORY = /(?:^|\\/)(?:__tests__|__mocks__|tests?)\\//u;\nconst SPEC_DIRECTORY = /(?:^|\\/)specs?\\//u;\nconst SPEC_FILE = /\\.spec\\.[cm]?[jt]sx?$/u;\nconst RELATIVE_REFERENCE = /[\"'`]\\.\\/(?<name>[^/\"'`]+)/gu;\nconst DIRNAME_REFERENCE = /import\\.meta\\.dirname\\s*,\\s*[\"'](?<name>[^/\"']+)[\"']/gu;\nconst MODULE_SPECIFIER =\n /(?:\\bfrom\\s+|\\bimport\\s*\\(\\s*|\\bimport\\s+|\\bvi\\.mock\\(\\s*)[\"'](?<specifier>[^\"'.#][^\"']*)[\"']/gu;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst DIRECTORY_MESSAGE =\n \"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.\";\nconst SIBLING_MESSAGE =\n \"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>.\";\n\nconst Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface TestFile {\n readonly name: string;\n readonly base: string;\n readonly file: string;\n readonly directory: string;\n}\n\ninterface Context {\n readonly root: string;\n readonly packages: readonly string[];\n}\n\ninterface Beside {\n readonly join: (target: string) => string;\n readonly dirname: (file: string) => string;\n readonly directory: string;\n}\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nconst problemFor = (test: TestFile, message: string): Problem => ({\n file: test.file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${test.base} ${message}`,\n});\n\nconst groupsOf = (source: string, pattern: RegExp, group: string): readonly string[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((match) =>\n pipe(\n Option.fromUndefinedOr(match.groups),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])),\n ),\n ),\n Arr.getSomes,\n );\n\nconst namesSibling = (source: string): boolean =>\n pipe(\n [\n ...groupsOf(source, RELATIVE_REFERENCE, NAME_GROUP),\n ...groupsOf(source, DIRNAME_REFERENCE, NAME_GROUP),\n ],\n Arr.some((name) => !TEST_FILE.test(name)),\n );\n\nconst ownerOf = (packages: readonly string[], name: string): Option.Option<string> => {\n const owners = pipe(\n packages,\n Arr.filter((directory) => Str.startsWith(directory)(name)),\n );\n return Arr.last(Arr.sort(owners, byLength));\n};\n\nconst specifiersBeside =\n ({ join, dirname, directory }: Beside) =>\n (manifest: EntryManifest): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(manifest.name),\n Option.map((name) =>\n pipe(\n publicEntriesOf({ manifest, join, packEntries: [] }),\n Arr.filter(({ source }) => dirname(source) === directory),\n Arr.map(({ label }) => Str.replace(ROOT_SUBPATH, name)(label)),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst ownSpecifiers = Effect.fn(\"ownSpecifiers\")(function* ownSpecifiers(\n context: Context,\n test: TestFile,\n) {\n const files = yield* RepositoryFiles;\n const owner = ownerOf(context.packages, test.name);\n if (Option.isNone(owner)) {\n return [];\n }\n const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));\n const join = (target: string): string => files.join(context.root, owner.value, target);\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(specifiersBeside({ join, dirname: files.dirname, directory: test.directory })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst refersToOwnDirectory = Effect.fn(\"refersToOwnDirectory\")(function* refersToOwnDirectory(\n context: Context,\n test: TestFile,\n source: string,\n) {\n if (namesSibling(source)) {\n return true;\n }\n const specifiers = groupsOf(source, MODULE_SPECIFIER, SPECIFIER_GROUP);\n if (Arr.isReadonlyArrayEmpty(specifiers)) {\n return false;\n }\n const own = yield* ownSpecifiers(context, test);\n return pipe(\n specifiers,\n Arr.some((specifier) => pipe(own, Arr.contains(specifier))),\n );\n});\n\nconst refersIn = Effect.fn(\"refersIn\")(function* refersIn(context: Context, test: TestFile) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(test.file);\n if (Option.isNone(source)) {\n return true;\n }\n return yield* refersToOwnDirectory(context, test, source.value);\n});\n\nconst inSeparateTestDirectory = (name: string): boolean =>\n SEPARATE_TEST_DIRECTORY.test(name) || (SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name));\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(context: Context, test: TestFile) {\n if (inSeparateTestDirectory(test.name)) {\n return Option.some(problemFor(test, DIRECTORY_MESSAGE));\n }\n if (!TEST_FILE.test(test.name)) {\n return Option.none<Problem>();\n }\n const refers = yield* refersIn(context, test);\n if (refers) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(test, SIBLING_MESSAGE));\n});\n\n/** @internal */\nexport const checkColocatedTests = Effect.fn(\"checkColocatedTests\")(function* checkColocatedTests(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n const names = pipe(listed, Arr.filter(Str.isNonEmpty));\n const context: Context = {\n root,\n packages: pipe(\n names,\n Arr.filter((name) => files.basename(name) === MANIFEST_FILE),\n Arr.map(Str.replace(MANIFEST_NAME, \"\")),\n ),\n };\n const tests = pipe(\n names,\n Arr.filter((name) => SCRIPT.test(name)),\n Arr.map((name): TestFile => {\n const file = files.join(root, name);\n return { name, base: files.basename(name), file, directory: files.dirname(file) };\n }),\n );\n const found = yield* Effect.forEach(tests, (test) => problemIn(context, test), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst AGENT_DOC = /(?:^|\\/)(?:AGENTS|CLAUDE)\\.md$/u;\nconst READ_CONCURRENCY = 16;\n\nexport const agentDocProblems = Effect.fn(\"agentDocProblems\")(function* agentDocProblems(\n root: string,\n problemIn: (file: string) => (source: string) => Option.Option<Problem>,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const docs = pipe(\n listed,\n Arr.filter((name) => AGENT_DOC.test(name)),\n );\n const found = yield* Effect.forEach(\n docs,\n (name) => {\n const file = files.join(root, name);\n const problemOf = Option.flatMap(problemIn(file));\n return files.readFile(file).pipe(Effect.map(problemOf));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n});\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport { agentDocProblems } from \"#/shared/lib/agent-docs.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nconst RECOMMENDED_LINES = 200;\nconst FIRST = 1;\nconst RULE: RuleName = \"agent-docs-length\";\n\nconst lineCount = (source: string): number => pipe(Str.trimEnd(source), Str.split(\"\\n\")).length;\n\nconst problemFor =\n (file: string) =>\n (lines: number): Option.Option<Problem> => {\n if (lines <= RECOMMENDED_LINES) {\n return Option.none();\n }\n return Option.some({\n file,\n line: RECOMMENDED_LINES + FIRST,\n column: FIRST,\n rule: RULE,\n 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.`,\n });\n };\n\n/** @internal */\nexport const checkAgentDocsLength = (root: string): ReturnType<typeof agentDocProblems> =>\n agentDocProblems(root, (file) => (source) => problemFor(file)(lineCount(source)));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"claude-md-link\";\nconst CLAUDE = \"CLAUDE.md\";\nconst AGENTS = \"AGENTS.md\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\nconst MESSAGE = \"CLAUDE.md must be a symbolic link to AGENTS.md\";\n\n/** @internal */\nexport const checkClaudeLinks = Effect.fn(\"checkClaudeLinks\")(function* checkClaudeLinks(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const [listed, links] = yield* Effect.all([files.listedFiles(root), files.linkedFiles(root)], {\n concurrency: \"unbounded\",\n });\n const problemOf = Effect.fn(\"problemOf\")(function* problemOf(name: string) {\n const file = files.join(root, name);\n const target = yield* files.readLink(file);\n const isLink = pipe(links, Arr.contains(name));\n const pointsElsewhere = pipe(\n target,\n Option.exists((value) => value !== AGENTS),\n );\n return pipe(\n Option.liftPredicate(file, () => !isLink || pointsElsewhere),\n Option.map((path): Problem => ({\n file: path,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n })),\n );\n });\n const claude = pipe(\n listed,\n Arr.filter((name) => files.basename(name) === CLAUDE),\n );\n const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"dangling-link\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\n\nconst holds =\n (target: string) =>\n (name: string): boolean =>\n name === target || Str.startsWith(`${target}${SEPARATOR}`)(name);\n\n/** @internal */\nexport const checkDanglingLinks = Effect.fn(\"checkDanglingLinks\")(function* checkDanglingLinks(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const [links, listed] = yield* Effect.all([files.linkedFiles(root), files.listedFiles(root)], {\n concurrency: \"unbounded\",\n });\n const problemOf = Effect.fn(\"problemOf\")(function* problemOf(name: string) {\n const file = files.join(root, name);\n const link = yield* files.readLink(file);\n return pipe(\n link,\n Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))),\n Option.filter((target) => !pipe(listed, Arr.some(holds(target)))),\n Option.map((target): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n 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.`,\n })),\n );\n });\n const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst ROOT_WORKSPACE = \".\";\nconst FIRST = 1;\nconst SEPARATOR = \"/\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n \":(exclude,attr:linguist-documentation)\",\n];\n\nexport const memberWorkspaces = Effect.fn(\"memberWorkspaces\")(function* memberWorkspaces(\n root: string,\n) {\n const declared = yield* workspaceDirectories(root);\n return pipe(\n declared,\n Arr.filter((workspace) => workspace !== ROOT_WORKSPACE),\n );\n});\n\nexport const memberSources = Effect.fn(\"memberSources\")(function* memberSources(root: string) {\n const files = yield* RepositoryFiles;\n const workspaces = yield* memberWorkspaces(root);\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n return { workspaces, listed };\n});\n\nexport interface Owned {\n readonly workspace: string;\n readonly inner: string;\n}\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nexport const fileProblem = ({\n file,\n rule,\n message,\n}: Readonly<{ file: string; rule: RuleName; message: string }>): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule,\n message,\n});\n\nexport const ownerOf =\n (workspaces: readonly string[]) =>\n (name: string): Option.Option<Owned> =>\n pipe(\n workspaces,\n Arr.filter((workspace) => Str.startsWith(`${workspace}${SEPARATOR}`)(name)),\n (owners) => Arr.last(Arr.sort(owners, byLength)),\n Option.map((workspace) => ({\n workspace,\n inner: Str.slice(workspace.length + SEPARATOR.length)(name),\n })),\n );\n","import { Effect, Option, Result, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { fileProblem } from \"./member-sources.ts\";\n\nconst README_FILE = \"README.md\";\n\ninterface Readme {\n readonly file: string;\n readonly source: string;\n}\n\nexport const readReadme = Effect.fn(\"readReadme\")(function* readReadme({\n root,\n directory,\n rule,\n missingMessage,\n}: Readonly<{ root: string; directory: string; rule: RuleName; missingMessage: string }>) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, README_FILE);\n const text = yield* files.readFile(file);\n return pipe(\n text,\n Option.match({\n onNone: (): Result.Result<Readme, Problem> =>\n Result.fail(fileProblem({ file, rule, message: missingMessage })),\n onSome: (source): Result.Result<Readme, Problem> => Result.succeed({ file, source }),\n }),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Result, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport {\n KeySchema,\n childrenOf,\n keyName,\n owningWorkspace,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { fileProblem } from \"./member-sources.ts\";\nimport { readReadme } from \"./readme-file.ts\";\n\nconst RULE: RuleName = \"deployed-readme\";\nconst ROOT_DIRECTORY = \"\";\nconst READ_CONCURRENCY = 16;\nconst MISSING_MESSAGE =\n \"is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.\";\nconst NO_URL_MESSAGE =\n \"has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.\";\nconst ADDRESS_KEYS = [\"domain\", \"domains\", \"routes\", \"hostname\"];\nconst URL_KEY = \"url\";\nconst STACK_FILE = /(?:^|\\/)alchemy\\.(?![^/]*\\.test\\.)[^/]+\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst URL_PATTERN = /https:\\/\\/[^\\s)>\\]]+/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\n\nconst propertyNamed =\n (names: readonly string[]) =>\n (node: unknown): boolean =>\n Predicate.isReadonlyObject(node) &&\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => Arr.contains(names, keyName(key))),\n );\n\nconst isAddressProperty = propertyNamed(ADDRESS_KEYS);\nconst isUrlProperty = propertyNamed([URL_KEY]);\n\nconst ReturnedObject = Schema.Struct({\n type: Schema.Literal(\"ReturnStatement\"),\n argument: Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n});\n\nconst decodeReturnedObject = Schema.decodeUnknownOption(ReturnedObject);\n\nconst returnsUrl = (node: unknown): boolean =>\n pipe(\n decodeReturnedObject(node),\n Option.exists(({ argument }) => pipe(argument.properties, Arr.some(isUrlProperty))),\n );\n\nconst servesAddress = (node: unknown): boolean =>\n isAddressProperty(node) || returnsUrl(node) || pipe(childrenOf(node), Arr.some(servesAddress));\n\nconst deploysTo = Effect.fn(\"deploysTo\")(function* deploysTo(root: string, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value)) {\n return false;\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return servesAddress(parsed.program);\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, directory: string) {\n const readme = yield* readReadme({\n root,\n directory,\n rule: RULE,\n missingMessage: MISSING_MESSAGE,\n });\n return Result.match(readme, {\n onFailure: Option.some,\n onSuccess: ({ file, source }) =>\n pipe(\n Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)),\n Option.map(() => fileProblem({ file, rule: RULE, message: NO_URL_MESSAGE })),\n ),\n });\n});\n\n/** @internal */\nexport const checkDeployedReadme = Effect.fn(\"checkDeployedReadme\")(function* checkDeployedReadme(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const directories = yield* workspaceDirectories(root);\n const candidates = pipe(\n listed,\n Arr.filter((file) => STACK_FILE.test(file)),\n );\n const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), {\n concurrency: READ_CONCURRENCY,\n });\n const owners = pipe(\n deploying,\n Arr.map((file) =>\n pipe(\n owningWorkspace(directories)(files.dirname(file)),\n Option.getOrElse(() => ROOT_DIRECTORY),\n ),\n ),\n Arr.dedupe,\n );\n const found = yield* Effect.forEach(owners, (directory) => problemIn(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, HashSet, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"nested-docs\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 64;\nconst AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\\.[^/]+)?\\.md$/iu;\nconst WORKSPACE_AGENT_DOC = \"AGENTS.md\";\nconst README = /^README(?:\\.[^/]+)?$/iu;\nconst MANIFEST = \"package.json\";\nconst MISSING_RULE: RuleName = \"workspace-agents-md\";\n\nconst RootConfig = Schema.Struct({\n msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }),\n});\n\nconst taggedError = Schema.TaggedError;\n\nclass RootConfigUnreadable extends taggedError<\n RootConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"RootConfigUnreadable\", { file: Schema.String }) {}\n\nconst isNested = (name: string): boolean => Str.includes(SEPARATOR)(name);\n\nconst problemFor = problemInFile(RULE);\n\nconst AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.\";\nconst WORKSPACE_AGENT_DOCS_MESSAGE =\n \"belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.\";\nconst MISSING_MESSAGE =\n \"has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.\";\nconst README_MESSAGE =\n \"is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.\";\n\ninterface Allowed {\n readonly workspaces: HashSet.HashSet<string>;\n readonly workspaceAgentDocs: boolean;\n}\n\ninterface NestedDoc {\n readonly file: string;\n readonly base: string;\n readonly directory: string;\n}\n\nconst agentDocProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!allowed.workspaceAgentDocs) {\n return Option.some(problemFor(file, `${base} ${AGENT_DOCS_MESSAGE}`));\n }\n if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));\n};\n\nconst readmeProblem = (\n { file, base, directory }: NestedDoc,\n allowed: Allowed,\n): Option.Option<Problem> => {\n if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) {\n return Option.none<Problem>();\n }\n return Option.some(problemFor(file, `${base} ${README_MESSAGE}`));\n};\n\ninterface Workspaces {\n readonly required: boolean;\n readonly directories: readonly string[];\n readonly present: HashSet.HashSet<string>;\n readonly join: (...parts: readonly string[]) => string;\n}\n\nconst missingProblems = ({\n required,\n directories,\n present,\n join,\n}: Workspaces): readonly Problem[] =>\n pipe(\n directories,\n Arr.filter(\n (directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC)),\n ),\n Arr.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST), MISSING_MESSAGE)),\n );\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n allowed: Allowed,\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const doc: NestedDoc = { file, base: files.basename(name), directory: files.dirname(file) };\n if (AGENT_DOCS.test(doc.base)) {\n return agentDocProblem(doc, allowed);\n }\n return readmeProblem(doc, allowed);\n});\n\nconst allowsWorkspaceAgentDocs = Effect.fn(\"allowsWorkspaceAgentDocs\")(\n function* allowsWorkspaceAgentDocs(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return false;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => RootConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(RootConfig)), Option.isSome);\n },\n);\n\n/** @internal */\nexport const checkNestedDocs = Effect.fn(\"checkNestedDocs\")(function* checkNestedDocs(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n const nested = pipe(names, Arr.filter(isNested));\n const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);\n const directories = yield* workspaceDirectories(root);\n const allowed: Allowed = {\n workspaces: pipe(\n directories,\n Arr.map((directory) => files.join(root, directory)),\n HashSet.fromIterable,\n ),\n workspaceAgentDocs,\n };\n const found = yield* Effect.forEach(nested, (name) => problemIn(root, allowed, name), {\n concurrency: READ_CONCURRENCY,\n });\n const missing = missingProblems({\n required: workspaceAgentDocs,\n directories: pipe(\n directories,\n Arr.map((directory) => files.join(root, directory)),\n ),\n present: pipe(\n names,\n Arr.map((name) => files.join(root, name)),\n HashSet.fromIterable,\n ),\n join: files.join,\n });\n return [...Arr.getSomes(found), ...missing];\n});\n","import { Array as Arr, Effect, Option, Result, pipe } from \"effect\";\n\nimport { publishedProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport { JAPANESE } from \"#/shared/config/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { readReadme } from \"./readme-file.ts\";\n\nconst RULE: RuleName = \"published-readme\";\nconst READ_CONCURRENCY = 16;\nconst MESSAGE =\n \"contains Japanese. This package is published to npm, so write its README in English.\";\nconst MISSING_MESSAGE =\n \"is missing. This package is published to npm, so give it an English README.md.\";\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n { directory }: WorkspaceProject,\n) {\n const readme = yield* readReadme({\n root,\n directory,\n rule: RULE,\n missingMessage: MISSING_MESSAGE,\n });\n return Result.match(readme, {\n onFailure: Option.some,\n onSuccess: ({ file, source }) =>\n pipe(\n Option.fromNullishOr(JAPANESE.exec(source)),\n Option.map((found): Problem => {\n const { line, column } = positionOf(source)(found.index);\n return { file, line, column, rule: RULE, message: MESSAGE };\n }),\n ),\n });\n});\n\n/** @internal */\nexport const checkPublishedReadme = Effect.fn(\"checkPublishedReadme\")(\n function* checkPublishedReadme(root: string) {\n const projects = yield* publishedProjects(root);\n const found = yield* Effect.forEach(projects, (project) => problemIn(root, project), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n },\n);\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { publishedProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"published-tests\";\nconst MANIFEST_FILE = \"package.json\";\nconst FILE_START = 1;\nconst TEST_FILE = /\\.test\\.[cm]?[jt]sx?$/u;\nconst MESSAGE =\n \"belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.\";\n\nconst testedIn =\n (listed: readonly string[]) =>\n (prefix: string): boolean =>\n pipe(\n listed,\n Arr.some((file) => Str.startsWith(prefix)(file) && TEST_FILE.test(file)),\n );\n\nconst problemFor = Effect.fn(\"problemFor\")(function* problemFor(\n root: string,\n listed: readonly string[],\n { directory }: WorkspaceProject,\n) {\n const files = yield* RepositoryFiles;\n const absolute = files.join(root, directory);\n const prefix = `${absolute}/`;\n if (testedIn(listed)(prefix)) {\n return Option.none<Problem>();\n }\n return Option.some<Problem>({\n file: files.join(absolute, MANIFEST_FILE),\n line: FILE_START,\n column: FILE_START,\n rule: RULE,\n message: MESSAGE,\n });\n});\n\n/** @internal */\nexport const checkPublishedTests = Effect.fn(\"checkPublishedTests\")(function* checkPublishedTests(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const projects = yield* publishedProjects(root);\n const listed = yield* files.listedFiles(root);\n const absolute = pipe(\n listed,\n Arr.map((file) => files.join(root, file)),\n );\n const found = yield* Effect.forEach(projects, (project) => problemFor(root, absolute, project), {\n concurrency: 1,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"root-docs\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst MARKDOWN = /\\.(?:md|mdx|markdown)$/iu;\nconst ALLOWED =\n /^(?:README(?:\\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\\.(?:md|mdx|markdown)$/iu;\nconst MESSAGE =\n \"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.\";\n\nconst isStrayRootDoc = (name: string): boolean =>\n !Str.includes(SEPARATOR)(name) && MARKDOWN.test(name) && !ALLOWED.test(name);\n\n/** @internal */\nexport const checkRootDocs = Effect.fn(\"checkRootDocs\")(function* checkRootDocs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.filter(isStrayRootDoc),\n Arr.map((name): Problem => ({\n file: files.join(root, name),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${name} ${MESSAGE}`,\n })),\n );\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { namedWorkspaces, patternOf } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-readme\";\nconst ROOT_DOC = /^(?:README(?:\\.[^/]+)?|AGENTS\\.md|CLAUDE\\.md)$/iu;\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst CHECK_POLICY = \"@r_masseater/msch\";\nconst MARKETPLACE = \".claude-plugin/marketplace.json\";\nconst RELATIVE = /^\\.\\//u;\nconst MarketplacePlugin = Schema.Struct({\n name: Schema.optional(Schema.String),\n source: Schema.Unknown,\n});\nconst Marketplace = Schema.fromJsonString(\n Schema.Struct({ plugins: Schema.Array(MarketplacePlugin) }),\n);\n\ninterface Plugins {\n readonly directories: readonly string[];\n readonly names: readonly string[];\n}\n\nconst NO_PLUGINS: Plugins = { directories: [], names: [] };\n\nconst isCheckPolicy = ({ packageName }: NamedWorkspace): boolean =>\n Option.contains(packageName, CHECK_POLICY);\n\nconst messageFor = (directory: string): string =>\n `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.`;\n\nconst pluginsOf = (plugins: readonly (typeof MarketplacePlugin.Type)[]): Plugins => {\n const directories = pipe(\n plugins,\n Arr.map(({ source }) => source),\n Arr.filter(Predicate.isString),\n Arr.map(Str.replace(RELATIVE, \"\")),\n );\n const segments = pipe(directories, Arr.map(baseName));\n const names = pipe(\n plugins,\n Arr.map(({ name }) => name),\n Arr.filter(Predicate.isString),\n Arr.appendAll(segments),\n Arr.dedupe,\n );\n return { directories, names };\n};\n\nconst marketplacePlugins = Effect.fn(\"marketplacePlugins\")(function* marketplacePlugins(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, MARKETPLACE));\n return pipe(\n text,\n Option.flatMap(Schema.decodeOption(Marketplace)),\n Option.map(({ plugins }) => pluginsOf(plugins)),\n Option.getOrElse(() => NO_PLUGINS),\n );\n});\n\nconst isPluginName =\n (plugins: Plugins) =>\n (name: string): boolean =>\n Arr.contains(plugins.names, name);\n\nconst ownNames = (plugins: Plugins, names: readonly string[]): readonly string[] => {\n const ownName = Predicate.not(isPluginName(plugins));\n return pipe(names, Arr.filter(ownName));\n};\n\nconst patternFor =\n (plugins: Plugins) =>\n ({ directory, names }: NamedWorkspace): RegExp =>\n patternOf(\n Option.match(\n Arr.findFirst(plugins.directories, (plugin) => plugin === directory),\n {\n onNone: () => ownNames(plugins, names),\n onSome: () => [directory],\n },\n ),\n );\n\nconst problemsIn =\n (file: string, source: string, plugins: Plugins) =>\n (workspace: NamedWorkspace): readonly Problem[] => {\n const message = messageFor(workspace.directory);\n const at = positionOf(source);\n const pattern = patternFor(plugins)(workspace);\n return pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.map((found) => problemAtPosition(RULE)(file, at(found.index ?? START), message)),\n );\n };\n\nconst problemsInReadme = Effect.fn(\"problemsInReadme\")(function* problemsInReadme(\n file: string,\n workspaces: readonly NamedWorkspace[],\n plugins: Plugins,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n return pipe(\n text,\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => pipe(workspaces, Arr.flatMap(problemsIn(file, source, plugins))),\n }),\n );\n});\n\n/** @internal */\nexport const checkRootReadme = Effect.fn(\"checkRootReadme\")(function* checkRootReadme(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const readmes = pipe(\n names,\n Arr.filter((name) => ROOT_DOC.test(name)),\n );\n const named = yield* namedWorkspaces(root);\n const workspaces = pipe(\n named,\n Arr.filter((workspace) => !isCheckPolicy(workspace)),\n );\n const plugins = yield* marketplacePlugins(root);\n const found = yield* Effect.forEach(\n readmes,\n (name) => problemsInReadme(files.join(root, name), workspaces, plugins),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkAgentDocsLength } from \"./agent-docs-length.ts\";\nimport { checkClaudeLinks } from \"./claude-link.ts\";\nimport { checkDanglingLinks } from \"./dangling-links.ts\";\nimport { checkDeployedReadme } from \"./deployed-readme.ts\";\nimport { checkNestedDocs } from \"./nested-docs.ts\";\nimport { checkPublishedReadme } from \"./published-readme.ts\";\nimport { checkPublishedTests } from \"./published-tests.ts\";\nimport { checkRootDocs } from \"./root-docs.ts\";\nimport { checkRootReadme } from \"./root-readme.ts\";\n\n/** @internal */\nexport const checkDocPlacement = Effect.fn(\"checkDocPlacement\")(function* checkDocPlacement(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkNestedDocs(root),\n checkClaudeLinks(root),\n checkRootReadme(root),\n checkRootDocs(root),\n checkAgentDocsLength(root),\n checkDanglingLinks(root),\n checkPublishedReadme(root),\n checkDeployedReadme(root),\n checkPublishedTests(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { readManifest } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"docs-mirror\";\nconst DOC = /(?:^|\\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\\.md$/u;\nconst MIRROR_LIMIT = 3;\nconst READ_CONCURRENCY = 16;\n\ninterface Workspace {\n readonly directory: string;\n readonly names: readonly string[];\n}\n\ninterface Mention {\n readonly directory: string;\n readonly offset: number;\n}\n\nconst SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\nconst BEFORE = String.raw`(?<![\\w@/.-])`;\nconst AFTER = String.raw`(?![\\w@.-])`;\n\nconst patternOf = (name: string): RegExp =>\n new RegExp(`${BEFORE}${Str.replaceAll(SPECIAL, String.raw`\\$&`)(name)}${AFTER}`, \"u\");\n\nconst byOffset = Order.mapInput(Order.Number, (mention: Mention) => mention.offset);\n\nconst mentionOf =\n (source: string, directory: string) =>\n (name: string): readonly Mention[] =>\n pipe(\n Option.fromNullishOr(patternOf(name).exec(source)),\n Option.map(({ index }) => ({ directory, offset: index })),\n Option.toArray,\n );\n\nconst firstMention = (source: string, workspace: Workspace): Option.Option<Mention> => {\n const mentions = pipe(workspace.names, Arr.flatMap(mentionOf(source, workspace.directory)));\n return Arr.head(Arr.sort(mentions, byOffset));\n};\n\nconst ownerOf =\n (doc: string) =>\n (workspace: Workspace): boolean =>\n Str.startsWith(`${workspace.directory}/`)(doc);\n\nconst describe = (mentions: readonly Mention[]): string =>\n pipe(\n mentions,\n Arr.map(({ directory }) => `\\`${directory}\\``),\n Arr.join(\", \"),\n );\n\nconst problemFor = (\n file: string,\n source: string,\n mentions: readonly Mention[],\n): readonly Problem[] =>\n pipe(\n Arr.head(mentions),\n Option.filter(() => mentions.length >= MIRROR_LIMIT),\n Option.map(({ offset }): Problem => {\n const { line, column } = positionOf(source)(offset);\n return {\n file,\n line,\n column,\n rule: RULE,\n message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`,\n };\n }),\n Option.toArray,\n );\n\nconst othersIn = (doc: string, workspaces: readonly Workspace[]): readonly Workspace[] =>\n pipe(\n workspaces,\n Arr.filter((workspace) => !ownerOf(doc)(workspace)),\n );\n\nconst problemIn =\n (workspaces: readonly Workspace[]) =>\n (doc: string, file: string, source: string): readonly Problem[] => {\n const mentions = pipe(\n othersIn(doc, workspaces),\n Arr.flatMap((workspace) => Option.toArray(firstMention(source, workspace))),\n );\n return problemFor(file, source, Arr.sort(mentions, byOffset));\n };\n\nconst workspacesOf = Effect.fn(\"workspacesOf\")(function* workspacesOf(root: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(root);\n return yield* Effect.forEach(\n directories,\n (directory) =>\n readManifest(files.join(root, directory)).pipe(\n Effect.map((manifest): Workspace => ({\n directory,\n names: [\n directory,\n ...pipe(\n manifest,\n Option.flatMap(({ name }) => Option.fromUndefinedOr(name)),\n Option.toArray,\n ),\n ],\n })),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n});\n\n/** @internal */\nexport const checkDocsMirror = Effect.fn(\"checkDocsMirror\")(function* checkDocsMirror(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const workspaces = yield* workspacesOf(root);\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((name) => DOC.test(name)),\n ),\n (doc) => {\n const file = files.join(root, doc);\n return files.readFile(file).pipe(\n Effect.map((source) =>\n Option.match(source, {\n onNone: () => [],\n onSome: (text) => problemIn(workspaces)(doc, file, text),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"ignored-sources\";\nconst SOURCES = [\":(glob)**/src/**\", \":(exclude,glob)**/node_modules/**\"];\nconst FIRST = 1;\nconst MESSAGE =\n \"is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.\";\n\n/** @internal */\nexport const checkIgnoredSources = Effect.fn(\"checkIgnoredSources\")(function* checkIgnoredSources(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredFiles(root, SOURCES);\n return pipe(\n ignored,\n Arr.map((file): Problem => ({\n file: files.join(root, file),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n })),\n );\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, EntryManifestJson, publicEntriesOf } from \"#/entities/package/index.ts\";\nimport type { PublicEntry } from \"#/entities/package/index.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { fileProblem as problemAt, memberWorkspaces } from \"./member-sources.ts\";\n\nconst ENTRY_RULE: RuleName = \"public-entry\";\nconst PUBLIC_ENTRY =\n /^(?:bin\\/[^/]+|src\\/(?:app\\/[^/]+|(?:pages|widgets|features|entities)\\/[^/]+\\/index(?:\\.[a-z]+)*\\.tsx?|shared\\/[^/]+\\/index(?:\\.[a-z]+)*\\.tsx?|shared\\/(?:ui|lib)\\/.+))$/u;\n\nconst ENTRY_MESSAGE =\n \"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.\";\n\nconst decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);\n\nconst entryProblems = Effect.fn(\"entryProblems\")(function* entryProblems(\n root: string,\n workspace: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = files.join(root, workspace);\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const join = (target: string): string => files.join(directory, target);\n return pipe(\n text,\n Option.flatMap(decodeEntryManifest),\n Option.map((manifest) => publicEntriesOf({ manifest, join, packEntries: [] })),\n Option.getOrElse((): readonly PublicEntry[] => []),\n Arr.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))),\n Arr.map(({ label, source }) =>\n problemAt({ file: source, rule: ENTRY_RULE, message: `${label} ${ENTRY_MESSAGE}` }),\n ),\n );\n});\n\n/** @internal */\nexport const checkPublicEntries = Effect.fn(\"checkPublicEntries\")(function* checkPublicEntries(\n root: string,\n) {\n const workspaces = yield* memberWorkspaces(root);\n const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems(root, workspace), {\n concurrency: 1,\n });\n return Arr.flatten(entries);\n});\n","import { Array as Arr, Option, Order, String as Str, pipe } from \"effect\";\n\nexport const LAYERS: readonly string[] = [\n \"app\",\n \"pages\",\n \"widgets\",\n \"features\",\n \"entities\",\n \"shared\",\n];\nexport const SEPARATOR = \"/\";\nexport const SOURCE_DIRECTORY = \"src\";\nexport const RUST_FILE = /\\.rs$/u;\nexport const BINARY = /^src\\/bin\\/[^/]+\\.rs$/u;\nexport const SLICE_DEPTH = 2;\nexport const NEXT = 1;\n\nconst MANIFEST = /(?:^|\\/)Cargo\\.toml$/u;\nconst MODULE_INDEX = \"mod\";\nconst CRATE_ROOTS: readonly string[] = [\"src/lib.rs\", \"src/main.rs\"];\nconst OUTSIDE_ALLOWED = /^(?:build\\.rs|benches\\/.+)$/u;\nconst SEPARATE_TEST = /^tests\\/.+$/u;\nconst SLICED_LAYERS: readonly string[] = [\"pages\", \"widgets\", \"features\", \"entities\", \"shared\"];\nconst LAYER_DEPTH = 1;\nconst SOURCE_PREFIX = `${SOURCE_DIRECTORY}${SEPARATOR}`;\nconst ROOT_CRATE = \"\";\n\nexport interface RustSource {\n readonly crate: string;\n readonly inner: string;\n readonly file: string;\n}\n\nexport type Kind = \"root\" | \"layer\" | \"module\" | \"test\" | \"skipped\" | \"misplaced\";\n\nconst byLength = Order.mapInput(Order.Number, (directory: string) => directory.length);\n\nexport const crateDirectories = (listed: readonly string[]): readonly string[] =>\n pipe(\n listed,\n Arr.filter((name) => MANIFEST.test(name)),\n Arr.map((name) => Str.replace(MANIFEST, \"\")(name)),\n );\n\nconst ownedBy = (crate: string, name: string): Omit<RustSource, \"file\"> => {\n if (crate === ROOT_CRATE) {\n return { crate, inner: name };\n }\n return { crate, inner: Str.slice(crate.length + SEPARATOR.length)(name) };\n};\n\nexport const crateOf =\n (crates: readonly string[]) =>\n (name: string): Option.Option<Omit<RustSource, \"file\">> =>\n pipe(\n crates,\n Arr.filter((crate) => crate === ROOT_CRATE || Str.startsWith(`${crate}${SEPARATOR}`)(name)),\n Arr.match({\n onEmpty: () => Option.none<string>(),\n onNonEmpty: (owners) => Option.some(Arr.max(owners, byLength)),\n }),\n Option.map((crate) => ownedBy(crate, name)),\n );\n\nexport const modulePathOf = (inner: string): readonly string[] => {\n const parts = Str.split(\n Str.replace(RUST_FILE, \"\")(Str.slice(SOURCE_PREFIX.length)(inner)),\n SEPARATOR,\n );\n if (Option.contains(Arr.last(parts), MODULE_INDEX)) {\n return Arr.dropRight(parts, NEXT);\n }\n return parts;\n};\n\nconst sourceKindOf = (inner: string): Kind => {\n const path = modulePathOf(inner);\n if (!Option.exists(Arr.head(path), (layer) => Arr.contains(LAYERS, layer))) {\n return \"misplaced\";\n }\n if (path.length === LAYER_DEPTH) {\n return \"layer\";\n }\n return \"module\";\n};\n\nexport const kindOf = (inner: string): Kind => {\n if (Arr.contains(CRATE_ROOTS, inner) || BINARY.test(inner)) {\n return \"root\";\n }\n if (SEPARATE_TEST.test(inner)) {\n return \"test\";\n }\n if (OUTSIDE_ALLOWED.test(inner)) {\n return \"skipped\";\n }\n if (!Str.startsWith(SOURCE_PREFIX)(inner)) {\n return \"misplaced\";\n }\n return sourceKindOf(inner);\n};\n\nexport const isSliceIndex = (modulePath: readonly string[]): boolean =>\n modulePath.length === SLICE_DEPTH &&\n Option.exists(Arr.head(modulePath), (layer) => Arr.contains(SLICED_LAYERS, layer));\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { SyntaxNode } from \"#/shared/lib/tree-sitter.ts\";\n\nexport interface RustItem {\n readonly kind: string;\n readonly name: Option.Option<string>;\n readonly inline: boolean;\n readonly visible: boolean;\n readonly line: number;\n readonly column: number;\n}\n\nexport interface RustFile {\n readonly items: readonly RustItem[];\n readonly replacesAllocator: boolean;\n}\n\nconst IGNORED_ITEMS: readonly string[] = [\"line_comment\", \"block_comment\"];\nconst NEXT = 1;\nconst ALLOCATOR = \"global_allocator\";\n\nconst field = (node: SyntaxNode, name: string): Option.Option<SyntaxNode> =>\n Option.fromNullishOr(node.childForFieldName(name));\n\nconst namedChildren = (node: SyntaxNode): readonly SyntaxNode[] =>\n pipe(\n node.namedChildren,\n Arr.flatMap((child) => Option.toArray(Option.fromNullishOr(child))),\n );\n\nconst itemOf = (node: SyntaxNode): RustItem => ({\n kind: node.type,\n name: Option.map(field(node, \"name\"), (name) => name.text),\n inline: Option.isSome(field(node, \"body\")),\n visible: Arr.some(namedChildren(node), (child) => child.type === \"visibility_modifier\"),\n line: node.startPosition.row + NEXT,\n column: node.startPosition.column + NEXT,\n});\n\nconst replacesAllocator = (root: SyntaxNode): boolean =>\n pipe(\n root.descendantsOfType(\"attribute\"),\n Arr.flatMap((node) => Option.toArray(Option.fromNullishOr(node))),\n Arr.some((attribute) =>\n Option.exists(Arr.head(namedChildren(attribute)), (name) => name.text === ALLOCATOR),\n ),\n );\n\nexport const readRustFile = (root: SyntaxNode): RustFile => ({\n items: pipe(\n namedChildren(root),\n Arr.filter((node) => !Arr.contains(IGNORED_ITEMS, node.type)),\n Arr.map(itemOf),\n ),\n replacesAllocator: replacesAllocator(root),\n});\n","","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport englishVerbs from \"./english-verbs.json\" with { type: \"json\" };\nimport { fileProblem, memberSources, ownerOf } from \"./member-sources.ts\";\nimport type { Owned } from \"./member-sources.ts\";\n\nconst SLICE_RULE: RuleName = \"feature-slice-name\";\nconst ENTRY_RULE: RuleName = \"deploy-entry-name\";\nconst SEGMENT_RULE: RuleName = \"slice-segment-name\";\nconst SEPARATOR = \"/\";\nconst NEXT = 1;\nconst WORD_SEPARATOR = \"-\";\nconst MINIMUM_WORDS = 2;\nconst FEATURES = \"src/features/\";\nconst SOURCE = \"src/\";\nconst SEGMENTS: ReadonlySet<string> = new Set([\"ui\", \"model\", \"api\", \"lib\", \"config\", \"@x\"]);\nconst DEPLOY_MARKER = /(?:^|[.-])entrypoints?(?=[.-]|$)|\\.worker(?=\\.)/iu;\nconst INDEX = /\\/index(?:\\.[a-z]+)*\\.[cm]?[jt]sx?$/u;\nconst SCRIPT = /\\.[cm]?[jt]sx?$/u;\nconst VERBS: ReadonlySet<string> = new Set(englishVerbs);\n\nconst SLICE_MESSAGE =\n \"is not named <verb>-<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check-layout, sync-manuscripts).\";\nconst SEGMENT_MESSAGE =\n \"is a folder in a slice that is not one of the segments ui, model, api, lib or config. Name the segment after its purpose and put the code in one of them; a segment that grows holds folders of its own.\";\nconst ENTRY_MESSAGE =\n \"is named after where it is deployed. Name it after what the code does; the Alchemy resource that deploys it decides which file is the entry.\";\n\nexport const isVerbObjectBy =\n (separator: string) =>\n (slice: string): boolean => {\n const words = Str.split(slice, separator);\n return (\n words.length >= MINIMUM_WORDS && Option.exists(Arr.head(words), (word) => VERBS.has(word))\n );\n };\n\nconst isVerbObject = isVerbObjectBy(WORD_SEPARATOR);\n\nconst misnamedSlice = ({ workspace, inner }: Owned): Option.Option<string> =>\n pipe(\n Option.liftPredicate(inner, (path) => Str.startsWith(FEATURES)(path) && SCRIPT.test(path)),\n Option.flatMap((path) => Arr.head(Str.split(Str.slice(FEATURES.length)(path), SEPARATOR))),\n Option.filter((slice) => !isVerbObject(slice)),\n Option.map((slice) => `${workspace}${SEPARATOR}${FEATURES}${slice}`),\n );\n\nconst SLICE_LAYERS: readonly string[] = [\"features\", \"entities\", \"widgets\", \"pages\"];\nconst SLICE_DEPTH = 3;\nconst GROUPED_SLICE_DEPTH = 4;\nconst SLICE_DEPTHS: readonly number[] = [SLICE_DEPTH, GROUPED_SLICE_DEPTH];\n\nconst pathPrefix = (parts: readonly string[], depth: number): string =>\n Arr.join(Arr.take(parts, depth), SEPARATOR);\n\nconst isInSliceLayer = (parts: readonly string[]): boolean => {\n const [source, layer] = parts;\n return `${source}${SEPARATOR}` === SOURCE && Arr.contains(SLICE_LAYERS, layer ?? \"\");\n};\n\nconst indexedSlice = (owned: Owned): Option.Option<string> => {\n const parts = Str.split(owned.inner, SEPARATOR);\n const depth = parts.length - NEXT;\n return pipe(\n Option.liftPredicate(\n depth,\n () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Arr.contains(SLICE_DEPTHS, depth),\n ),\n Option.map(() => `${owned.workspace}${SEPARATOR}${pathPrefix(parts, depth)}`),\n );\n};\n\nconst misnamedSegment =\n (slices: ReadonlySet<string>) =>\n ({ workspace, inner }: Owned): Option.Option<string> => {\n const parts = Str.split(inner, SEPARATOR);\n const insideSlice = (depth: number): boolean =>\n slices.has(`${workspace}${SEPARATOR}${pathPrefix(parts, depth)}`);\n const isSegmentFolder = (depth: number): boolean =>\n parts.length > depth + NEXT && SCRIPT.test(inner) && !SEGMENTS.has(parts[depth] ?? \"\");\n return pipe(\n SLICE_DEPTHS,\n Arr.findFirst(insideSlice),\n Option.filter(isSegmentFolder),\n Option.map((depth) => `${workspace}${SEPARATOR}${pathPrefix(parts, depth + NEXT)}`),\n );\n };\n\nconst deployNamed = ({ workspace, inner }: Owned): Option.Option<string> => {\n if (!Str.startsWith(SOURCE)(inner)) {\n return Option.none();\n }\n const segments = Str.split(inner, SEPARATOR);\n return pipe(\n Arr.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)),\n Option.map(\n (index) => `${workspace}${SEPARATOR}${Arr.join(Arr.take(segments, index + NEXT), SEPARATOR)}`,\n ),\n );\n};\n\n/** @internal */\nexport const checkSourceNames = Effect.fn(\"checkSourceNames\")(function* checkSourceNames(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const { workspaces, listed } = yield* memberSources(root);\n const owned = pipe(listed, Arr.map(ownerOf(workspaces)), Arr.getSomes);\n const slices: ReadonlySet<string> = new Set(pipe(owned, Arr.map(indexedSlice), Arr.getSomes));\n const report =\n (rule: RuleName, message: string) =>\n (found: readonly string[]): readonly Problem[] =>\n pipe(\n Arr.dedupe(found),\n Arr.map((name) => fileProblem({ file: files.join(root, name), rule, message })),\n );\n const misnamedSlices = pipe(owned, Arr.map(misnamedSlice), Arr.getSomes);\n const misnamedSegments = pipe(owned, Arr.map(misnamedSegment(slices)), Arr.getSomes);\n const deployNames = pipe(owned, Arr.map(deployNamed), Arr.getSomes);\n return [\n ...report(SLICE_RULE, SLICE_MESSAGE)(misnamedSlices),\n ...report(SEGMENT_RULE, SEGMENT_MESSAGE)(misnamedSegments),\n ...report(ENTRY_RULE, ENTRY_MESSAGE)(deployNames),\n ];\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Position, Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { Language } from \"#/shared/lib/tree-sitter.ts\";\n\nimport { fileProblem } from \"./member-sources.ts\";\nimport {\n BINARY,\n LAYERS,\n RUST_FILE,\n SLICE_DEPTH,\n SOURCE_DIRECTORY,\n crateDirectories,\n crateOf,\n isSliceIndex,\n kindOf,\n modulePathOf,\n} from \"./rust-layout.ts\";\nimport type { Kind, RustSource } from \"./rust-layout.ts\";\nimport { readRustFile } from \"./rust-syntax.ts\";\nimport type { RustFile, RustItem } from \"./rust-syntax.ts\";\nimport { isVerbObjectBy } from \"./source-names.ts\";\n\nconst LAYERED_RULE: RuleName = \"layered-source\";\nconst ENTRY_RULE: RuleName = \"public-entry\";\nconst TEST_RULE: RuleName = \"colocated-test\";\nconst SLICE_RULE: RuleName = \"feature-slice-name\";\nconst GRAMMAR = \"rust\";\nconst WORD_SEPARATOR = \"_\";\nconst FEATURES = \"features\";\nconst MAIN = \"main\";\nconst MAIN_FILE = \"src/main.rs\";\nconst ROOT_ITEMS: readonly string[] = [\n \"use_declaration\",\n \"attribute_item\",\n \"inner_attribute_item\",\n \"extern_crate_declaration\",\n];\nconst LAYER_ITEMS: readonly string[] = [\n \"use_declaration\",\n \"attribute_item\",\n \"inner_attribute_item\",\n];\nconst READ_CONCURRENCY = 64;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst NONE: readonly Problem[] = [];\n\nconst ROOT_MESSAGE =\n \"defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.\";\nconst LAYER_INDEX_MESSAGE =\n \"defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.\";\nconst ENTRY_MESSAGE =\n \"makes an inner module of a slice public. Declare it with plain mod and re-export what other slices use with pub use from the slice module.\";\nconst TEST_MESSAGE =\n \"sits in a separate test directory. Put the test next to the code it tests as a #[cfg(test)] module; only a test that replaces the global allocator needs its own binary in tests/.\";\nconst SLICE_MESSAGE =\n \"is not named <verb>_<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check_layout, sync_manuscripts).\";\n\nconst isFeatureName = isVerbObjectBy(WORD_SEPARATOR);\n\ntype Join = (...segments: readonly string[]) => string;\n\ninterface Read {\n readonly source: RustSource;\n readonly parsed: RustFile;\n}\n\nconst itemProblem =\n (file: string, rule: RuleName, message: string) =>\n (position: Readonly<Position>): Problem =>\n problemAtPosition(rule)(file, position, message);\n\nconst isRootItem =\n (inner: string) =>\n (item: RustItem): boolean => {\n if (Arr.contains(ROOT_ITEMS, item.kind)) {\n return true;\n }\n if (item.kind === \"mod_item\") {\n return !item.inline && Option.exists(item.name, (name) => Arr.contains(LAYERS, name));\n }\n return (\n item.kind === \"function_item\" &&\n (inner === MAIN_FILE || BINARY.test(inner)) &&\n Option.contains(item.name, MAIN)\n );\n };\n\nconst isLayerItem = (item: RustItem): boolean =>\n Arr.contains(LAYER_ITEMS, item.kind) || (item.kind === \"mod_item\" && !item.inline);\n\nconst entryProblems = (\n file: string,\n modulePath: readonly string[],\n parsed: RustFile,\n): readonly Problem[] => {\n if (!isSliceIndex(modulePath)) {\n return NONE;\n }\n return pipe(\n parsed.items,\n Arr.filter((item) => item.kind === \"mod_item\" && item.visible),\n Arr.map(itemProblem(file, ENTRY_RULE, ENTRY_MESSAGE)),\n );\n};\n\nconst moduleProblems = ({ source, parsed }: Read): readonly Problem[] =>\n entryProblems(source.file, modulePathOf(source.inner), parsed);\n\nconst testProblems = ({ source, parsed }: Read): readonly Problem[] => {\n if (parsed.replacesAllocator) {\n return NONE;\n }\n return [fileProblem({ file: source.file, rule: TEST_RULE, message: TEST_MESSAGE })];\n};\n\nconst strayItems = (\n { source, parsed }: Read,\n allowed: (item: RustItem) => boolean,\n message: string,\n): readonly Problem[] =>\n pipe(\n parsed.items,\n Arr.filter((item) => !allowed(item)),\n Arr.map(itemProblem(source.file, LAYERED_RULE, message)),\n );\n\nconst PROBLEMS: Readonly<Record<Kind, (read: Read) => readonly Problem[]>> = {\n root: (read) => strayItems(read, isRootItem(read.source.inner), ROOT_MESSAGE),\n layer: (read) => strayItems(read, isLayerItem, LAYER_INDEX_MESSAGE),\n test: testProblems,\n module: moduleProblems,\n skipped: () => NONE,\n misplaced: () => NONE,\n};\n\nconst problemsOf = (read: Read): readonly Problem[] => PROBLEMS[kindOf(read.source.inner)](read);\n\nconst misnamedSlice = (\n { crate, inner }: RustSource,\n root: string,\n join: Join,\n): Option.Option<string> => {\n const modulePath = modulePathOf(inner);\n return pipe(\n Option.liftPredicate(modulePath, (path) => path.length >= SLICE_DEPTH),\n Option.filter((path) => Option.contains(Arr.head(path), FEATURES)),\n Option.flatMap((path) => Arr.last(Arr.take(path, SLICE_DEPTH))),\n Option.filter((slice) => !isFeatureName(slice)),\n Option.map((slice) => join(root, crate, SOURCE_DIRECTORY, FEATURES, slice)),\n );\n};\n\nconst sliceNameProblems = (\n root: string,\n join: Join,\n sources: readonly RustSource[],\n): readonly Problem[] =>\n pipe(\n sources,\n Arr.filter(({ inner }) => kindOf(inner) === \"module\"),\n Arr.flatMap((source) => Option.toArray(misnamedSlice(source, root, join))),\n Arr.dedupe,\n Arr.map((file) => fileProblem({ file, rule: SLICE_RULE, message: SLICE_MESSAGE })),\n );\n\nconst parsedWith =\n (language: Language) =>\n (source: RustSource, text: string): Option.Option<Read> =>\n Option.map(readTree({ language, source: text, read: readRustFile }), (parsed) => ({\n source,\n parsed,\n }));\n\nconst isRead = ({ inner }: RustSource): boolean => {\n const kind = kindOf(inner);\n return kind !== \"misplaced\" && kind !== \"skipped\";\n};\n\nconst rustSources = Effect.fn(\"rustSources\")(function* rustSources(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, EXCLUDED);\n const owner = crateOf(crateDirectories(listed));\n return pipe(\n listed,\n Arr.filter((name) => RUST_FILE.test(name)),\n Arr.flatMap((name) =>\n Option.toArray(\n Option.map(owner(name), (owned) => ({ ...owned, file: files.join(root, name) })),\n ),\n ),\n );\n});\n\n/** @internal */\nexport const checkRustModules = Effect.fn(\"checkRustModules\")(function* checkRustModules(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const sources = yield* rustSources(root);\n if (!Arr.isReadonlyArrayNonEmpty(sources)) {\n return NONE;\n }\n const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);\n const parse = parsedWith(language);\n const read = yield* Effect.forEach(\n pipe(sources, Arr.filter(isRead)),\n (source) =>\n files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))),\n { concurrency: READ_CONCURRENCY },\n );\n return [\n ...sliceNameProblems(root, files.join, sources),\n ...Arr.flatMap(Arr.getSomes(read), problemsOf),\n ];\n});\n","import { Array as Arr, Effect, Option } from \"effect\";\n\nimport { shadcnUiOf } from \"#/entities/workspace/index.ts\";\nimport type { ShadcnUi } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"shadcn-ui-alias\";\nconst FIRST = 1;\n\nconst problemOf = (directory: string, { file, alias }: ShadcnUi): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `aliases.ui \"${alias}\" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a \"#/\" import, such as \"#/shared/ui\", and map \"#/*\" to \"./src/*\".`,\n});\n\n/** @internal */\nexport const shadcnAliasProblems = Effect.fn(\"shadcnAliasProblems\")(function* shadcnAliasProblems(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const found = yield* shadcnUiOf(root, directory);\n if (Option.isNone(found)) {\n return Arr.empty<Problem>();\n }\n const resolved = yield* Option.match(found.value.target, {\n onNone: () => Effect.succeed(false),\n onSome: (target) =>\n files\n .isDirectory(files.join(root, directory, target))\n .pipe(Effect.map(Option.getOrElse(() => false))),\n });\n if (resolved) {\n return Arr.empty<Problem>();\n }\n return [problemOf(directory, found.value)];\n});\n","import { Array as Arr, Effect, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { memberWorkspaces } from \"./member-sources.ts\";\nimport { shadcnAliasProblems } from \"./shadcn-ui-alias.ts\";\n\nconst ALIAS_RULE: RuleName = \"source-alias\";\nconst SOURCE_ALIAS = \"#/*\";\nconst SOURCE_TARGET = \"./src/*\";\nconst SOURCE_PREFIX = /^\\.\\/src(?:\\/|$)/u;\n\nconst 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.`;\n\nconst Manifest = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\nconst targetsOf = (target: unknown): readonly string[] => {\n if (Predicate.isString(target)) {\n return [target];\n }\n if (Predicate.isObject(target)) {\n return pipe(Rec.values(target), Arr.flatMap(targetsOf));\n }\n return [];\n};\n\nconst intoSource = ([key, target]: readonly [string, unknown]): boolean =>\n !(\n key === SOURCE_ALIAS &&\n pipe(\n targetsOf(target),\n Arr.every((path) => path === SOURCE_TARGET),\n )\n ) &&\n pipe(\n targetsOf(target),\n Arr.some((path) => SOURCE_PREFIX.test(path)),\n );\n\nconst aliasProblems = Effect.fn(\"aliasProblems\")(function* aliasProblems(\n root: string,\n workspace: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = files.join(root, workspace, MANIFEST_FILE);\n const text = yield* files.readFile(manifest);\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)),\n Option.map((imports): readonly (readonly [string, unknown])[] => Rec.toEntries(imports)),\n Option.getOrElse((): readonly (readonly [string, unknown])[] => Arr.empty()),\n Arr.filter(intoSource),\n Arr.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `\"${key}\" ${ALIAS_MESSAGE}`)),\n );\n});\n\n/** @internal */\nexport const checkSourceAliases = Effect.fn(\"checkSourceAliases\")(function* checkSourceAliases(\n root: string,\n) {\n const workspaces = yield* memberWorkspaces(root);\n const found = yield* Effect.forEach(\n workspaces,\n (workspace) =>\n Effect.all([aliasProblems(root, workspace), shadcnAliasProblems(root, workspace)], {\n concurrency: 1,\n }),\n { concurrency: 1 },\n );\n return pipe(found, Arr.flatten, Arr.flatten);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkColocatedGitPatterns } from \"./colocated-git-patterns.ts\";\nimport { checkColocatedTests } from \"./colocated-tests.ts\";\nimport { checkDocPlacement } from \"./doc-placement.ts\";\nimport { checkDocsMirror } from \"./docs-mirror.ts\";\nimport { checkIgnoredSources } from \"./ignored-sources.ts\";\nimport { checkPublicEntries } from \"./public-entries.ts\";\nimport { checkRustModules } from \"./rust-modules.ts\";\nimport { checkSourceAliases } from \"./source-aliases.ts\";\nimport { checkSourceNames } from \"./source-names.ts\";\n\n/** @internal */\nexport const checkPlacement = Effect.fn(\"checkPlacement\")(function* checkPlacement(root: string) {\n const found = yield* Effect.all(\n [\n checkDocPlacement(root),\n checkColocatedTests(root),\n checkPublicEntries(root),\n checkRustModules(root),\n checkSourceAliases(root),\n checkSourceNames(root),\n checkColocatedGitPatterns(root),\n checkIgnoredSources(root),\n checkDocsMirror(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE, targetsIn } from \"#/entities/package/index.ts\";\nimport {\n nestedValues,\n RUN_TASKS,\n stringsIn,\n workspaceConfigOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { FoundString } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst OUTSIDE_BIN: RuleName = \"command-outside-bin\";\nconst UNRUN: RuleName = \"unrun-command\";\nconst SCRIPTS: RuleName = \"scripts-directory\";\nconst BIN = \"bin\";\nconst SCRIPTS_DIRECTORY = \"scripts\";\nconst WORKFLOW_DIRECTORY = \".github/\";\nconst SEPARATOR = \"/\";\nconst CURRENT = \"./\";\nconst READ_CONCURRENCY = 8;\nconst FIRST = 1;\nconst RUN_FILE =\n /(?:^|[\\s;&|(])(?:node|vpx|tsx|bun|deno)\\s+(?:-\\S+\\s+)*(?<file>[^\\s;&|)]+\\.[cm]?[jt]s)\\b/gu;\nconst COMMAND = /^bin\\/[^/]+\\.[cm]?ts$/u;\nconst NOT_COMMAND = /\\.(?:test|d|test\\.support)\\.[cm]?ts$/u;\n\nconst Manifest = Schema.Struct({\n bin: Schema.optional(Schema.Unknown),\n main: Schema.optional(Schema.Unknown),\n exports: Schema.optional(Schema.Unknown),\n});\n\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface CommandRun {\n readonly path: string;\n readonly start: number;\n}\n\ninterface Entries {\n readonly all: readonly string[];\n readonly bins: readonly string[];\n}\n\nconst NO_ENTRIES: Entries = { all: [], bins: [] };\n\nconst withoutCurrent = (path: string): string =>\n Str.replace(new RegExp(`^${CURRENT}`, \"u\"), \"\")(path);\n\nconst runsIn = ({ text, start }: FoundString): readonly CommandRun[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(RUN_FILE)(text)),\n Arr.flatMap((found) =>\n pipe(\n Option.fromUndefinedOr(found.groups),\n Option.flatMap(Rec.get(\"file\")),\n Option.map((path) => ({ path: withoutCurrent(path), start })),\n Option.toArray,\n ),\n ),\n );\n\nconst targetPaths = (held: unknown): readonly string[] =>\n pipe(targetsIn(held), Arr.map(withoutCurrent));\n\nconst entriesOf = (manifest: typeof Manifest.Type): Entries => {\n const bins = targetPaths(manifest.bin);\n return { all: [...bins, ...targetPaths(manifest.main), ...targetPaths(manifest.exports)], bins };\n};\n\nconst declaredEntries = Effect.fn(\"declaredEntries\")(function* declaredEntries(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(entriesOf),\n Option.getOrElse(() => NO_ENTRIES),\n );\n});\n\nconst isCommand = (path: string): boolean => COMMAND.test(path) && !NOT_COMMAND.test(path);\n\nconst commandFilesIn = Effect.fn(\"commandFilesIn\")(function* commandFilesIn(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(files.join(root, directory, BIN));\n return pipe(\n names,\n Arr.map((name) => `${BIN}${SEPARATOR}${name}`),\n Arr.filter(isCommand),\n );\n});\n\nconst workflowText = Effect.fn(\"workflowText\")(function* workflowText(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const workflows = pipe(listed, Arr.filter(Str.startsWith(WORKFLOW_DIRECTORY)));\n const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(Arr.getSomes(texts), Arr.join(\"\\n\"));\n});\n\nconst workspacePath = (directory: string, path: string): string =>\n pipe([directory, path], Arr.filter(Str.isNonEmpty), Arr.join(SEPARATOR));\n\ninterface OutsideInput {\n readonly file: string;\n readonly source: string;\n readonly runs: readonly CommandRun[];\n readonly entries: Entries;\n}\n\nconst outsideProblems = ({ file, source, runs, entries }: OutsideInput): readonly Problem[] =>\n pipe(\n runs,\n Arr.filter(({ path }) => !COMMAND.test(path) && !Arr.contains(entries.all, path)),\n Arr.map(({ path, start }): Problem => ({\n file,\n ...positionOf(source)(start),\n rule: OUTSIDE_BIN,\n message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`,\n })),\n );\n\nconst runsOf = (program: unknown): readonly CommandRun[] =>\n pipe(nestedValues(RUN_TASKS)(program), Arr.flatMap(stringsIn), Arr.flatMap(runsIn));\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n directory: string,\n workflows: string,\n) {\n const files = yield* RepositoryFiles;\n const config = yield* workspaceConfigOf(root, directory);\n const entries = yield* declaredEntries(root, directory);\n const commands = yield* commandFilesIn(root, directory);\n const runs = pipe(\n config,\n Option.map(({ program }) => runsOf(program)),\n Option.getOrElse((): readonly CommandRun[] => []),\n );\n const runPaths = pipe(\n runs,\n Arr.map(({ path }) => path),\n );\n const outside = pipe(\n config,\n Option.map(({ file, source }) => outsideProblems({ file, source, runs, entries })),\n Option.getOrElse((): readonly Problem[] => []),\n );\n const isRun = (path: string): boolean =>\n Arr.contains(runPaths, path) ||\n Arr.contains(entries.bins, path) ||\n Str.includes(workspacePath(directory, path))(workflows);\n const unrun = pipe(\n commands,\n Arr.filter((path) => !isRun(path)),\n Arr.map((path): Problem => ({\n file: files.join(root, directory, path),\n line: FIRST,\n column: FIRST,\n rule: UNRUN,\n message: `No task, package.json bin or workflow runs ${workspacePath(directory, path)}. Files in ${BIN}/ are entry points for fallow, so an unused one is never reported. Run it from a task or delete it.`,\n })),\n );\n return [...outside, ...unrun];\n});\n\nconst scriptsProblem = Effect.fn(\"scriptsProblem\")(function* scriptsProblem(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SCRIPTS_DIRECTORY);\n const isDirectory = yield* files.isDirectory(file);\n return pipe(\n isDirectory,\n Option.filter(Boolean),\n Option.map((): Problem => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: SCRIPTS,\n message: `${workspacePath(directory, SCRIPTS_DIRECTORY)} is a scripts directory. Put each command at ${BIN}/<name>.ts and the code that it shares in the package's own source, so that every workspace runs its commands the same way.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkCommandEntries = Effect.fn(\"checkCommandEntries\")(function* checkCommandEntries(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const all = [\"\", ...directories];\n const workflows = yield* workflowText(root);\n const found = yield* Effect.forEach(all, (directory) => problemsIn(root, directory, workflows), {\n concurrency: READ_CONCURRENCY,\n });\n const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return [...Arr.flatten(found), ...Arr.getSomes(scripts)];\n});\n","import { Array as Arr, Option, Order, String as Str, pipe } from \"effect\";\n\nexport interface PathMention {\n readonly field: string;\n readonly text: string;\n readonly candidates: readonly string[];\n readonly index: number;\n}\n\nconst START = 0;\nconst QUOTES = ['\"', \"'\"];\n\nconst firstIndex = (source: string, needles: readonly string[]): Option.Option<number> => {\n const found = pipe(\n needles,\n Arr.flatMap((needle) => Option.toArray(Str.indexOf(needle)(source))),\n );\n return Arr.head(Arr.sort(found, Order.Number));\n};\n\nconst quoted = (text: string): readonly string[] =>\n pipe(\n QUOTES,\n Arr.map((quote) => `${quote}${text}${quote}`),\n );\n\nexport const indexOfText =\n (source: string) =>\n (text: string): number =>\n pipe(\n firstIndex(source, quoted(text)),\n Option.orElse(() => firstIndex(source, [text])),\n Option.getOrElse(() => START),\n );\n","import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\n\nimport { indexOfText } from \"./path-mention.ts\";\nimport type { PathMention } from \"./path-mention.ts\";\n\nconst MEMBER_LISTS = [\"members\", \"exclude\", \"default-members\"];\nconst DEPENDENCY_TABLES = [\"dependencies\", \"dev-dependencies\", \"build-dependencies\"];\nconst WORKSPACE = \"workspace\";\nconst PATCH = \"patch\";\nconst PATCH_DEPTH = 2;\nconst WORKSPACE_DEPTH = 1;\nconst START = 0;\nconst WILDCARD = /[*?[]/u;\nconst KEY_SEPARATOR = \".\";\n\nconst decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));\nconst decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));\nconst decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));\n\ninterface NamedPath {\n readonly field: string;\n readonly target: string;\n}\n\nconst declaresPath = (trail: readonly string[]): boolean =>\n pipe(\n Arr.last(trail),\n Option.exists((name) => Arr.contains(DEPENDENCY_TABLES, name)),\n ) ||\n (trail.length === PATCH_DEPTH &&\n Arr.get(trail, START).pipe(Option.exists((name) => name === PATCH)));\n\nconst listsMembers = (trail: readonly string[], key: string): boolean =>\n trail.length === WORKSPACE_DEPTH &&\n Arr.get(trail, START).pipe(Option.exists((name) => name === WORKSPACE)) &&\n Arr.contains(MEMBER_LISTS, key);\n\nconst namedPaths = (\n trail: readonly string[],\n key: string,\n value: unknown,\n): readonly NamedPath[] => {\n const field = Arr.join([...trail, key], KEY_SEPARATOR);\n if (listsMembers(trail, key)) {\n return pipe(\n decodeStrings(value),\n Option.getOrElse((): readonly string[] => []),\n Arr.filter((member) => !WILDCARD.test(member)),\n Arr.map((member) => ({ field, target: member })),\n );\n }\n if (declaresPath(trail)) {\n return pipe(\n decodePath(value),\n Option.toArray,\n Arr.map(({ path }) => ({ field: `${field}${KEY_SEPARATOR}path`, target: path })),\n );\n }\n return [];\n};\n\nconst pathsIn =\n (trail: readonly string[]) =>\n (value: unknown): readonly NamedPath[] =>\n pipe(\n decodeTable(value),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, unknown])[] => []),\n Arr.flatMap(([key, child]) => [\n ...namedPaths(trail, key, child),\n ...pathsIn([...trail, key])(child),\n ]),\n );\n\n/** @internal */\nexport const cargoMentions = (source: string): readonly PathMention[] =>\n pipe(\n Option.liftThrowable(() => getStaticTOMLValue(parseTOML(source)))(),\n Option.toArray,\n Arr.flatMap(pathsIn([])),\n Arr.filter(({ target }) => Str.isNonEmpty(target)),\n Arr.map(({ field, target }) => ({\n field,\n text: target,\n candidates: [target],\n index: indexOfText(source)(target),\n })),\n );\n","import { Array as Arr, Effect, Option, String as Str } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst WILDCARD = /[*?[]/u;\nconst SEPARATOR = \"/\";\nconst FIRST = 0;\n\n/** @internal */\nexport const existsAt = Effect.fn(\"existsAt\")(function* existsAt(root: string, path: string) {\n const files = yield* RepositoryFiles;\n return yield* files.exists(files.join(root, path));\n});\n\n/** @internal */\nexport const isDirectoryAt = Effect.fn(\"isDirectoryAt\")(function* isDirectoryAt(\n root: string,\n path: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* files.isDirectory(files.join(root, path));\n return Option.getOrElse(directory, () => false);\n});\n\n/** @internal */\nexport const staticPrefix = (path: string): string => {\n const prefix = Arr.headNonEmpty(Str.split(path, WILDCARD));\n if (Str.endsWith(SEPARATOR)(prefix)) {\n return Str.slice(FIRST, -SEPARATOR.length)(prefix);\n }\n return prefix;\n};\n\n/** @internal */\nexport const isIgnored = Effect.fn(\"isIgnored\")(function* isIgnored(root: string, path: string) {\n const prefix = staticPrefix(path);\n if (Str.isEmpty(prefix)) {\n return false;\n }\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredPaths(root, [prefix, `${prefix}${SEPARATOR}`]);\n return Arr.isReadonlyArrayNonEmpty(ignored);\n});\n","import { Array as Arr, Effect, Option, Predicate, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { childrenOf, propertyValue, stringsIn } from \"#/entities/workspace/index.ts\";\nimport type { FoundString } from \"#/entities/workspace/index.ts\";\n\nimport type { PathMention } from \"./path-mention.ts\";\n\nconst WRAP_OFFSET = 1;\nconst WILDCARD = /[*?[{]/u;\nconst SEPARATOR = \"/\";\nconst RELATIVE = \".\";\nconst JSON_EXTENSION = \".json\";\n\nconst isObject = (node: unknown): boolean =>\n Predicate.isReadonlyObject(node) && node[\"type\"] === \"ObjectExpression\";\n\nconst firstObject = (node: unknown): Option.Option<unknown> => {\n if (isObject(node)) {\n return Option.some(node);\n }\n return pipe(childrenOf(node), Arr.findFirst(firstObject));\n};\n\nconst leadingDirectory = (pattern: string): string =>\n pipe(\n Str.split(pattern, SEPARATOR),\n Arr.takeWhile((segment) => !WILDCARD.test(segment)),\n Arr.join(SEPARATOR),\n );\n\nconst listed =\n (root: unknown) =>\n (\n name: string,\n candidatesOf: (text: string) => readonly string[],\n valuesOf: (value: unknown) => readonly FoundString[] = stringsIn,\n ): readonly PathMention[] =>\n pipe(\n propertyValue(name)(root),\n Option.toArray,\n Arr.flatMap(valuesOf),\n Arr.map(({ text, start }: FoundString): PathMention => ({\n field: name,\n text,\n candidates: candidatesOf(text),\n index: start - WRAP_OFFSET,\n })),\n Arr.filter(({ candidates }) => Arr.isReadonlyArrayNonEmpty(candidates)),\n );\n\nconst objectsIn = (node: unknown): readonly unknown[] => [\n ...Arr.filter([node], isObject),\n ...pipe(childrenOf(node), Arr.flatMap(objectsIn)),\n];\n\nconst referencedPaths = (references: unknown): readonly FoundString[] =>\n pipe(\n objectsIn(references),\n Arr.flatMap((reference) => Option.toArray(propertyValue(\"path\")(reference))),\n Arr.flatMap(stringsIn),\n );\n\nconst exactly = (text: string): readonly string[] => [text];\nconst relativeConfig = (text: string): readonly string[] => {\n if (Str.startsWith(RELATIVE)(text)) {\n return [text, `${text}${JSON_EXTENSION}`];\n }\n return [];\n};\nconst patternRoot = (text: string): readonly string[] =>\n pipe([leadingDirectory(text)], Arr.filter(Str.isNonEmpty));\n\n/** @internal */\nexport const tsconfigMentions = Effect.fn(\"tsconfigMentions\")(function* tsconfigMentions(\n file: string,\n source: string,\n) {\n const parsed = yield* Effect.promise(() => parse(`${file}.ts`, `(${source})`, { lang: \"ts\" }));\n const program: unknown = parsed.program;\n const root = firstObject(program);\n return pipe(\n root,\n Option.toArray,\n Arr.flatMap((object) =>\n Arr.flatten([\n listed(object)(\"references\", exactly, referencedPaths),\n listed(object)(\"extends\", relativeConfig),\n listed(object)(\"files\", exactly),\n listed(object)(\"include\", patternRoot),\n ]),\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport { unmatchedWorkspacePatterns } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { cargoMentions } from \"./cargo-paths.ts\";\nimport { existsAt, isIgnored } from \"./path-existence.ts\";\nimport { indexOfText } from \"./path-mention.ts\";\nimport type { PathMention } from \"./path-mention.ts\";\nimport { tsconfigMentions } from \"./tsconfig-paths.ts\";\n\nconst RULE: RuleName = \"config-path\";\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst CARGO_MANIFEST = /(?:^|\\/)Cargo\\.toml$/u;\nconst TSCONFIG = /(?:^|\\/)tsconfig(?:\\.[\\w-]+)?\\.json$/u;\nconst OUTSIDE = \"..\";\nconst READ_CONCURRENCY = 8;\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n file: string,\n mention: PathMention,\n) {\n const files = yield* RepositoryFiles;\n const relatives = pipe(\n mention.candidates,\n Arr.map((candidate) => files.relative(root, files.resolve(files.dirname(file), candidate))),\n Arr.filter((relative) => !Str.startsWith(OUTSIDE)(relative)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(relatives)) {\n return false;\n }\n const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), {\n concurrency: READ_CONCURRENCY,\n });\n if (pipe(present, Arr.some(Boolean))) {\n return false;\n }\n const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), {\n concurrency: READ_CONCURRENCY,\n });\n return !pipe(ignored, Arr.some(Boolean));\n});\n\nconst byIndex = Order.mapInput(Order.Number, ({ index }: PathMention) => index);\n\nconst problemOf =\n (file: string, source: string) =>\n (mention: PathMention): Problem => ({\n file,\n ...positionOf(source)(mention.index),\n rule: RULE,\n message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`,\n });\n\nconst mentionsIn = Effect.fn(\"mentionsIn\")(function* mentionsIn(file: string, source: string) {\n if (CARGO_MANIFEST.test(file)) {\n return cargoMentions(source);\n }\n return yield* tsconfigMentions(file, source);\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const mentions = yield* mentionsIn(file, source.value);\n const missing = yield* Effect.filter(mentions, (mention) => isMissing(root, file, mention), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(Arr.sort(missing, byIndex), Arr.map(problemOf(file, source.value)));\n});\n\nconst unmatchedPatterns = Effect.fn(\"unmatchedPatterns\")(function* unmatchedPatterns(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, WORKSPACE_FILE);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const patterns = yield* unmatchedWorkspacePatterns(root);\n return pipe(\n patterns,\n Arr.map((pattern): Problem => ({\n file,\n ...positionOf(source.value)(indexOfText(source.value)(pattern)),\n rule: RULE,\n message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkConfigPaths = Effect.fn(\"checkConfigPaths\")(function* checkConfigPaths(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const owned = yield* files.ownedFiles(root);\n const configs = pipe(\n owned,\n Arr.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)),\n );\n const [found, patterns] = yield* Effect.all(\n [\n Effect.forEach(configs, (name) => problemsIn(root, name), { concurrency: READ_CONCURRENCY }),\n unmatchedPatterns(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return [...Arr.flatten(found), ...patterns];\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n cratesIn,\n hasVerifyTask,\n owningWorkspace,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Crate } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unverified-crate\";\nconst VERSION_RULE: RuleName = \"release-version\";\nconst MANIFEST_FILE = \"package.json\";\nconst APP_DIRECTORIES: readonly string[] = [\"\", \"src-tauri\"];\nconst CARGO_FILE = \"Cargo.toml\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));\n\nconst problemFor = (crate: Crate, message: string): Problem => ({\n file: crate.manifest,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `crate ${crate.name} ${message}, so vp run verify never checks it.`,\n});\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(\n root: string,\n directories: readonly string[],\n crate: Crate,\n) {\n const files = yield* RepositoryFiles;\n const workspace = owningWorkspace(directories)(\n files.relative(root, files.dirname(crate.manifest)),\n );\n if (Option.isNone(workspace)) {\n return Option.some(problemFor(crate, \"is outside every workspace package\"));\n }\n const verified = yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE));\n if (verified) {\n return Option.none<Problem>();\n }\n return Option.some(\n problemFor(crate, `is in ${workspace.value}, whose ${CONFIG_FILE} has no verify task`),\n );\n});\n\nconst versionProblemIn = Effect.fn(\"versionProblemIn\")(function* versionProblemIn(\n root: string,\n directories: readonly string[],\n crate: Crate,\n) {\n const files = yield* RepositoryFiles;\n const directory = files.relative(root, files.dirname(crate.manifest));\n const workspace = pipe(\n directories,\n Arr.findFirst((candidate) =>\n pipe(\n APP_DIRECTORIES,\n Arr.map((inner) =>\n pipe([candidate, inner], Arr.filter(Str.isNonEmpty), Arr.join(SEPARATOR)),\n ),\n Arr.contains(directory),\n ),\n ),\n );\n if (Option.isNone(workspace)) {\n return Option.none<Problem>();\n }\n const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE));\n const version = pipe(\n text,\n Option.flatMap(Schema.decodeOption(PackageVersion)),\n Option.map((manifest) => manifest.version),\n );\n if (Option.isNone(version) || version.value === crate.version) {\n return Option.none<Problem>();\n }\n return Option.some<Problem>({\n file: crate.manifest,\n line: FIRST,\n column: FIRST,\n rule: VERSION_RULE,\n message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`,\n });\n});\n\n/** @internal */\nexport const checkCrates = Effect.fn(\"checkCrates\")(function* checkCrates(root: string) {\n const files = yield* RepositoryFiles;\n const cargo = yield* files.exists(files.join(root, CARGO_FILE));\n if (!cargo) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const crates = yield* cratesIn(root);\n const found = yield* Effect.forEach(\n crates,\n (crate) =>\n Effect.all(\n [problemIn(root, directories, crate), versionProblemIn(root, directories, crate)],\n {\n concurrency: \"unbounded\",\n },\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(Arr.flatten(found));\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport {\n childrenOf,\n deployEntries,\n keyName,\n KeySchema,\n stringsIn,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"deploy-entry-pattern\";\nconst FALLOW_KEYS = [\"entry\", \"entryPoints\", \"supportEntry\", \"dynamicallyLoaded\", \"alwaysUsed\"];\nconst VITE_KEYS = [\"files\"];\nconst FALLOW_CONFIG = /(?:^|\\/)(?:\\.fallowrc\\.jsonc?|fallow-plugin-[^/]+\\.jsonc?)$/u;\nconst VITE_CONFIG = /(?:^|\\/)vite\\.config\\.[cm]?ts$/u;\nconst BRACE_GROUP = /\\{(?<options>[^{}]*)\\}/u;\nconst OPTION_SEPARATOR = \",\";\nconst PAIR = 2;\nconst NEGATED = \"!\";\nconst ROOT_WORKSPACE = \".\";\nconst WRAP_OFFSET = 1;\nconst NO_OFFSET = 0;\nconst READ_CONCURRENCY = 8;\nconst MESSAGE =\n \"selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.\";\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\n\ninterface Pattern {\n readonly text: string;\n readonly start: number;\n}\n\ninterface ConfigKind {\n readonly keys: readonly string[];\n readonly offset: number;\n readonly sourceOf: (text: string) => string;\n readonly bases: (directory: string, workspaces: readonly string[]) => readonly string[];\n}\n\nconst FALLOW: ConfigKind = {\n keys: FALLOW_KEYS,\n offset: WRAP_OFFSET,\n sourceOf: (text) => `(${text})`,\n bases: (directory, workspaces) => [directory, ...workspaces],\n};\n\nconst VITE: ConfigKind = {\n keys: VITE_KEYS,\n offset: NO_OFFSET,\n sourceOf: (text) => text,\n bases: (directory) => [directory],\n};\n\nconst isPatternProperty =\n (keys: readonly string[]) =>\n (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => Arr.contains(keys, keyName(key))),\n );\n\nconst patternsIn =\n (keys: readonly string[]) =>\n (node: unknown): readonly Pattern[] => {\n if (Predicate.isReadonlyObject(node) && isPatternProperty(keys)(node)) {\n return stringsIn(node[\"value\"]);\n }\n return pipe(childrenOf(node), Arr.flatMap(patternsIn(keys)));\n };\n\nconst choicesOf = ([literal = \"\", options]: readonly string[]): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(options),\n Option.map(Str.split(OPTION_SEPARATOR)),\n Option.getOrElse((): readonly string[] => [\"\"]),\n Arr.map((option) => `${literal}${option}`),\n );\n\nconst combined = (chunks: readonly (readonly string[])[]): readonly string[] =>\n Arr.matchLeft(chunks, {\n onEmpty: (): readonly string[] => [\"\"],\n onNonEmpty: (head, tail) =>\n pipe(\n choicesOf(head),\n Arr.flatMap((choice) =>\n pipe(\n combined(tail),\n Arr.map((rest) => `${choice}${rest}`),\n ),\n ),\n ),\n });\n\nconst expanded = (pattern: string): readonly string[] =>\n combined(Arr.chunksOf(Str.split(pattern, BRACE_GROUP), PAIR));\n\ninterface Selection {\n readonly root: string;\n readonly bases: readonly string[];\n readonly entries: readonly string[];\n}\n\nconst selectsOnlyDeployEntries = Effect.fn(\"selectsOnlyDeployEntries\")(\n function* selectsOnlyDeployEntries({ root, bases, entries }: Selection, pattern: Pattern) {\n const files = yield* RepositoryFiles;\n const pathspecs = pipe(\n bases,\n Arr.flatMap((base) =>\n pipe(\n expanded(pattern.text),\n Arr.map((spec) => `:(glob)${files.join(base, spec)}`),\n ),\n ),\n );\n const matched = yield* files.matchingFiles(root, pathspecs);\n const selects =\n Arr.isReadonlyArrayNonEmpty(matched) &&\n pipe(\n matched,\n Arr.every((file) => Arr.contains(entries, file)),\n );\n return Option.liftPredicate(pattern, () => selects);\n },\n);\n\ninterface ConfigRequest {\n readonly root: string;\n readonly file: string;\n readonly kind: ConfigKind;\n readonly workspaces: readonly string[];\n readonly entries: readonly string[];\n}\n\nconst patternsOf = Effect.fn(\"patternsOf\")(function* patternsOf(\n file: string,\n text: string,\n kind: ConfigKind,\n) {\n const parsed = yield* Effect.promise(() =>\n parse(`${file}.ts`, kind.sourceOf(text), { lang: \"ts\" }),\n );\n return pipe(\n patternsIn(kind.keys)(parsed.program),\n Arr.filter(({ text: pattern }) => !Str.startsWith(NEGATED)(pattern)),\n );\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(request: ConfigRequest) {\n const { root, file, kind, workspaces, entries } = request;\n const files = yield* RepositoryFiles;\n const path = files.join(root, file);\n const text = yield* files.readFile(path);\n if (Option.isNone(text)) {\n return [];\n }\n const patterns = yield* patternsOf(file, text.value, kind);\n const selection = { root, bases: kind.bases(files.dirname(file), workspaces), entries };\n const flagged = yield* Effect.forEach(\n patterns,\n (pattern) => selectsOnlyDeployEntries(selection, pattern),\n {\n concurrency: 1,\n },\n );\n return pipe(\n Arr.getSomes(flagged),\n Arr.map(({ text: pattern, start }): Problem => ({\n file: path,\n ...positionOf(text.value)(start - kind.offset),\n rule: RULE,\n message: `${pattern} ${MESSAGE}`,\n })),\n );\n});\n\n/** @internal */\nexport const checkDeployEntryPatterns = Effect.fn(\"checkDeployEntryPatterns\")(\n function* checkDeployEntryPatterns(root: string) {\n const files = yield* RepositoryFiles;\n const entries = yield* deployEntries(root);\n if (!Arr.isReadonlyArrayNonEmpty(entries)) {\n return [];\n }\n const listed = yield* files.listedFiles(root);\n const declared = yield* workspaceDirectories(root);\n const workspaces = pipe(\n declared,\n Arr.filter((workspace) => workspace !== ROOT_WORKSPACE),\n );\n const configs = pipe(\n listed,\n Arr.flatMap((file) => {\n if (FALLOW_CONFIG.test(file)) {\n return [{ file, kind: FALLOW }];\n }\n if (VITE_CONFIG.test(file)) {\n return [{ file, kind: VITE }];\n }\n return [];\n }),\n );\n const found = yield* Effect.forEach(\n configs,\n ({ file, kind }) => problemsIn({ root, file, kind, workspaces, entries }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport {\n childrenOf,\n keyName,\n KeySchema,\n stringsIn,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"listed-entry\";\nconst ENTRY_KEYS = [\"entry\", \"entryPoints\", \"supportEntry\"];\nconst FALLOW_CONFIG =\n /(?:^|\\/)(?:\\.fallowrc\\.jsonc?|fallow-plugin-[^/]+\\.jsonc?|\\.fallow\\/plugins\\/[^/]+\\.jsonc?)$/u;\nconst WILDCARD = /[*?{[]/u;\nconst SEPARATOR = \"/\";\nconst WRAP_OFFSET = 1;\nconst READ_CONCURRENCY = 8;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\n\ninterface Pattern {\n readonly text: string;\n readonly start: number;\n}\n\nconst isEntryProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => Arr.contains(ENTRY_KEYS, keyName(key))),\n );\n\nconst entryPatternsIn = (node: unknown): readonly Pattern[] => {\n if (Predicate.isReadonlyObject(node) && isEntryProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.map(({ text, start }) => ({ text, start: start - WRAP_OFFSET })),\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(entryPatternsIn));\n};\n\nconst namesOneFile =\n (directories: readonly string[]) =>\n ({ text }: Pattern): boolean =>\n pipe(\n directories,\n Arr.some((directory) => Str.startsWith(`${directory}${SEPARATOR}`)(text)),\n ) ||\n (Str.includes(SEPARATOR)(text) && !WILDCARD.test(text));\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n file: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const path = files.join(root, file);\n const text = yield* files.readFile(path);\n if (Option.isNone(text)) {\n return [];\n }\n const parsed = yield* Effect.promise(() =>\n parse(`${file}.ts`, `(${text.value})`, { lang: \"ts\" }),\n );\n return pipe(\n entryPatternsIn(parsed.program),\n Arr.filter(namesOneFile(directories)),\n Arr.map(({ text: pattern, start }): Problem => ({\n file: path,\n ...positionOf(text.value)(start),\n rule: RULE,\n message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkFallowEntries = Effect.fn(\"checkFallowEntries\")(function* checkFallowEntries(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((file) => FALLOW_CONFIG.test(file)),\n ),\n (file) => problemsIn(root, file, directories),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { stringsIn, workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { FoundString } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"root-workspace-path\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst PATH_CHARACTER = /[\\w.@/-]/u;\nconst NAME_CHARACTER = /[\\w.@-]/u;\nconst FIRST = 0;\nconst NEXT = 1;\n\nconst isBoundary = (character: string, allowed: RegExp): boolean =>\n character === \"\" || !allowed.test(character);\n\nconst mentions =\n (directory: string) =>\n (text: string): boolean => {\n const parts = Str.split(text, directory);\n return pipe(\n Arr.drop(parts, NEXT),\n Arr.some((after, index) => {\n const before = parts[index] ?? \"\";\n const previous = Str.slice(before.length - NEXT)(before);\n const following = Str.slice(FIRST, NEXT)(after);\n return (\n isBoundary(previous, PATH_CHARACTER) &&\n (following === \"/\" || isBoundary(following, NAME_CHARACTER))\n );\n }),\n );\n };\n\nconst problemsIn =\n (file: string, source: string, directories: readonly string[]) =>\n (found: FoundString): readonly Problem[] =>\n pipe(\n directories,\n Arr.filter((directory) => mentions(directory)(found.text)),\n Arr.map((directory): Problem => ({\n file,\n ...positionOf(source)(found.start),\n rule: RULE,\n message: `${directory} is a workspace. The root ${CONFIG_FILE} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE}: msch.lint, msch.devDependencies or its verify task.`,\n })),\n );\n\n/** @internal */\nexport const checkRootWorkspacePaths = Effect.fn(\"checkRootWorkspacePaths\")(\n function* checkRootWorkspacePaths(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const directories = yield* workspaceDirectories(root);\n const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: \"ts\" }));\n return pipe(\n stringsIn(parsed.program),\n Arr.flatMap(problemsIn(file, source.value, directories)),\n );\n },\n);\n","import { Array as Arr, Effect, Option } from \"effect\";\n\nimport {\n workspaceConfigOf,\n workspaceDirectories,\n VERIFY_TASK,\n definesTask,\n hasVerifyTask,\n} from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nconst RULE: RuleName = \"hidden-verify\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\n\nconst problemIn = Effect.fn(\"problemIn\")(function* problemIn(root: string, directory: string) {\n const config = yield* workspaceConfigOf(root, directory);\n if (Option.isNone(config)) {\n return Option.none<Problem>();\n }\n const { file, program } = config.value;\n if (definesTask(VERIFY_TASK)(program)) {\n return Option.none<Problem>();\n }\n const verified = yield* hasVerifyTask(file);\n return Option.some<Problem>({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${directory} gets its verify task from code outside ${CONFIG_FILE}. The root verify reads ${CONFIG_FILE} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE}.`,\n }).pipe(Option.filter(() => verified));\n});\n\n/** @internal */\nexport const checkHiddenVerify = Effect.fn(\"checkHiddenVerify\")(function* checkHiddenVerify(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(directories, (directory) => problemIn(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n keyName,\n literalOf,\n runTasksOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RunTask } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"shared-uncached-task\";\nconst READ_CONCURRENCY = 8;\nconst SHARED = 2;\nconst OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\\//u;\n\nconst UncachedTask = Schema.Struct({\n cache: Schema.Literal(false),\n command: Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]),\n});\n\nconst decodeUncachedTask = Schema.decodeUnknownOption(UncachedTask);\nconst encodeDefinition = Schema.encodeOption(Schema.fromJsonString(Schema.Unknown));\n\ninterface UncachedDefinition {\n readonly directory: string;\n readonly file: string;\n readonly position: Pick<Problem, \"line\" | \"column\">;\n readonly name: string;\n readonly command: string;\n readonly definition: string;\n}\n\nconst commandText = (command: typeof UncachedTask.Type.command): string =>\n Arr.join(Arr.ensure(command), \" && \");\n\nconst runsOwnProgram = (command: string): boolean =>\n pipe(\n Str.trim(command),\n Str.split(/\\s+/u),\n Arr.head,\n Option.exists((program) => OWN_PROGRAM.test(program)),\n );\n\ninterface ConfigFile {\n readonly directory: string;\n readonly file: string;\n readonly source: string;\n}\n\nconst definitionOf =\n ({ directory, file, source }: ConfigFile) =>\n (task: RunTask): Option.Option<UncachedDefinition> =>\n Option.gen(function* uncachedDefinition() {\n const literal = yield* literalOf(task.value);\n const { command } = yield* decodeUncachedTask(literal);\n const text = commandText(command);\n if (runsOwnProgram(text)) {\n return yield* Option.none();\n }\n const definition = yield* encodeDefinition(literal);\n return {\n directory,\n file,\n position: positionOf(source)(task.start),\n name: keyName(task.key),\n command: text,\n definition,\n };\n });\n\nconst definitionsIn = Effect.fn(\"definitionsIn\")(function* definitionsIn(\n root: string,\n directory: string,\n) {\n const found = yield* runTasksOf(root, directory);\n if (Option.isNone(found)) {\n return [];\n }\n const { file, source, tasks } = found.value;\n return pipe(\n tasks,\n Arr.flatMap((task) => Option.toArray(definitionOf({ directory, file, source })(task))),\n );\n});\n\nconst problemsOf = (definitions: readonly UncachedDefinition[]): readonly Problem[] => {\n const directories = pipe(\n definitions,\n Arr.map(({ directory }) => directory),\n Arr.dedupe,\n );\n if (directories.length < SHARED) {\n return [];\n }\n return pipe(\n definitions,\n Arr.map(({ file, position, name, command }): Problem => ({\n file,\n ...position,\n rule: RULE,\n message: `The uncached task ${name} (${command}) is written the same way in ${Arr.join(directories, \", \")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`,\n })),\n );\n};\n\n/** @internal */\nexport const checkSharedUncachedTasks = Effect.fn(\"checkSharedUncachedTasks\")(\n function* checkSharedUncachedTasks(root: string) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(\n directories,\n (directory) => definitionsIn(root, directory),\n { concurrency: READ_CONCURRENCY },\n );\n return pipe(\n Arr.flatten(found),\n Arr.groupBy(({ name, definition }) => `${name}\\u0000${definition}`),\n Rec.values,\n Arr.flatMap(problemsOf),\n );\n },\n);\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport {\n keyName,\n literalOf,\n propertyValue,\n runTasksOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RunTask, RunTasks } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"unlocked-task\";\nconst READ_CONCURRENCY = 8;\nconst READS_DEPENDENCIES = /^vp (?:test|pack|build)\\b/u;\n\nconst decodeCommand = Schema.decodeUnknownOption(\n Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]),\n);\n\nconst commandOf = (task: RunTask): Option.Option<string> =>\n pipe(\n propertyValue(\"command\")(task.value),\n Option.getOrElse(() => task.value),\n literalOf,\n Option.flatMap(decodeCommand),\n Option.flatMap((command) =>\n Arr.findFirst(Arr.ensure(command), (line) => READS_DEPENDENCIES.test(line)),\n ),\n );\n\nconst tracksLockfiles = (task: RunTask): boolean =>\n pipe(\n propertyValue(\"cache\")(task.value),\n Option.flatMap(literalOf),\n Option.match({\n onNone: () => Option.isNone(propertyValue(\"cache\")(task.value)),\n onSome: (cache) => cache !== false,\n }),\n );\n\nconst problemsOf = ({ file, source, tasks }: RunTasks): readonly Problem[] =>\n pipe(\n tasks,\n Arr.filter(tracksLockfiles),\n Arr.flatMap((task) =>\n pipe(\n commandOf(task),\n Option.map((command): Problem => ({\n file,\n ...positionOf(source)(task.start),\n rule: RULE,\n message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`,\n })),\n Option.toArray,\n ),\n ),\n );\n\n/** @internal */\nexport const checkUnlockedTasks = Effect.fn(\"checkUnlockedTasks\")(function* checkUnlockedTasks(\n root: string,\n) {\n const directories = yield* workspaceDirectories(root);\n const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(Arr.getSomes(found), Arr.flatMap(problemsOf));\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkHiddenVerify } from \"./hidden-verify.ts\";\nimport { checkSharedUncachedTasks } from \"./shared-uncached-tasks.ts\";\nimport { checkUnlockedTasks } from \"./unlocked-tasks.ts\";\n\n/** @internal */\nexport const checkTasks = Effect.fn(\"checkTasks\")(function* checkTasks(root: string) {\n const found = yield* Effect.all(\n [checkHiddenVerify(root), checkSharedUncachedTasks(root), checkUnlockedTasks(root)],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, isSeq, parseDocument, visit } from \"yaml\";\nimport type { Pair, Scalar, YAMLMap, YAMLSeq } from \"yaml\";\n\nconst MISSING_OFFSET = 0;\n\n/** @internal */\nexport interface Located {\n readonly text: string;\n readonly offset: number;\n}\n\n/** @internal */\nexport type Entry = readonly [string, unknown];\n\ntype Ranged = Scalar | YAMLMap | YAMLSeq;\n\nconst isRanged = (node: unknown): node is Ranged => isScalar(node) || isMap(node) || isSeq(node);\n\n/** @internal */\nexport const isText = (node: unknown): node is Scalar<string> =>\n isScalar(node) && typeof node.value === \"string\";\n\nconst isTextPair = (pair: unknown): pair is Pair<Scalar<string>> =>\n isPair(pair) && isText(pair.key);\n\nconst offsetOf = (node: unknown): number =>\n pipe(\n Option.liftPredicate(node, isRanged),\n Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)),\n Option.map(([start]) => start),\n Option.getOrElse(() => MISSING_OFFSET),\n );\n\n/** @internal */\nexport const stringOf = (node: unknown): Option.Option<Located> =>\n pipe(\n Option.liftPredicate(node, isText),\n Option.map((scalar) => ({ text: scalar.value, offset: offsetOf(scalar) })),\n );\n\n/** @internal */\nexport const childOf =\n (key: string) =>\n (node: unknown): unknown =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): unknown => map.get(key, true)),\n Option.getOrUndefined,\n );\n\n/** @internal */\nexport const workingDirectoryOf = (owner: unknown): Option.Option<Located> => {\n const run = childOf(\"run\")(childOf(\"defaults\")(owner));\n return stringOf(childOf(\"working-directory\")(run));\n};\n\n/** @internal */\nexport const itemsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isSeq),\n Option.map((seq): readonly unknown[] => seq.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\nconst pairsOf = (node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): readonly unknown[] => map.items),\n Option.getOrElse((): readonly unknown[] => []),\n );\n\n/** @internal */\nexport const entriesOf = (node: unknown): readonly Entry[] =>\n pipe(\n pairsOf(node),\n Arr.filter(isTextPair),\n Arr.map((pair): Entry => [pair.key.value, pair.value]),\n );\n\n/** @internal */\nexport const scalarsIn = (source: string): readonly Located[] => {\n const found: Located[] = [];\n visit(parseDocument(source), {\n Scalar: (_key, node) => {\n found.push(...Option.toArray(stringOf(node)));\n },\n });\n return found;\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport { parseDocument } from \"yaml\";\n\nimport {\n childOf,\n entriesOf,\n itemsOf,\n scalarsIn,\n stringOf,\n workingDirectoryOf,\n} from \"./workflow-nodes.ts\";\nimport type { Entry, Located } from \"./workflow-nodes.ts\";\n\nconst ROOT = \".\";\nconst LOCAL = \"./\";\nconst NEGATION = \"!\";\nconst SEPARATOR = \"/\";\nconst LINE = \"\\n\";\nconst UNRESOLVED_MARKERS = [\"${{\", \"$\", \"{\"];\nconst ABSOLUTE_MARKERS = [\"/\", \"~\"];\nconst FILE_INPUT_SUFFIX = \"-file\";\nconst DEPENDENCY_PATH_INPUT = \"cache-dependency-path\";\nconst FILTER_KEYS = [\"paths\", \"paths-ignore\"];\nconst HASH_FILES = /hashFiles\\((?<arguments>[^)]*)\\)/gu;\nconst QUOTED = /'(?<path>[^']*)'/gu;\nconst SCRIPT = /^[\\w.@/-]+\\.(?:ts|mts|cts|sh)$/u;\nconst TOKEN_SEPARATOR = /[\\s;&|()<>\"'`=]+/u;\n\n/** @internal */\nexport const ACTION_DEFINITIONS: readonly string[] = [\"action.yml\", \"action.yaml\"];\n\n/** @internal */\nexport type ReferenceKind = \"glob\" | \"file\" | \"script\" | \"directory\" | \"action\";\n\n/** @internal */\nexport interface WorkflowReference {\n readonly kind: ReferenceKind;\n readonly field: string;\n readonly path: string;\n readonly offset: number;\n}\n\nconst containsAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.includes(marker)(path)),\n );\n\nconst startsWithAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.startsWith(marker)(path)),\n );\n\nconst isLiteralPath = (path: string): boolean =>\n Str.isNonEmpty(path) &&\n !containsAny(UNRESOLVED_MARKERS)(path) &&\n !startsWithAny(ABSOLUTE_MARKERS)(path);\n\nconst withoutLocal = (path: string): string => {\n if (Str.startsWith(LOCAL)(path)) {\n return Str.slice(LOCAL.length)(path);\n }\n return path;\n};\n\nconst joinPath = (base: string, path: string): string => {\n const relative = withoutLocal(Str.trim(path));\n if (base === ROOT) {\n return relative;\n }\n return `${base}${SEPARATOR}${relative}`;\n};\n\nconst reference =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n ({ text, offset }: Located): readonly WorkflowReference[] => {\n const path = Str.trim(text);\n if (!isLiteralPath(path) || !isLiteralPath(base)) {\n return [];\n }\n return [{ kind, field, path: joinPath(base, path), offset }];\n };\n\nconst isPositive = ({ text }: Located): boolean => !Str.startsWith(NEGATION)(Str.trim(text));\n\nconst globsIn = (field: string, node: unknown): readonly WorkflowReference[] =>\n pipe(\n itemsOf(node),\n Arr.flatMap((item) => Option.toArray(stringOf(item))),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", field)),\n );\n\nconst filtersOf = ([event, filters]: Entry): readonly WorkflowReference[] =>\n pipe(\n FILTER_KEYS,\n Arr.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))),\n );\n\nconst directoryOf = (located: Option.Option<Located>, base: string): string =>\n pipe(\n located,\n Option.map(({ text }) => joinPath(ROOT, text)),\n Option.getOrElse(() => base),\n );\n\nconst located =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n (found: Option.Option<Located>): readonly WorkflowReference[] =>\n pipe(found, Option.toArray, Arr.flatMap(reference(kind, field, base)));\n\nconst localUses = (node: unknown): Option.Option<Located> =>\n pipe(\n stringOf(childOf(\"uses\")(node)),\n Option.filter(({ text }) => Str.startsWith(LOCAL)(text)),\n );\n\nconst scriptsIn =\n (field: string, base: string) =>\n ({ text, offset }: Located): readonly WorkflowReference[] =>\n pipe(\n Str.split(text, TOKEN_SEPARATOR),\n Arr.filter((token) => SCRIPT.test(token)),\n Arr.dedupe,\n Arr.flatMap((token) => reference(\"script\", field, base)({ text: token, offset })),\n );\n\nconst isFileInput = ([key]: Entry): boolean =>\n Str.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;\n\nconst linesOf = ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Str.split(text, LINE),\n Arr.map((line) => ({ text: line, offset })),\n );\n\nconst fileInputOf =\n (field: string) =>\n ([key, value]: Entry): readonly WorkflowReference[] =>\n pipe(\n stringOf(value),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.flatMap(reference(\"glob\", `${field}.with.${key}`)),\n );\n\nconst fileInputsIn = (field: string, step: unknown): readonly WorkflowReference[] =>\n pipe(entriesOf(childOf(\"with\")(step)), Arr.filter(isFileInput), Arr.flatMap(fileInputOf(field)));\n\nconst stepReferences =\n (job: string, base: string) =>\n (step: unknown, index: number): readonly WorkflowReference[] => {\n const field = `jobs.${job}.steps[${index}]`;\n const own = stringOf(childOf(\"working-directory\")(step));\n const directory = directoryOf(own, base);\n return [\n ...located(\"action\", `${field}.uses`)(localUses(step)),\n ...located(\"directory\", `${field}.working-directory`)(own),\n ...pipe(\n stringOf(childOf(\"run\")(step)),\n Option.toArray,\n Arr.flatMap(scriptsIn(`${field}.run`, directory)),\n ),\n ...fileInputsIn(field, step),\n ];\n };\n\nconst jobReferences =\n (base: string) =>\n ([job, node]: Entry): readonly WorkflowReference[] => {\n const own = workingDirectoryOf(node);\n const steps = itemsOf(childOf(\"steps\")(node));\n const directory = directoryOf(own, base);\n return [\n ...located(\"file\", `jobs.${job}.uses`)(localUses(node)),\n ...located(\"directory\", `jobs.${job}.defaults.run.working-directory`)(own),\n ...pipe(steps, Arr.flatMap(stepReferences(job, directory))),\n ];\n };\n\nconst groupsOf =\n (pattern: RegExp, group: string) =>\n ({ text, offset }: Located): readonly Located[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[group])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, offset })),\n );\n\nconst hashFilesIn = (source: string): readonly WorkflowReference[] =>\n pipe(\n scalarsIn(source),\n Arr.flatMap(groupsOf(HASH_FILES, \"arguments\")),\n Arr.flatMap(groupsOf(QUOTED, \"path\")),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", \"hashFiles\")),\n );\n\nconst jobsOf = (source: string): readonly Entry[] =>\n entriesOf(childOf(\"jobs\")(parseDocument(source).contents));\n\n/** @internal */\nexport const workflowReferences = (source: string): readonly WorkflowReference[] => {\n const root = parseDocument(source).contents;\n const workflowDefault = workingDirectoryOf(root);\n const base = directoryOf(workflowDefault, ROOT);\n return [\n ...pipe(entriesOf(childOf(\"on\")(root)), Arr.flatMap(filtersOf)),\n ...located(\"directory\", \"defaults.run.working-directory\")(workflowDefault),\n ...pipe(jobsOf(source), Arr.flatMap(jobReferences(base))),\n ...hashFilesIn(source),\n ];\n};\n\nconst pathInputOf = (step: unknown): unknown => childOf(\"path\")(childOf(\"with\")(step));\n\nconst outputPathsOf = (step: unknown): readonly string[] =>\n pipe(\n stringOf(pathInputOf(step)),\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.map(({ text }) => joinPath(ROOT, text)),\n Arr.filter(isLiteralPath),\n );\n\n/** @internal */\nexport const producedPaths = (source: string): readonly string[] =>\n pipe(\n jobsOf(source),\n Arr.flatMap(([, job]) => itemsOf(childOf(\"steps\")(job))),\n Arr.flatMap(outputPathsOf),\n );\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { existsAt, isDirectoryAt, isIgnored, staticPrefix } from \"./path-existence.ts\";\nimport { ACTION_DEFINITIONS, producedPaths, workflowReferences } from \"./workflow-references.ts\";\nimport type { ReferenceKind, WorkflowReference } from \"./workflow-references.ts\";\n\nconst RULE: RuleName = \"workflow-path\";\nconst WORKFLOW_DIRECTORY = \".github/workflows/\";\nconst WORKFLOW_EXTENSIONS = [\".yml\", \".yaml\"];\nconst READ_CONCURRENCY = 8;\nconst SEPARATOR = \"/\";\n\nconst EXPECTED: Readonly<Record<ReferenceKind, string>> = {\n action: \"a directory with action.yml\",\n directory: \"a directory\",\n file: \"a file\",\n glob: \"a pattern that matches a tracked file\",\n script: \"a file\",\n};\n\ntype Resolver = (root: string, path: string) => Effect.Effect<boolean, never, RepositoryFiles>;\n\nconst isWorkflow = (file: string): boolean =>\n Str.startsWith(WORKFLOW_DIRECTORY)(file) &&\n pipe(\n WORKFLOW_EXTENSIONS,\n Arr.some((extension) => Str.endsWith(extension)(file)),\n );\n\nconst matchesAny = Effect.fn(\"matchesAny\")(function* matchesAny(\n root: string,\n pathspecs: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const matched = yield* files.matchingFiles(root, pathspecs);\n return Arr.isReadonlyArrayNonEmpty(matched);\n});\n\nconst matchesGlob: Resolver = (root, path) => matchesAny(root, [`:(glob)${path}`]);\n\nconst hasAction: Resolver = Effect.fn(\"hasAction\")(function* hasAction(root: string, path: string) {\n const found = yield* Effect.forEach(\n ACTION_DEFINITIONS,\n (name) => existsAt(root, `${path}${SEPARATOR}${name}`),\n {\n concurrency: 1,\n },\n );\n return pipe(found, Arr.some(Boolean));\n});\n\nconst suffixAt =\n (segments: readonly string[]) =>\n (index: number): string =>\n `:(glob)**/${pipe(segments, Arr.drop(index), Arr.join(SEPARATOR))}`;\n\nconst findsScript: Resolver = Effect.fn(\"findsScript\")(function* findsScript(\n root: string,\n path: string,\n) {\n if (yield* existsAt(root, path)) {\n return true;\n }\n const segments = Str.split(path, SEPARATOR);\n return yield* matchesAny(root, Arr.makeBy(segments.length, suffixAt(segments)));\n});\n\nconst RESOLVERS: Readonly<Record<ReferenceKind, Resolver>> = {\n action: hasAction,\n directory: isDirectoryAt,\n file: existsAt,\n glob: matchesGlob,\n script: findsScript,\n};\n\nconst overlaps =\n (path: string) =>\n (produced: string): boolean =>\n produced === path ||\n Str.startsWith(`${path}${SEPARATOR}`)(produced) ||\n Str.startsWith(`${produced}${SEPARATOR}`)(path);\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n produced: readonly string[],\n found: WorkflowReference,\n) {\n const prefix = staticPrefix(found.path);\n if (pipe(produced, Arr.some(overlaps(prefix)))) {\n return false;\n }\n if (yield* RESOLVERS[found.kind](root, found.path)) {\n return false;\n }\n return !(yield* isIgnored(root, found.path));\n});\n\nconst problemOf =\n (file: string, source: string) =>\n (found: WorkflowReference): Problem => ({\n file,\n ...positionOf(source)(found.offset),\n rule: RULE,\n message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`,\n });\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(root: string, workflow: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, workflow);\n const source = yield* files.readFile(file);\n if (Option.isNone(source)) {\n return [];\n }\n const produced = producedPaths(source.value);\n const missing = yield* Effect.filter(workflowReferences(source.value), (found) =>\n isMissing(root, produced, found),\n );\n return pipe(missing, Arr.map(problemOf(file, source.value)));\n});\n\n/** @internal */\nexport const checkWorkflowPaths = Effect.fn(\"checkWorkflowPaths\")(function* checkWorkflowPaths(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(listed, Arr.filter(isWorkflow)),\n (workflow) => problemsIn(root, workflow),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport { isMap, isPair, parseDocument } from \"yaml\";\n\nimport { namedWorkspaces, patternOf } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { childOf, entriesOf, scalarsIn, stringOf } from \"./workflow-nodes.ts\";\nimport type { Located } from \"./workflow-nodes.ts\";\nimport { workflowReferences } from \"./workflow-references.ts\";\n\nconst PATH_FILTER: RuleName = \"workflow-path-filter\";\nconst PACKAGE: RuleName = \"workflow-package\";\nconst WORKFLOW = /^\\.github\\/workflows\\/(?<name>[^/]+)\\.ya?ml$/u;\nconst ACTION = /^\\.github\\/actions\\/(?<name>[^/]+)\\/action\\.ya?ml$/u;\nconst FILTER_KEYS: readonly string[] = [\"paths\", \"paths-ignore\"];\nconst PATHS_FILTER_ACTION = /(?:^|\\/)paths-filter@/u;\nconst PACKAGE_FILTER =\n /(?:^|\\s)(?:--filter|-F)(?:\\s+|=)(?<quote>[\"']?)(?<value>[^\\s\"'$][^\\s\"']*)\\k<quote>/gu;\nconst START = 0;\nconst READ_CONCURRENCY = 8;\nconst SEPARATOR = \"/\";\nconst WORD_SEPARATORS = /[-_]/gu;\nconst SPACE = \" \";\n\nconst FILTER_MESSAGE =\n \"A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.\";\n\nconst packageMessage = (what: string, directory: string): string =>\n `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;\n\nconst keysOf = (node: unknown): readonly Located[] =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.map((map): readonly unknown[] => map.items),\n Option.getOrElse((): readonly unknown[] => []),\n Arr.filter(isPair),\n Arr.flatMap(({ key }) => Option.toArray(stringOf(key))),\n );\n\ntype Where = Readonly<{ file: string; source: string }>;\n\nconst problemAt =\n ({ file, source }: Where, rule: RuleName, message: string) =>\n (offset: number): Problem => ({\n file,\n ...positionOf(source)(offset),\n rule,\n message,\n });\n\nconst pathFiltersIn = (file: string, source: string): readonly Problem[] => {\n const root = parseDocument(source).contents;\n const triggers = pipe(\n entriesOf(childOf(\"on\")(root)),\n Arr.flatMap(([, trigger]) => keysOf(trigger)),\n Arr.filter(({ text }) => Arr.contains(FILTER_KEYS, text)),\n );\n const actions = pipe(\n scalarsIn(source),\n Arr.filter(({ text }) => PATHS_FILTER_ACTION.test(text)),\n );\n return pipe(\n [...triggers, ...actions],\n Arr.map(({ offset }) => problemAt({ file, source }, PATH_FILTER, FILTER_MESSAGE)(offset)),\n );\n};\n\nconst matching = (workspaces: readonly NamedWorkspace[], text: string): Option.Option<string> =>\n pipe(\n workspaces,\n Arr.findFirst(\n ({ names }) =>\n Arr.isReadonlyArrayNonEmpty(names) && Option.isSome(Str.match(patternOf(names))(text)),\n ),\n Option.map(({ directory }) => directory),\n );\n\nconst named = (workspaces: readonly NamedWorkspace[], text: string): Option.Option<string> =>\n Option.orElse(matching(workspaces, text), () =>\n matching(workspaces, Str.replaceAll(WORD_SEPARATORS, SPACE)(text)),\n );\n\nconst containing = (workspaces: readonly NamedWorkspace[], path: string): Option.Option<string> =>\n pipe(\n workspaces,\n Arr.findFirst(\n ({ directory }) => path === directory || Str.startsWith(`${directory}${SEPARATOR}`)(path),\n ),\n Option.map(({ directory }) => directory),\n );\n\nconst namesIn = (name: string, source: string): readonly Located[] => {\n const root = parseDocument(source).contents;\n return [\n { text: name, offset: START },\n ...Option.toArray(stringOf(childOf(\"name\")(root))),\n ...keysOf(childOf(\"jobs\")(root)),\n ];\n};\n\nconst filtersIn = (source: string): readonly Located[] =>\n pipe(\n scalarsIn(source),\n Arr.flatMap(({ text, offset }) =>\n pipe(\n Arr.fromIterable(Str.matchAll(PACKAGE_FILTER)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[\"value\"])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, offset })),\n ),\n ),\n );\n\nconst reported =\n (where: Where, offset: number, what: string) =>\n (found: Option.Option<string>): readonly Problem[] =>\n pipe(\n found,\n Option.map((directory) => problemAt(where, PACKAGE, packageMessage(what, directory))(offset)),\n Option.toArray,\n );\n\nconst packagesIn = (\n workspaces: readonly NamedWorkspace[],\n { file, name, source }: Readonly<{ file: string; name: string; source: string }>,\n): readonly Problem[] => {\n const where = { file, source };\n const fromNames = pipe(\n namesIn(name, source),\n Arr.flatMap(({ text, offset }) =>\n reported(where, offset, `\"${text}\"`)(named(workspaces, text)),\n ),\n );\n const referenced = pipe(\n workflowReferences(source),\n Arr.filter(({ field }) => !Str.startsWith(\"on.\")(field)),\n Arr.flatMap(({ field, path, offset }) =>\n reported(where, offset, field)(containing(workspaces, path)),\n ),\n );\n const filtered = pipe(\n filtersIn(source),\n Arr.flatMap(({ text, offset }) =>\n reported(where, offset, `--filter ${text}`)(matching(workspaces, text)),\n ),\n );\n return [...fromNames, ...referenced, ...filtered];\n};\n\nconst actionProblems = (\n workspaces: readonly NamedWorkspace[],\n file: string,\n name: string,\n): readonly Problem[] =>\n pipe(\n named(workspaces, name),\n Option.map((directory): Problem => ({\n file,\n line: 1,\n column: 1,\n rule: PACKAGE,\n message: packageMessage(`The action ${name}`, directory),\n })),\n Option.toArray,\n );\n\n/** @internal */\nexport const checkWorkflowScale = Effect.fn(\"checkWorkflowScale\")(function* checkWorkflowScale(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const workspaces = yield* namedWorkspaces(root);\n const workflows = pipe(\n listed,\n Arr.flatMap((name) =>\n pipe(\n groupOf(\"name\")(WORKFLOW.exec(name)),\n Option.map((stem) => ({ name, stem })),\n Option.toArray,\n ),\n ),\n );\n const found = yield* Effect.forEach(\n workflows,\n ({ name, stem }) =>\n Effect.gen(function* problemsOf() {\n const file = files.join(root, name);\n const source = yield* files.readFile(file);\n return pipe(\n source,\n Option.map((text) => [\n ...pathFiltersIn(file, text),\n ...packagesIn(workspaces, { file, name: stem, source: text }),\n ]),\n Option.getOrElse((): readonly Problem[] => []),\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n const actions = pipe(\n listed,\n Arr.flatMap((name) =>\n pipe(\n groupOf(\"name\")(ACTION.exec(name)),\n Option.map((action) => actionProblems(workspaces, files.join(root, name), action)),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n ),\n );\n return [...Arr.flatten(found), ...actions];\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkCommandEntries } from \"./command-entries.ts\";\nimport { checkConfigPaths } from \"./config-paths.ts\";\nimport { checkCrates } from \"./crates.ts\";\nimport { checkDeployEntryPatterns } from \"./deploy-entry-patterns.ts\";\nimport { checkFallowEntries } from \"./fallow-entries.ts\";\nimport { checkRootWorkspacePaths } from \"./root-workspace-paths.ts\";\nimport { checkTasks } from \"./task-checks.ts\";\nimport { checkWorkflowPaths } from \"./workflow-paths.ts\";\nimport { checkWorkflowScale } from \"./workflow-scale.ts\";\n\n/** @internal */\nexport const checkWorkspaces = Effect.fn(\"checkWorkspaces\")(function* checkWorkspaces(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkCommandEntries(root),\n checkConfigPaths(root),\n checkCrates(root),\n checkDeployEntryPatterns(root),\n checkFallowEntries(root),\n checkRootWorkspacePaths(root),\n checkTasks(root),\n checkWorkflowPaths(root),\n checkWorkflowScale(root),\n ],\n {\n concurrency: \"unbounded\",\n },\n );\n return Arr.flatten(found);\n});\n","import { Option, Record as Rec, pipe } from \"effect\";\n\n/** @internal */\nexport const keysOf = (map: Readonly<Record<string, string>> | undefined): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(map),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n","import { Array as Arr, String as Str, pipe } from \"effect\";\n\nconst SCOPE = \"@\";\nconst SEPARATOR = \"/\";\nconst SCOPED_SEGMENTS = 2;\nconst PLAIN_SEGMENTS = 1;\n\nconst segmentCount = (specifier: string): number => {\n if (Str.startsWith(SCOPE)(specifier)) {\n return SCOPED_SEGMENTS;\n }\n return PLAIN_SEGMENTS;\n};\n\nexport const packageNameOf = (specifier: string): string =>\n pipe(Str.split(specifier, SEPARATOR), Arr.take(segmentCount(specifier)), Arr.join(SEPARATOR));\n","import {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Record as Rec,\n Result,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n SyntaxKind,\n isExportDeclaration,\n isImportDeclaration,\n isStringLiteral,\n} from \"#/shared/lib/compiler.ts\";\nimport type { API, Node } from \"#/shared/lib/compiler.ts\";\nimport { packageNameOf } from \"#/shared/lib/package-name.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RELATIVE = /^\\.\\.?(?:\\/|$)/u;\nconst SUBPATH_IMPORT = \"#\";\nconst WILDCARD = \"*\";\nconst SOURCE_SUFFIXES = [\"\", \".ts\", \".tsx\", \"/index.ts\"] as const;\n\nconst ImportsField = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\n\nconst decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));\n\ninterface Graph {\n readonly api: API;\n readonly directory: string;\n readonly imports: Readonly<Record<string, string>>;\n}\n\ninterface Walk {\n readonly pending: readonly string[];\n readonly visited: HashSet.HashSet<string>;\n readonly packages: HashSet.HashSet<string>;\n}\n\ntype Reference = Result.Result<string, string>;\n\nconst literalText = (specifier: Node): Option.Option<string> =>\n pipe(\n Option.liftPredicate(specifier, isStringLiteral),\n Option.map((literal) => literal.text),\n );\n\nconst runtimeSpecifierOf = (statement: Node): Option.Option<string> => {\n if (isImportDeclaration(statement)) {\n const typeOnly = pipe(\n Option.fromUndefinedOr(statement.importClause),\n Option.exists((clause) => clause.phaseModifier === SyntaxKind.TypeKeyword),\n );\n return Option.filter(literalText(statement.moduleSpecifier), () => !typeOnly);\n }\n if (isExportDeclaration(statement) && !statement.isTypeOnly) {\n return Option.flatMap(Option.fromUndefinedOr(statement.moduleSpecifier), literalText);\n }\n return Option.none();\n};\n\nconst specifiersIn = (api: API, file: string, text: string): readonly string[] => {\n const retained = api.createSourceFile(file, text);\n const found = pipe(retained.sourceFile.statements, Arr.fromIterable, Arr.map(runtimeSpecifierOf));\n retained.dispose();\n return Arr.getSomes(found);\n};\n\nconst subpathTarget = (\n imports: Readonly<Record<string, string>>,\n specifier: string,\n): Option.Option<string> =>\n pipe(\n Rec.toEntries(imports),\n Arr.findFirst(([pattern, target]) => {\n if (!Str.endsWith(WILDCARD)(pattern)) {\n return Option.liftPredicate(target, () => pattern === specifier);\n }\n const prefix = Str.replace(WILDCARD, \"\")(pattern);\n return Option.liftPredicate(\n Str.replace(WILDCARD, Str.replace(prefix, \"\")(specifier))(target),\n () => Str.startsWith(prefix)(specifier),\n );\n }),\n );\n\nconst existingSource = Effect.fn(\"existingSource\")(function* existingSource(base: string) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n SOURCE_SUFFIXES,\n (suffix) => {\n const candidate = `${base}${suffix}`;\n return files\n .isDirectory(candidate)\n .pipe(\n Effect.map((directory) =>\n Option.liftPredicate(candidate, () =>\n Option.exists(directory, (isDirectory) => !isDirectory),\n ),\n ),\n );\n },\n { concurrency: 1 },\n );\n return Arr.head(Arr.getSomes(found));\n});\n\nconst localFile = Effect.fn(\"localFile\")(function* localFile(\n { directory, imports }: Graph,\n from: string,\n specifier: string,\n) {\n const files = yield* RepositoryFiles;\n if (RELATIVE.test(specifier)) {\n return yield* existingSource(files.resolve(files.dirname(from), specifier));\n }\n const target = subpathTarget(imports, specifier);\n if (Option.isNone(target)) {\n return Option.none<string>();\n }\n return yield* existingSource(files.resolve(directory, target.value));\n});\n\nconst referenceOf = (\n graph: Graph,\n from: string,\n specifier: string,\n): Effect.Effect<Option.Option<Reference>, never, RepositoryFiles> => {\n if (RELATIVE.test(specifier) || Str.startsWith(SUBPATH_IMPORT)(specifier)) {\n return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));\n }\n const name = packageNameOf(specifier);\n return Effect.succeedSome(Result.fail(name));\n};\n\nconst referencesIn = Effect.fn(\"referencesIn\")(function* referencesIn(graph: Graph, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const specifiers = Option.match(text, {\n onNone: (): readonly string[] => [],\n onSome: (source) => specifiersIn(graph.api, file, source),\n });\n const references = yield* Effect.forEach(\n specifiers,\n (specifier) => referenceOf(graph, file, specifier),\n { concurrency: 1 },\n );\n const found = Arr.getSomes(references);\n return { packages: Arr.getFailures(found), sources: Arr.getSuccesses(found) };\n});\n\nconst packagesFrom = (\n graph: Graph,\n walk: Walk,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(walk.pending, {\n onEmpty: () => Effect.succeed(walk.packages),\n onNonEmpty: ([next, ...rest]) => {\n if (HashSet.has(walk.visited, next)) {\n return packagesFrom(graph, { ...walk, pending: rest });\n }\n return referencesIn(graph, next).pipe(\n Effect.flatMap(({ packages, sources }) =>\n packagesFrom(graph, {\n pending: [...rest, ...sources],\n visited: HashSet.add(walk.visited, next),\n packages: HashSet.union(walk.packages, HashSet.fromIterable(packages)),\n }),\n ),\n );\n },\n });\n\n/** @internal */\nexport const packagesByEntry = Effect.fn(\"packagesByEntry\")(function* packagesByEntry(\n api: API,\n directory: string,\n entries: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const imports = pipe(\n manifest,\n Option.flatMap(decodeImports),\n Option.flatMap((field) => Option.fromUndefinedOr(field.imports)),\n Option.getOrElse((): Readonly<Record<string, string>> => ({})),\n );\n const graph: Graph = { api, directory, imports };\n return yield* Effect.forEach(\n entries,\n (entry) =>\n packagesFrom(graph, {\n pending: [entry],\n visited: HashSet.empty(),\n packages: HashSet.empty(),\n }).pipe(Effect.map((packages) => [entry, packages] as const)),\n { concurrency: 1 },\n );\n});\n","import {\n Array as Arr,\n Effect,\n HashSet,\n Number as Num,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst EMPTY = 0;\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\nconst PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });\nconst PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));\nconst InstalledManifest = Schema.Struct({\n dependencies: DependencyMap,\n optionalDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n peerDependenciesMeta: PeerMeta,\n});\ntype Installed = typeof InstalledManifest.Type;\n\ntype Pending = readonly (readonly [string, string])[];\n\ninterface Collect {\n readonly pending: Pending;\n readonly seen: HashSet.HashSet<string>;\n}\n\nconst decodeManifest = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));\n\nconst isOptionalPeer = (manifest: Installed, name: string): boolean =>\n pipe(\n Option.fromUndefinedOr(manifest.peerDependenciesMeta),\n Option.flatMap(Rec.get(name)),\n Option.exists((meta) => meta.optional === true),\n );\n\nconst installedNames = (manifest: Installed): readonly string[] => [\n ...keysOf(manifest.dependencies),\n ...keysOf(manifest.optionalDependencies),\n ...pipe(\n keysOf(manifest.peerDependencies),\n Arr.filter((name) => !isOptionalPeer(manifest, name)),\n ),\n];\n\nconst childrenOf = Effect.fn(\"childrenOf\")(function* childrenOf(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map(installedNames),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((child) => [directory, child] as const),\n );\n});\n\nconst resolveFrom = (\n from: string,\n name: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* resolvePackage() {\n const files = yield* RepositoryFiles;\n const candidate = files.join(from, NODE_MODULES, name);\n const found = yield* files.exists(files.join(candidate, MANIFEST_FILE));\n if (found) {\n const real = yield* files.realPath(candidate);\n return Option.some(real);\n }\n const parent = files.dirname(from);\n if (parent === from) {\n return Option.none<string>();\n }\n return yield* resolveFrom(parent, name);\n });\n\nconst unseen = (\n from: string,\n name: string,\n seen: HashSet.HashSet<string>,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n resolveFrom(from, name).pipe(\n Effect.map(Option.filter((directory) => !HashSet.has(seen, directory))),\n );\n\nconst closureOf = (\n provided: HashSet.HashSet<string>,\n collect: Collect,\n): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n Arr.match(collect.pending, {\n onEmpty: () => Effect.succeed(collect.seen),\n onNonEmpty: ([[from, name], ...rest]) => {\n if (HashSet.has(provided, name)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return unseen(from, name, collect.seen).pipe(\n Effect.flatMap((resolved) => {\n if (Option.isNone(resolved)) {\n return closureOf(provided, { ...collect, pending: rest });\n }\n return childrenOf(resolved.value).pipe(\n Effect.flatMap((children) =>\n closureOf(provided, {\n pending: [...rest, ...children],\n seen: HashSet.add(collect.seen, resolved.value),\n }),\n ),\n );\n }),\n );\n },\n });\n\nconst directorySize = (directory: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* sizeOfDirectory() {\n const files = yield* RepositoryFiles;\n const names = yield* files.readDirectory(directory);\n const entries = pipe(\n names,\n Arr.filter((name) => name !== NODE_MODULES),\n Arr.map((name) => files.join(directory, name)),\n );\n const sizes = yield* Effect.forEach(\n entries,\n (entry) =>\n files.isDirectory(entry).pipe(\n Effect.flatMap((kind) => {\n if (Option.isNone(kind)) {\n return Effect.succeed(EMPTY);\n }\n if (kind.value) {\n return directorySize(entry);\n }\n return files.fileSize(entry);\n }),\n ),\n { concurrency: 1 },\n );\n return Num.sumAll(sizes);\n });\n\nexport interface ClosureRoot {\n readonly provided: HashSet.HashSet<string>;\n readonly from: string;\n readonly name: string;\n}\n\nexport const installedClosure = ({\n provided,\n from,\n name,\n}: ClosureRoot): Effect.Effect<HashSet.HashSet<string>, never, RepositoryFiles> =>\n closureOf(provided, { pending: [[from, name]], seen: HashSet.empty() });\n\nexport const installedSize = (directory: string): Effect.Effect<number, never, RepositoryFiles> => {\n if (Str.includes(`/${NODE_MODULES}/`)(directory)) {\n return directorySize(directory);\n }\n return Effect.succeed(EMPTY);\n};\n","import {\n Array as Arr,\n Effect,\n HashMap,\n HashSet,\n Number as Num,\n Option,\n Order,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport {\n MANIFEST_FILE,\n STACK_CATALOG,\n publicEntriesOf,\n publishedWorkspaces,\n} from \"#/entities/package/index.ts\";\nimport type { PublicEntry, PublishedWorkspace } from \"#/entities/package/index.ts\";\nimport { typeScriptCompiler } from \"#/entities/project/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { packagesByEntry } from \"./import-graph.ts\";\nimport { installedClosure, installedSize } from \"./installed-closure.ts\";\n\nconst INSTALL_SIZE: RuleName = \"install-size\";\nconst STACK_DEPENDENCY: RuleName = \"stack-dependency\";\nconst BUDGET_KEY = \"installSize\";\nconst DEPENDENCIES_KEY = '\"dependencies\"';\nconst LISTED_LARGEST = 5;\nconst SIZE_CONCURRENCY = 32;\nconst MEGABYTE = 1_000_000;\nconst MEGABYTE_DIGITS = 1;\nconst START = 0;\nconst SINGLE_ENTRY = 1;\n\ninterface DependencySize {\n readonly name: string;\n readonly size: number;\n readonly entries: readonly string[];\n}\n\ninterface Published {\n readonly workspace: PublishedWorkspace;\n readonly entries: readonly PublicEntry[];\n readonly provided: HashSet.HashSet<string>;\n}\n\ninterface Measured {\n readonly closures: readonly (readonly [string, HashSet.HashSet<string>])[];\n readonly sizeOf: (packages: HashSet.HashSet<string>) => number;\n readonly total: number;\n}\n\ninterface Overrun {\n readonly workspace: PublishedWorkspace;\n readonly total: number;\n readonly largest: readonly DependencySize[];\n readonly entryCount: number;\n}\n\nconst megabytes = (bytes: number): string => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;\n\nconst usageHint = (dependency: DependencySize, entryCount: number): string => {\n const partial =\n entryCount > SINGLE_ENTRY &&\n dependency.entries.length > START &&\n dependency.entries.length < entryCount;\n if (!partial) {\n return \"\";\n }\n return ` (imported only from ${Arr.join(dependency.entries, \", \")})`;\n};\n\nconst listed = ({ largest, entryCount }: Overrun): string =>\n pipe(\n largest,\n Arr.map(\n (dependency) =>\n `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`,\n ),\n Arr.join(\", \"),\n );\n\nconst budgetProblem = Effect.fn(\"budgetProblem\")(function* budgetProblem(overrun: Overrun) {\n const files = yield* RepositoryFiles;\n const { workspace, total } = overrun;\n const config = yield* files.readFile(workspace.configFile);\n const source = Option.getOrElse(config, () => \"\");\n const index = Option.getOrElse(Str.indexOf(BUDGET_KEY)(source), () => START);\n return {\n file: workspace.configFile,\n ...positionOf(source)(index),\n rule: INSTALL_SIZE,\n message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed(overrun)}. Make a dependency imported only from some library entries an optional peer, make one that a bin needs at startup a required peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`,\n } satisfies Problem;\n});\n\nconst measure = Effect.fn(\"measure\")(function* measure(\n { workspace, provided }: Published,\n direct: readonly string[],\n) {\n const closures = yield* Effect.forEach(\n direct,\n (name) =>\n installedClosure({ provided, from: workspace.directory, name }).pipe(\n Effect.map((packages) => [name, packages] as const),\n ),\n { concurrency: 1 },\n );\n const everything = pipe(\n closures,\n Arr.flatMap(([, packages]) => Arr.fromIterable(packages)),\n HashSet.fromIterable,\n );\n const measured = yield* Effect.forEach(\n everything,\n (found) => installedSize(found).pipe(Effect.map((size) => [found, size] as const)),\n { concurrency: SIZE_CONCURRENCY },\n );\n const sizes = HashMap.fromIterable(measured);\n const sizeOf = (packages: HashSet.HashSet<string>): number =>\n packages.pipe(\n Arr.fromIterable,\n Arr.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START)),\n Num.sumAll,\n );\n return { closures, sizeOf, total: sizeOf(everything) } satisfies Measured;\n});\n\nconst importersOf = Effect.fn(\"importersOf\")(function* importersOf({\n workspace,\n entries,\n}: Published) {\n const compiler = yield* typeScriptCompiler;\n const sources = pipe(\n entries,\n Arr.map((entry) => entry.source),\n Arr.dedupe,\n );\n const byEntry = yield* packagesByEntry(compiler.api, workspace.directory, sources);\n const reached = HashMap.fromIterable(byEntry);\n return (name: string): readonly string[] =>\n pipe(\n entries,\n Arr.filter((entry) =>\n pipe(HashMap.get(reached, entry.source), Option.exists(HashSet.has(name))),\n ),\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n );\n}, Effect.scoped);\n\nconst bySizeDescending = Order.mapInput(\n Order.flip(Order.Number),\n (dependency: DependencySize) => dependency.size,\n);\n\nconst sizeProblems = Effect.fn(\"sizeProblems\")(function* sizeProblems(\n published: Published,\n direct: readonly string[],\n) {\n const { closures, sizeOf, total } = yield* measure(published, direct);\n if (total <= published.workspace.installBudget) {\n return [];\n }\n const importers = yield* importersOf(published);\n const largest = pipe(\n closures,\n Arr.map(([name, packages]): DependencySize => ({\n name,\n size: sizeOf(packages),\n entries: importers(name),\n })),\n Arr.sortBy(bySizeDescending),\n Arr.take(LISTED_LARGEST),\n );\n const entryCount = pipe(\n published.entries,\n Arr.map((entry) => entry.label),\n Arr.dedupe,\n ).length;\n const problem = yield* budgetProblem({\n workspace: published.workspace,\n total,\n largest,\n entryCount,\n });\n return [problem];\n});\n\nconst stackProblems = (\n file: string,\n source: string,\n dependencies: Readonly<Record<string, string>>,\n): readonly Problem[] => {\n const section = Option.getOrElse(Str.indexOf(DEPENDENCIES_KEY)(source), () => START);\n const rest = Str.slice(section)(source);\n return pipe(\n Rec.toEntries(dependencies),\n Arr.filter(([, specifier]) => specifier === STACK_CATALOG),\n Arr.map(([name]): Problem => ({\n file,\n ...positionOf(source)(\n section + Option.getOrElse(Str.indexOf(`\"${name}\"`)(rest), () => START),\n ),\n rule: STACK_DEPENDENCY,\n message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`,\n })),\n );\n};\n\nconst PublishedManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n peerDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nconst problemsOf = Effect.fn(\"problemsOf\")(function* problemsOf(\n workspace: PublishedWorkspace,\n file: string,\n source: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = Schema.decodeOption(Schema.fromJsonString(PublishedManifest))(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n const dependencies = Option.getOrElse(\n Option.fromUndefinedOr(manifest.value.dependencies),\n () => ({}),\n );\n const entries = publicEntriesOf({\n manifest: manifest.value,\n join: (target) => files.join(workspace.directory, target),\n packEntries: workspace.packEntries,\n });\n const provided = HashSet.fromIterable(keysOf(manifest.value.peerDependencies));\n const sized = yield* sizeProblems({ workspace, entries, provided }, Rec.keys(dependencies));\n return [...stackProblems(file, source, dependencies), ...sized];\n});\n\nconst workspaceProblems = Effect.fn(\"workspaceProblems\")(function* workspaceProblems(\n workspace: PublishedWorkspace,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(workspace.directory, MANIFEST_FILE);\n const source = yield* files.readFile(file);\n return yield* Option.match(source, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: (text) => problemsOf(workspace, file, text),\n });\n});\n\n/** @internal */\nexport const checkPublishedPackages = Effect.fn(\"checkPublishedPackages\")(\n function* checkPublishedPackages(root: string) {\n const workspaces = yield* publishedWorkspaces(root);\n const found = yield* Effect.forEach(workspaces, workspaceProblems, { concurrency: 1 });\n return Arr.flatten(found);\n },\n);\n","import { stripVTControlCharacters } from \"node:util\";\n\nimport { Array as Arr, Option, Predicate, String as Str, pipe } from \"effect\";\n\nconst ERROR_LINE = /\\[[A-Z_]+\\]/u;\nconst SHOWN_ERRORS = 3;\nconst HEADER = \"Build failed\";\nconst NO_DETAIL = \"Run the bundle to see the error.\";\n\nconst linesOf = (error: unknown): readonly string[] =>\n pipe(\n Option.liftPredicate(error, Predicate.isError),\n Option.map(({ message }) => message),\n Option.getOrElse(() => String(error)),\n stripVTControlCharacters,\n Str.split(\"\\n\"),\n Arr.map(Str.trim),\n Arr.filter(Str.isNonEmpty),\n );\n\nexport const bundleErrorDetail = (error: unknown): string => {\n const lines = linesOf(error);\n return pipe(\n lines,\n Arr.filter((line) => ERROR_LINE.test(line)),\n Arr.take(SHOWN_ERRORS),\n Arr.match({\n onEmpty: () =>\n pipe(\n lines,\n Arr.findFirst((line) => !Str.startsWith(HEADER)(line)),\n Option.getOrElse(() => NO_DETAIL),\n ),\n onNonEmpty: Arr.join(\" \"),\n }),\n );\n};\n","import { builtinModules } from \"node:module\";\n\nimport {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { rolldown } from \"vite/rolldown\";\nimport type { InputOptions, OutputChunk } from \"vite/rolldown\";\n\nimport { bundleErrorDetail } from \"#/shared/lib/bundle-error.ts\";\nimport { packageNameOf } from \"#/shared/lib/package-name.ts\";\n\nconst VIRTUAL_PREFIX = \"\\0\";\nconst VIRTUAL = `${VIRTUAL_PREFIX}tree-shaking-consumer`;\nconst VIRTUAL_ID = /^\\0tree-shaking-consumer$/u;\nconst ABSOLUTE = /^(?:[A-Za-z]:)?[\\\\/]/u;\nconst NODE_PROTOCOL = \"node:\";\nconst SUBPATH_IMPORT = \"#\";\nconst RELATIVE_PREFIX = \".\";\nconst NAMESPACE = \"namespace\";\n\nconst Quoted = Schema.fromJsonString(Schema.String);\nconst quote = (text: string): string =>\n pipe(\n Schema.encodeOption(Quoted)(text),\n Option.getOrElse(() => text),\n );\nconst builtins: ReadonlySet<string> = new Set(builtinModules);\n\nexport type Effectful = (id: string) => boolean;\n\nexport const always: Effectful = () => true;\nexport const never: Effectful = () => false;\n\nexport interface BundleScope {\n readonly declared: readonly string[];\n readonly bundled: readonly string[];\n}\n\nexport interface Kept {\n readonly modules: readonly string[];\n readonly packages: readonly string[];\n}\n\nexport interface Consumer {\n readonly entry: string;\n readonly member: Option.Option<string>;\n}\n\nexport type BundleInput =\n | { readonly kind: \"consumer\"; readonly consumer: Consumer }\n | { readonly kind: \"program\"; readonly file: string };\n\nconst taggedError = Schema.TaggedError;\n\nexport class BundleFailed extends taggedError<BundleFailed, { readonly brand: unique symbol }>()(\n \"BundleFailed\",\n { detail: Schema.String },\n) {}\n\nconst failed = (error: unknown): BundleFailed =>\n BundleFailed.make({ detail: bundleErrorDetail(error) });\n\nconst isBare = (specifier: string): boolean =>\n !Str.startsWith(RELATIVE_PREFIX)(specifier) &&\n !Str.startsWith(SUBPATH_IMPORT)(specifier) &&\n !ABSOLUTE.test(specifier) &&\n !Str.startsWith(VIRTUAL_PREFIX)(specifier);\n\nconst isBuiltin = (specifier: string): boolean =>\n Str.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));\n\nconst isExternal =\n ({ declared, bundled }: BundleScope) =>\n (specifier: string, importer: string | undefined): boolean =>\n Predicate.isNotUndefined(importer) &&\n isBare(specifier) &&\n (isBuiltin(specifier) ||\n (Arr.contains(declared, packageNameOf(specifier)) &&\n !Arr.contains(bundled, packageNameOf(specifier))));\n\nconst consumerSource = ({ entry, member }: Consumer): string =>\n Option.match(member, {\n onNone: () => `export * from ${quote(entry)};\\n`,\n onSome: (name) =>\n `import * as ${NAMESPACE} from ${quote(entry)};\\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\\n`,\n });\n\nconst baseOptions = (scope: BundleScope, effectful: Effectful): InputOptions => ({\n platform: \"node\",\n logLevel: \"silent\",\n external: isExternal(scope),\n treeshake: { moduleSideEffects: effectful },\n});\n\nconst consumerPlugin = (consumer: Consumer): InputOptions[\"plugins\"] => [\n {\n name: \"tree-shaking-consumer\",\n resolveId: { filter: { id: VIRTUAL_ID }, handler: (): string => VIRTUAL },\n load: { filter: { id: VIRTUAL_ID }, handler: (): string => consumerSource(consumer) },\n },\n];\n\nconst optionsFor = (scope: BundleScope, input: BundleInput, effectful: Effectful): InputOptions => {\n const base = baseOptions(scope, effectful);\n if (input.kind === \"program\") {\n return { ...base, input: input.file };\n }\n return { ...base, input: VIRTUAL, plugins: consumerPlugin(input.consumer) };\n};\n\nconst isChunk = (item: { readonly type: string }): item is OutputChunk => item.type === \"chunk\";\n\nconst keptBy = (chunks: readonly OutputChunk[]): Kept => ({\n modules: pipe(\n chunks,\n Arr.flatMap((chunk) => Rec.keys(chunk.modules)),\n Arr.filter((id) => !Str.startsWith(VIRTUAL_PREFIX)(id)),\n Arr.dedupe,\n Arr.sortBy(Order.String),\n ),\n packages: pipe(\n chunks,\n Arr.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]),\n Arr.filter((specifier) => isBare(specifier) && !isBuiltin(specifier)),\n Arr.map(packageNameOf),\n Arr.dedupe,\n Arr.sortBy(Order.String),\n ),\n});\n\nconst generate = (options: InputOptions): Effect.Effect<readonly OutputChunk[], BundleFailed> =>\n Effect.acquireUseRelease(\n Effect.tryPromise({ try: () => rolldown(options), catch: failed }),\n (bundle) => Effect.tryPromise({ try: () => bundle.generate({ format: \"esm\" }), catch: failed }),\n (bundle) => Effect.promise(() => bundle.close()),\n ).pipe(Effect.map(({ output }) => pipe(output, Arr.filter(isChunk))));\n\nexport const keptIn = Effect.fn(\"keptIn\")(function* keptIn(\n scope: BundleScope,\n input: BundleInput,\n effectful: Effectful,\n) {\n const chunks = yield* generate(optionsFor(scope, input, effectful));\n return keptBy(chunks);\n});\n\nexport const exportNamesOf = Effect.fn(\"exportNamesOf\")(function* exportNamesOf(\n scope: BundleScope,\n entry: string,\n) {\n const chunks = yield* generate(optionsFor(scope, { kind: \"program\", file: entry }, always));\n return pipe(\n chunks,\n Arr.flatMap((chunk) => chunk.exports),\n Arr.dedupe,\n );\n});\n","import { Array as Arr, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport { STACK_CATALOG, entryNameOf } from \"#/entities/package/index.ts\";\nimport type { PackedWorkspace } from \"#/entities/package/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\n\nimport { always, never } from \"./consumer-bundle.ts\";\nimport type { Effectful } from \"./consumer-bundle.ts\";\n\nconst Versions = Schema.Record(Schema.String, Schema.String);\nconst PeerMeta = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });\n\nexport const Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n sideEffects: Schema.optional(Schema.Unknown),\n dependencies: Schema.optional(Versions),\n devDependencies: Schema.optional(Versions),\n peerDependencies: Schema.optional(Versions),\n optionalDependencies: Schema.optional(Versions),\n peerDependenciesMeta: Schema.optional(Schema.Record(Schema.String, PeerMeta)),\n});\n\nexport const runtimeDependenciesOf = ({\n dependencies,\n peerDependencies,\n optionalDependencies,\n}: typeof Manifest.Type): readonly string[] =>\n pipe([dependencies, peerDependencies, optionalDependencies], Arr.flatMap(keysOf), Arr.dedupe);\n\nexport const optionalPeersOf = ({\n peerDependenciesMeta,\n}: typeof Manifest.Type): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(peerDependenciesMeta),\n Option.map(Rec.filter(({ optional }) => optional === true)),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n\nexport const stackPackagesOf = ({ devDependencies }: typeof Manifest.Type): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(devDependencies),\n Option.map(Rec.filter((specifier) => specifier === STACK_CATALOG)),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst decode = Schema.decodeOption(Schema.fromJsonString(Manifest));\n\nexport const manifestOf = (text: string): Option.Option<typeof Manifest.Type> => decode(text);\n\nexport interface Declared {\n readonly effectful: Effectful;\n readonly entries: ReadonlySet<string>;\n readonly complete: boolean;\n readonly claimed: boolean;\n}\n\nexport interface Locator {\n readonly workspace: PackedWorkspace;\n readonly join: (target: string) => string;\n}\n\nconst isFileList = Schema.is(Schema.Array(Schema.String));\n\nconst sourcesOf = (workspace: PackedWorkspace, target: string): readonly string[] =>\n pipe(\n workspace.packEntries,\n Arr.filter((entry) => entry.name === entryNameOf(target)),\n Arr.map((entry) => entry.source),\n );\n\nconst listedSources = (declared: readonly string[], { workspace, join }: Locator): Set<string> =>\n new Set(\n pipe(\n declared,\n Arr.flatMap((target) => Arr.append(sourcesOf(workspace, target), join(target))),\n ),\n );\n\nexport interface Declaration {\n readonly declared: unknown;\n readonly locator: Locator;\n}\n\nexport const declaredBy = ({ declared, locator }: Declaration): Declared => {\n if (declared === false) {\n return { effectful: never, entries: new Set(), complete: true, claimed: true };\n }\n if (!isFileList(declared)) {\n return { effectful: always, entries: new Set(), complete: false, claimed: false };\n }\n const sources = listedSources(declared, locator);\n return {\n effectful: (id) => sources.has(id),\n entries: sources,\n complete: false,\n claimed: true,\n };\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { isBinEntry } from \"#/entities/package/index.ts\";\nimport { keysOf } from \"#/shared/lib/keys.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport type { Used } from \"./usage.ts\";\n\nconst RULE: RuleName = \"optional-peer\";\nconst REQUIRED_RULE: RuleName = \"required-peer\";\nconst START = 0;\nconst SINGLE = 1;\nconst DEPENDENCIES_KEY = '\"dependencies\"';\nconst PEER_META_KEY = '\"peerDependenciesMeta\"';\n\nexport interface Located {\n readonly file: string;\n readonly source: string;\n}\n\nconst importsPackage =\n (name: string) =>\n ({ packages }: Used): boolean =>\n Arr.contains(packages, name);\n\nconst labelsOf = (importers: readonly Used[]): string =>\n pipe(\n importers,\n Arr.map(({ entry }) => `\\`${entry.label}\\``),\n Arr.dedupe,\n Arr.join(\", \"),\n );\n\nconst positionIn = (\n located: Located,\n key: string,\n name: string,\n): Pick<Problem, \"line\" | \"column\"> => {\n const section = Option.getOrElse(Str.indexOf(key)(located.source), () => START);\n const rest = Str.slice(section)(located.source);\n return positionOf(located.source)(\n section + Option.getOrElse(Str.indexOf(`\"${name}\"`)(rest), () => START),\n );\n};\n\nconst problemFor = (located: Located, name: string, importers: readonly Used[]): Problem => ({\n file: located.file,\n ...positionIn(located, DEPENDENCIES_KEY, name),\n rule: RULE,\n message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`,\n});\n\nconst requiredPeerAdvice = (fromStack: boolean): string => {\n if (fromStack) {\n return \"Make it a required peer by removing it from peerDependenciesMeta; it comes from the stack catalog, so every project that installs this package already has it.\";\n }\n return \"Make it a required peer by removing it from peerDependenciesMeta when every project that installs this package already has it, or move it to dependencies, which count toward msch.publish.installSize.\";\n};\n\nexport interface Peering {\n readonly located: Located;\n readonly dependencies: Readonly<Record<string, string>> | undefined;\n readonly used: readonly Used[];\n}\n\nexport const optionalPeerProblems = ({\n located,\n dependencies,\n used,\n}: Peering): readonly Problem[] => {\n const libraries = pipe(\n used,\n Arr.filter(({ entry }) => !isBinEntry(entry)),\n );\n const bins = pipe(\n used,\n Arr.filter(({ entry }) => isBinEntry(entry)),\n );\n if (libraries.length <= SINGLE) {\n return [];\n }\n return pipe(\n keysOf(dependencies),\n Arr.flatMap((name) => {\n const importers = pipe(libraries, Arr.filter(importsPackage(name)));\n const neededByBin = pipe(bins, Arr.some(importsPackage(name)));\n const partial = importers.length > START && importers.length < libraries.length;\n if (!partial || neededByBin) {\n return [];\n }\n return [problemFor(located, name, importers)];\n }),\n );\n};\n\nexport interface OptionalPeering {\n readonly located: Located;\n readonly optional: readonly string[];\n readonly stack: readonly string[];\n readonly used: readonly Used[];\n}\n\nexport const requiredPeerProblems = ({\n located,\n optional,\n stack,\n used,\n}: OptionalPeering): readonly Problem[] => {\n const libraries = pipe(\n used,\n Arr.filter(({ entry }) => !isBinEntry(entry)),\n );\n return pipe(\n optional,\n Arr.flatMap((name) => {\n const bins = pipe(\n used,\n Arr.filter((entry) => isBinEntry(entry.entry) && importsPackage(name)(entry)),\n );\n const everyLibrary = pipe(\n libraries,\n Option.liftPredicate(\n (all) => Arr.isArrayNonEmpty(all) && pipe(all, Arr.every(importsPackage(name))),\n ),\n Option.getOrElse((): readonly Used[] => []),\n );\n const importers = Arr.appendAll(bins, everyLibrary);\n if (!Arr.isArrayNonEmpty(importers)) {\n return [];\n }\n return [\n {\n file: located.file,\n ...positionIn(located, PEER_META_KEY, name),\n rule: REQUIRED_RULE,\n message: `${name} is an optional peer, but ${labelsOf(importers)} import it at startup, so installing the package without it breaks them. ${requiredPeerAdvice(Arr.contains(stack, name))}`,\n },\n ];\n }),\n );\n};\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport type { PublicEntry } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { exportNamesOf, keptIn, never } from \"./consumer-bundle.ts\";\nimport type { BundleScope, Effectful, Kept } from \"./consumer-bundle.ts\";\n\nconst RULE: RuleName = \"side-effects\";\nconst BUNDLE_CONCURRENCY = 4;\nconst START = 0;\nconst FIRST = 1;\nconst LISTED_PACKAGES = 4;\nconst SIDE_EFFECTS_KEY = '\"sideEffects\"';\nconst EXPORTS_KEY = '\"exports\"';\n\nexport interface Subject {\n readonly scope: BundleScope;\n readonly effectful: Effectful;\n readonly entry: PublicEntry;\n}\n\nexport interface Excess {\n readonly label: string;\n readonly member: string;\n readonly modules: number;\n readonly packages: readonly string[];\n}\n\nconst beyond = (kept: Kept, ideal: Kept): Pick<Excess, \"modules\" | \"packages\"> => ({\n modules: Arr.difference(kept.modules, ideal.modules).length,\n packages: Arr.difference(kept.packages, ideal.packages),\n});\n\nconst memberExcess = Effect.fn(\"memberExcess\")(function* memberExcess(\n { scope, effectful, entry }: Subject,\n member: string,\n) {\n const consumer = { entry: entry.source, member: Option.some(member) };\n const input = { kind: \"consumer\", consumer } as const;\n const kept = yield* keptIn(scope, input, effectful);\n const ideal = yield* keptIn(scope, input, never);\n const extra = beyond(kept, ideal);\n return Option.liftPredicate(\n { label: entry.label, member, ...extra },\n ({ modules }) => modules > START,\n );\n});\n\nexport const excessOf = Effect.fn(\"excessOf\")(function* excessOf(subject: Subject) {\n const names = yield* exportNamesOf(subject.scope, subject.entry.source);\n const found = yield* Effect.forEach(names, (name) => memberExcess(subject, name), {\n concurrency: BUNDLE_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\nconst listed = (names: readonly string[]): string => {\n const shown = pipe(names, Arr.take(LISTED_PACKAGES), Arr.join(\", \"));\n if (names.length > LISTED_PACKAGES) {\n return `${shown} and more`;\n }\n return shown;\n};\n\nconst importsOf = (packages: readonly string[]): string =>\n Arr.match(packages, {\n onEmpty: () => \"\",\n onNonEmpty: (names) => ` and imports ${listed(names)}`,\n });\n\nconst othersOf = (total: number): string => {\n if (total <= FIRST) {\n return \"\";\n }\n return ` The same happens for ${String(total - FIRST)} other exports.`;\n};\n\nconst messageOf = (worst: Excess, total: number): string =>\n `importing \\`${worst.member}\\` from \\`${worst.label}\\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare \"sideEffects\": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;\n\nconst largest = Order.mapInput(Order.flip(Order.Number), (excess: Excess) => excess.modules);\n\nconst keyIndex = (source: string): number =>\n pipe(\n Str.indexOf(SIDE_EFFECTS_KEY)(source),\n Option.orElse(() => Str.indexOf(EXPORTS_KEY)(source)),\n Option.getOrElse(() => START),\n );\n\nexport interface ExcessReport {\n readonly file: string;\n readonly source: string;\n readonly excesses: readonly Excess[];\n}\n\nexport const sideEffectProblems = ({ file, source, excesses }: ExcessReport): readonly Problem[] =>\n pipe(\n excesses,\n Arr.sortBy(largest),\n Arr.head,\n Option.map((worst): Problem => ({\n file,\n ...positionOf(source)(keyIndex(source)),\n rule: RULE,\n message: messageOf(worst, excesses.length),\n })),\n Option.toArray,\n );\n","import { Array as Arr, Effect, Option, Predicate, pipe } from \"effect\";\n\nimport { typeScriptCompiler } from \"#/entities/project/index.ts\";\nimport {\n isExpressionStatement,\n isImportDeclaration,\n isStringLiteral,\n} from \"#/shared/lib/compiler.ts\";\nimport type { API, Node } from \"#/shared/lib/compiler.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"top-level-effect\";\nconst CODE = /\\.[cm]?[jt]sx?$/u;\nconst READ_CONCURRENCY = 16;\nconst IMPORT_MESSAGE =\n \"imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.\";\nconst STATEMENT_MESSAGE =\n \"runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.\";\n\nconst isEffect = (statement: Node): boolean => {\n if (isExpressionStatement(statement)) {\n return !isStringLiteral(statement.expression);\n }\n return isImportDeclaration(statement) && Predicate.isUndefined(statement.importClause);\n};\n\nconst messageOf = (statement: Node): string => {\n if (isImportDeclaration(statement)) {\n return IMPORT_MESSAGE;\n }\n return STATEMENT_MESSAGE;\n};\n\nconst problemsIn =\n (api: API) =>\n (file: string) =>\n (source: string): readonly Problem[] => {\n const retained = api.createSourceFile(file, source);\n const problems = pipe(\n retained.sourceFile.statements,\n Arr.fromIterable,\n Arr.filter(isEffect),\n Arr.map((statement) => problemAt({ rule: RULE, message: messageOf(statement) })(statement)),\n );\n retained.dispose();\n return problems;\n };\n\n/** @internal */\nexport const topLevelEffects = Effect.fn(\"topLevelEffects\")(function* topLevelEffects(\n root: string,\n modules: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const names = yield* files.ownedFiles(root);\n const owned = new Set(\n pipe(\n names,\n Arr.map((name) => files.join(root, name)),\n ),\n );\n const sources = pipe(\n modules,\n Arr.filter((file) => owned.has(file) && CODE.test(file)),\n );\n const found = yield* Effect.forEach(\n sources,\n (file) =>\n files.readFile(file).pipe(\n Effect.map((text) =>\n pipe(\n text,\n Option.map(problemsIn(compiler.api)(file)),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n}, Effect.scoped);\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { isBinEntry } from \"#/entities/package/index.ts\";\nimport type { PublicEntry } from \"#/entities/package/index.ts\";\n\nimport { always, keptIn } from \"./consumer-bundle.ts\";\nimport type { BundleInput, BundleScope } from \"./consumer-bundle.ts\";\nimport type { Declared } from \"./manifest.ts\";\n\nexport interface Used {\n readonly entry: PublicEntry;\n readonly packages: readonly string[];\n readonly modules: readonly string[];\n}\n\nconst inputOf = (entry: PublicEntry): BundleInput => {\n if (isBinEntry(entry)) {\n return { kind: \"program\", file: entry.source };\n }\n return {\n kind: \"consumer\",\n consumer: { entry: entry.source, member: Option.none<string>() },\n };\n};\n\nexport const usedBy = Effect.fn(\"usedBy\")(function* usedBy(scope: BundleScope, entry: PublicEntry) {\n const kept = yield* keptIn(scope, inputOf(entry), always);\n return { entry, packages: kept.packages, modules: kept.modules } satisfies Used;\n});\n\nexport interface Scan {\n readonly used: readonly Used[];\n readonly declared: Declared;\n}\n\nexport const modulesToScan = ({ used, declared }: Scan): readonly string[] =>\n pipe(\n used,\n Arr.filter(({ entry }) => !isBinEntry(entry)),\n Arr.flatMap(({ modules }) => modules),\n Arr.dedupe,\n Arr.filter((module) => !declared.entries.has(module)),\n );\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n isBinEntry,\n packedWorkspaces,\n publicEntriesOf,\n} from \"#/entities/package/index.ts\";\nimport type { PackedWorkspace, PublicEntry } from \"#/entities/package/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { BundleFailed, BundleScope } from \"./consumer-bundle.ts\";\nimport {\n declaredBy,\n manifestOf,\n optionalPeersOf,\n runtimeDependenciesOf,\n stackPackagesOf,\n} from \"./manifest.ts\";\nimport type { Declared, Manifest } from \"./manifest.ts\";\nimport { optionalPeerProblems, requiredPeerProblems } from \"./optional-peers.ts\";\nimport type { Located } from \"./optional-peers.ts\";\nimport { excessOf, sideEffectProblems } from \"./side-effects.ts\";\nimport { topLevelEffects } from \"./top-level-effects.ts\";\nimport { modulesToScan, usedBy } from \"./usage.ts\";\nimport type { Used } from \"./usage.ts\";\n\nconst BUNDLE: RuleName = \"tree-shake-bundle\";\n\nconst BUNDLE_CONCURRENCY = 4;\n\ninterface Package {\n readonly root: string;\n readonly workspace: PackedWorkspace;\n readonly located: Located;\n readonly manifest: typeof Manifest.Type;\n}\n\ninterface Shape {\n readonly scope: BundleScope;\n readonly declared: Declared;\n readonly entries: readonly PublicEntry[];\n}\n\nconst shapeOf = Effect.fn(\"shapeOf\")(function* shapeOf({ workspace, manifest }: Package) {\n const files = yield* RepositoryFiles;\n const join = (target: string): string => files.join(workspace.directory, target);\n const entries = pipe(\n publicEntriesOf({ manifest, join, packEntries: workspace.packEntries }),\n Arr.dedupeWith(\n (left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right),\n ),\n );\n return {\n scope: { declared: runtimeDependenciesOf(manifest), bundled: workspace.alwaysBundle },\n declared: declaredBy({ declared: manifest.sideEffects, locator: { workspace, join } }),\n entries,\n } satisfies Shape;\n});\n\nconst excessesOf = Effect.fn(\"excessesOf\")(function* excessesOf({\n scope,\n declared,\n entries,\n}: Shape) {\n if (declared.complete) {\n return [];\n }\n const shaken = pipe(\n entries,\n Arr.filter((entry) => !isBinEntry(entry) && !declared.entries.has(entry.source)),\n );\n const found = yield* Effect.forEach(\n shaken,\n (entry) => excessOf({ scope, effectful: declared.effectful, entry }),\n { concurrency: BUNDLE_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\nconst effectsOf = Effect.fn(\"effectsOf\")(function* effectsOf(\n root: string,\n declared: Declared,\n used: readonly Used[],\n) {\n if (!declared.claimed) {\n return [];\n }\n return yield* topLevelEffects(root, modulesToScan({ used, declared }));\n});\n\nconst analyse = Effect.fn(\"analyse\")(function* analyse(pack: Package) {\n const { root, located, manifest } = pack;\n const shape = yield* shapeOf(pack);\n const excesses = yield* excessesOf(shape);\n const used = yield* Effect.forEach(shape.entries, (entry) => usedBy(shape.scope, entry), {\n concurrency: BUNDLE_CONCURRENCY,\n });\n const effects = yield* effectsOf(root, shape.declared, used);\n return [\n ...sideEffectProblems({ file: located.file, source: located.source, excesses }),\n ...effects,\n ...optionalPeerProblems({ located, dependencies: manifest.dependencies, used }),\n ...requiredPeerProblems({\n located,\n optional: optionalPeersOf(manifest),\n stack: stackPackagesOf(manifest),\n used,\n }),\n ];\n});\n\nconst bundleProblem = (file: string, error: BundleFailed): readonly Problem[] => [\n problemInFile(BUNDLE)(file, `does not bundle for the tree-shaking check. ${error.detail}`),\n];\n\nconst workspaceProblems = Effect.fn(\"workspaceProblems\")(function* workspaceProblems(\n root: string,\n workspace: PackedWorkspace,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(workspace.directory, MANIFEST_FILE);\n const source = yield* files.readFile(file);\n const manifest = pipe(source, Option.flatMap(manifestOf));\n if (Option.isNone(source) || Option.isNone(manifest)) {\n return [];\n }\n const located = { file, source: source.value };\n return yield* analyse({ root, workspace, located, manifest: manifest.value }).pipe(\n Effect.catchTag(\"BundleFailed\", (error) => Effect.succeed(bundleProblem(file, error))),\n );\n});\n\n/** @internal */\nexport const checkTreeShaking = Effect.fn(\"checkTreeShaking\")(function* checkTreeShaking(\n root: string,\n) {\n const workspaces = yield* packedWorkspaces(root);\n const found = yield* Effect.forEach(\n workspaces,\n (workspace) => workspaceProblems(root, workspace),\n { concurrency: 1 },\n );\n return Arr.flatten(found);\n});\n","import { parse } from \"@pnpm/deps.path\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { lockedGraph } from \"#/entities/workspace/index.ts\";\nimport type { LockedNode } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"legacy-typescript\";\nconst LOCKFILE = \"pnpm-lock.yaml\";\nconst COMPILER = \"typescript\";\nconst CURRENT_MAJOR = 7;\nconst LEGACY_COMPILER_PACKAGE = /^@typescript\\/typescript\\d+$/u;\nconst FIRST = 1;\n\ninterface Legacy {\n readonly id: string;\n readonly name: string;\n}\n\nconst legacyOf = (id: string): Option.Option<Legacy> => {\n const { name, version } = parse(id);\n const isOldCompiler =\n name === COMPILER &&\n pipe(\n Option.fromNullishOr(version),\n Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))),\n Option.exists((found) => found.major < CURRENT_MAJOR),\n );\n return pipe(\n Option.fromNullishOr(name),\n Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? \"\")),\n Option.map((found) => ({ id, name: found })),\n );\n};\n\nconst dependentsOf =\n (nodes: readonly LockedNode[]) =>\n (id: string): readonly string[] =>\n pipe(\n nodes,\n Arr.filter(({ dependencies }) => Arr.contains(dependencies, id)),\n Arr.map((node) => `\\`${node.id}\\``),\n );\n\nconst lineOf =\n (source: string) =>\n (id: string): number =>\n pipe(\n Str.split(source, \"\\n\"),\n Arr.findFirstIndex((line) => Str.replaceAll(\"'\", \"\")(Str.trim(line)) === `${id}:`),\n Option.match({ onNone: () => FIRST, onSome: (index) => index + FIRST }),\n );\n\nconst messageOf = (legacy: Legacy, dependents: readonly string[]): string =>\n `\\`${legacy.id}\\` is installed, pulled in by ${Arr.join(dependents, \", \")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;\n\n/** @internal */\nexport const checkTypescriptGeneration = Effect.fn(\"checkTypescriptGeneration\")(\n function* checkTypescriptGeneration(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, LOCKFILE);\n const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));\n const read = yield* files.readFile(file);\n const source = Option.getOrElse(read, () => \"\");\n return pipe(\n Option.getOrElse(nodes, (): readonly LockedNode[] => []),\n Arr.flatMap(({ id }) => Option.toArray(legacyOf(id))),\n Arr.map((legacy): Problem => ({\n file,\n line: lineOf(source)(legacy.id),\n column: FIRST,\n rule: RULE,\n message: messageOf(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id)),\n })),\n );\n },\n);\n","import { Array as Arr, Effect, Option } from \"effect\";\nimport { rolldown } from \"vite/rolldown\";\n\nimport { bundledEntries } from \"#/entities/workspace/index.ts\";\nimport { bundleErrorDetail } from \"#/shared/lib/bundle-error.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"worker-bundle\";\nconst BUNDLE_CONCURRENCY = 4;\nconst PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];\nconst CONDITIONS = [\"workerd\", \"worker\", \"browser\", \"import\", \"module\", \"default\"];\n\nconst problemFor = problemInFile(RULE);\n\nconst problemOf = (file: string, detail: string): Problem =>\n problemFor(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);\n\nconst bundleProblem = (file: string): Effect.Effect<Option.Option<Problem>> =>\n Effect.gen(function* bundle() {\n const built = yield* Effect.tryPromise({\n try: () =>\n rolldown({\n input: file,\n platform: \"neutral\",\n external: PLATFORM_MODULES,\n resolve: { conditionNames: CONDITIONS },\n logLevel: \"silent\",\n }),\n catch: bundleErrorDetail,\n });\n yield* Effect.tryPromise({\n try: () => built.generate({ format: \"esm\" }),\n catch: bundleErrorDetail,\n });\n yield* Effect.promise(() => built.close());\n }).pipe(\n Effect.match({\n onSuccess: () => Option.none<Problem>(),\n onFailure: (detail) => Option.some(problemOf(file, detail)),\n }),\n );\n\n/** @internal */\nexport const checkWorkerBundles = Effect.fn(\"checkWorkerBundles\")(function* checkWorkerBundles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* bundledEntries(root);\n const found = yield* Effect.forEach(entries, (entry) => bundleProblem(files.join(root, entry)), {\n concurrency: BUNDLE_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkTreeShaking } from \"#/features/check-tree-shaking/index.ts\";\nimport { checkTypescriptGeneration } from \"#/features/check-typescript-generation/index.ts\";\nimport { checkWorkerBundles } from \"#/features/check-worker-bundles/index.ts\";\n\n/** @internal */\nexport const checkBuilds = Effect.fn(\"checkBuilds\")(function* checkBuilds(root: string) {\n const found = yield* Effect.all(\n [checkTypescriptGeneration(root), checkWorkerBundles(root), checkTreeShaking(root)],\n {\n concurrency: \"unbounded\",\n },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option } from \"effect\";\n\nimport {\n isCallExpression,\n isNewExpression,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Expression,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignatureDeclaration,\n TypeSymbol,\n TypeNode,\n VariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/syntax.ts\";\n\ntype AnnotatedDeclaration =\n | ParameterDeclaration\n | VariableDeclaration\n | PropertySignatureDeclaration\n | PropertyDeclaration;\n\nconst ANNOTATED_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.Parameter,\n SyntaxKind.VariableDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotated = (declaration: Declaration): declaration is AnnotatedDeclaration =>\n ANNOTATED_KINDS.has(declaration.kind);\n\nexport const annotationOf = (declaration: Declaration): Option.Option<TypeNode> =>\n Option.liftPredicate(declaration, isAnnotated).pipe(\n Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)),\n );\n\nconst argumentSlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const call = expression.parent;\n if (!isCallExpression(call) && !isNewExpression(call)) {\n return Option.none();\n }\n const { arguments: listed } = call;\n const callArguments: readonly Expression[] = listed ?? [];\n const index = callArguments.indexOf(expression);\n return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.filter(isSignatureDeclaration),\n Option.flatMap((declaration) => Arr.get(declaration.parameters, index)),\n );\n };\n\nconst propertySlot =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> => {\n const assignment = expression.parent;\n if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(\n Option.flatMap((objectType) =>\n Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText())),\n ),\n Option.flatMap((property) => Arr.head(declarationsOf(property))),\n );\n };\n\nconst variableSlot = (expression: Expression): Option.Option<Declaration> => {\n const declaration = expression.parent;\n if (!isVariableDeclaration(declaration) || declaration.initializer !== expression) {\n return Option.none();\n }\n return Option.some(declaration);\n};\n\nexport const slotOf =\n (checker: Checker) =>\n (expression: Expression): Option.Option<Declaration> =>\n argumentSlot(checker)(expression).pipe(\n Option.orElse(() => propertySlot(checker)(expression)),\n Option.orElse(() => variableSlot(expression)),\n );\n\nexport const contextSymbolsOf =\n (checker: Checker) =>\n (expression: Expression): readonly TypeSymbol[] => {\n const alias = Option.fromUndefinedOr(checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) => Option.fromUndefinedOr(contextual.getAliasSymbol())),\n );\n if (Option.isSome(alias)) {\n return [alias.value];\n }\n return slotOf(checker)(expression).pipe(\n Option.flatMap(annotationOf),\n Option.map((annotation) => referencedSymbols(checker)(annotation)),\n Option.getOrElse(() => []),\n );\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n getNameOfDeclaration,\n isClassDeclaration,\n isElementAccessExpression,\n isIdentifier,\n isInterfaceDeclaration,\n isPropertyAccessExpression,\n isSignatureDeclaration,\n isTypeAliasDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n ClassDeclaration,\n Declaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SignatureDeclaration,\n SourceFile,\n TypeNode,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n contains,\n declarationsOf,\n descendantsOf,\n isExternalDeclaration,\n packageOf,\n symbolAt,\n} from \"#/shared/lib/syntax.ts\";\nimport { isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { ValueSite } from \"./sites.ts\";\nimport { annotationOf, slotOf } from \"./slots.ts\";\n\nexport interface Flow {\n readonly site: ValueSite;\n readonly target: string;\n}\n\nexport interface FlowContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly sites: readonly ValueSite[];\n}\n\nconst MODULE_PREFIX = /^\".*?\"\\./u;\n\nconst externalDeclarationOf =\n (context: FlowContext) =>\n (symbol: TypeSymbol): Option.Option<Declaration> =>\n Arr.findFirst(declarationsOf(symbol), (declaration) =>\n isExternalDeclaration(context.program)(declaration),\n );\n\nconst aliasTarget =\n (context: FlowContext) =>\n (type: Type): Option.Option<string> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) =>\n externalDeclarationOf(context)(alias).pipe(\n Option.map(\n (declaration) =>\n `${Str.replace(MODULE_PREFIX, \"\")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`,\n ),\n ),\n ),\n );\n\nconst isNamedContainer = (\n node: Node,\n): node is SignatureDeclaration | InterfaceDeclaration | ClassDeclaration =>\n isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);\n\nconst slotTarget =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<string> =>\n slotOf(context.checker)(expression).pipe(\n Option.filter((slot) => isExternalDeclaration(context.program)(slot)),\n Option.filter((slot) =>\n Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot))),\n ),\n Option.map((slot) => {\n const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(\n Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))),\n Option.map((name) => ` of ${name.getText()}`),\n Option.getOrElse(() => \"\"),\n );\n const name = Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(\n Option.map((found) => found.getText()),\n Option.getOrElse(() => \"value\"),\n );\n return `${name}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;\n }),\n );\n\nconst libraryTargetOf =\n (context: FlowContext) =>\n (expression: Expression, contextual: Type): Option.Option<string> =>\n aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));\n\nconst siteWithin =\n (context: FlowContext) =>\n (node: Node): Option.Option<ValueSite> =>\n Arr.findFirst(context.sites, (site) => contains(node)(site.node));\n\nconst aliasDeclarationOf = (type: Type): Option.Option<Node> =>\n Option.fromUndefinedOr(type.getAliasSymbol()).pipe(\n Option.flatMap((alias) => Arr.findFirst(declarationsOf(alias), isTypeAliasDeclaration)),\n );\n\nconst aliasSite =\n (context: FlowContext) =>\n (type: Type): Option.Option<ValueSite> =>\n Option.flatMap(aliasDeclarationOf(type), siteWithin(context));\n\nconst annotationAt =\n (checker: Checker) =>\n (expression: Expression): Option.Option<TypeNode> =>\n symbolAt(checker)(expression).pipe(\n Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)),\n Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())),\n Option.flatMap(annotationOf),\n );\n\nconst annotationSite =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n annotationAt(context.checker)(expression).pipe(\n Option.flatMap((annotation) =>\n siteWithin(context)(annotation).pipe(\n Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))),\n ),\n ),\n );\n\nconst siteBehind =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<ValueSite> =>\n aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(\n Option.orElse(() => annotationSite(context)(expression)),\n );\n\nconst isFlowSource = (node: Node): node is Expression =>\n isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst flowOf =\n (context: FlowContext) =>\n (expression: Expression): Option.Option<Flow> =>\n Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(\n Option.flatMap((contextual) =>\n Option.all([\n vocabularyOf(context.checker)(contextual),\n libraryTargetOf(context)(expression, contextual),\n ]),\n ),\n Option.flatMap(([vocabulary, target]) =>\n siteBehind(context)(expression).pipe(\n Option.filter((site) => isSubsetOf(site.values, vocabulary.values)),\n Option.map((site) => ({ site, target })),\n ),\n ),\n );\n\nexport const flowsIn =\n (context: FlowContext) =>\n (sourceFile: SourceFile): readonly Flow[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isFlowSource(node)),\n Arr.map((node) => flowOf(context)(node)),\n ),\n );\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n isCallExpression,\n isExportDeclaration,\n isImportDeclaration,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSignatureDeclaration,\n isSourceFile,\n isStringLiteral,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node, SourceFile, StringLiteral } from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n descendantsOf,\n isInsideAny,\n symbolAtLocation,\n} from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf } from \"#/shared/lib/values.ts\";\n\nconst NAME = /^[\\w@.#/:$-]{2,}$/u;\n\nconst REQUIRE = \"require\";\n\nconst isModuleSpecifier = (node: StringLiteral): boolean => {\n const { parent } = node;\n return (\n isImportDeclaration(parent) ||\n isExportDeclaration(parent) ||\n parent.kind === SyntaxKind.ExternalModuleReference ||\n parent.kind === SyntaxKind.LiteralType ||\n (isCallExpression(parent) &&\n (parent.expression.kind === SyntaxKind.ImportKeyword ||\n parent.expression.getText() === REQUIRE))\n );\n};\n\nconst isModuleScope = (node: Node): boolean => {\n const { parent } = node;\n if (isSourceFile(parent)) {\n return true;\n }\n return !isSignatureDeclaration(parent) && isModuleScope(parent);\n};\n\nconst isModuleConstant = (node: Node): boolean =>\n isVariableDeclaration(node.parent) &&\n node.parent.initializer === node &&\n isModuleScope(node.parent);\n\nconst isDefinition = (node: StringLiteral): boolean => {\n const { parent } = node;\n if (isPropertyAssignment(parent)) {\n return (\n parent.initializer === node &&\n isObjectLiteralExpression(parent.parent) &&\n isModuleConstant(parent.parent)\n );\n }\n return isModuleConstant(node);\n};\n\nconst isTyped =\n (checker: Checker) =>\n (node: StringLiteral): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst specifierOf = (statement: Node): Option.Option<StringLiteral> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));\n};\n\nconst importedFilesOf =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map(specifierOf),\n Arr.getSomes,\n Arr.flatMap((specifier) =>\n pipe(\n symbolAtLocation(checker)(specifier),\n Option.flatMap((symbol) => Arr.head(declarationsOf(symbol))),\n Option.map((declaration) => declaration.getSourceFile().fileName),\n Option.toArray,\n ),\n ),\n Arr.dedupe,\n );\n\nconst freeLiteralsIn =\n (checker: Checker) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly string[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node): node is StringLiteral => isStringLiteral(node)),\n Arr.filter((node) => NAME.test(node.text)),\n Arr.filter(isDefinition),\n Arr.filter((node) => !isModuleSpecifier(node)),\n Arr.filter((node) => !isInsideAny(excluded)(node) && !isTyped(checker)(node)),\n Arr.map((node) => node.text),\n Arr.dedupe,\n );\n\nexport interface FileFacts {\n readonly file: string;\n readonly values: readonly string[];\n readonly imports: readonly string[];\n}\n\nexport const fileFactsIn =\n (checker: Checker) =>\n (sourceFiles: readonly SourceFile[], excluded: readonly Node[]): readonly FileFacts[] =>\n pipe(\n sourceFiles,\n Arr.map((sourceFile) => ({\n file: sourceFile.fileName,\n values: freeLiteralsIn(checker)(sourceFile, excluded),\n imports: importedFilesOf(checker)(sourceFile),\n })),\n Arr.filter(\n (facts) =>\n Arr.isReadonlyArrayNonEmpty(facts.values) || Arr.isReadonlyArrayNonEmpty(facts.imports),\n ),\n );\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport type { PackageScope, UnownedSite } from \"./duplicates.ts\";\nimport type { FileFacts } from \"./free-literals.ts\";\n\nconst RULE: RuleName = \"hand-written-names\";\n\nexport const MINIMUM_NAMES = 2;\n\nexport const MISSING_ALLOWANCE = 1;\n\nexport const TEST_FILE = /\\.test(?:\\.[\\w-]+)?\\.[cm]?tsx?$/u;\n\nexport interface FileLiterals extends FileFacts {\n readonly scope: PackageScope;\n}\n\nexport interface NameList {\n readonly site: UnownedSite;\n readonly names: readonly string[];\n}\n\nexport const nameListOf = (site: UnownedSite): Option.Option<NameList> => {\n if (TEST_FILE.test(site.file) || site.values.length < MINIMUM_NAMES) {\n return Option.none();\n }\n const names = pipe(site.values, Arr.filter(Predicate.isString));\n return Option.liftPredicate({ site, names }, (list) => list.names.length === site.values.length);\n};\n\nexport const mostNamesOf = (list: NameList): number =>\n Math.max(MINIMUM_NAMES, list.names.length - MISSING_ALLOWANCE);\n\nexport interface Listed {\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly names: readonly string[];\n readonly reason: string;\n}\n\nexport const listedProblem = ({ file, line, column, names, reason }: Listed): Problem => ({\n file,\n line,\n column,\n rule: RULE,\n message: `The names ${formatValues(names)} are listed by hand, but ${reason}`,\n});\n\nexport const problemOf = ({\n list,\n reason,\n}: Readonly<{ list: NameList; reason: string }>): Problem =>\n listedProblem({\n file: list.site.file,\n line: list.site.line,\n column: list.site.column,\n names: list.names,\n reason,\n });\n","import { Array as Arr, HashSet, Option, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport { SymbolFlags, isArrayLiteralExpression, isStringLiteral } from \"#/shared/lib/compiler.ts\";\nimport type { ArrayLiteralExpression, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n columnOf,\n carriesTag,\n declarationsOf,\n declaresAType,\n descendantsOf,\n isOutsideDeclaration,\n lineOf,\n} from \"#/shared/lib/syntax.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport { MINIMUM_NAMES, TEST_FILE, listedProblem } from \"./name-lists.ts\";\n\nconst IDENTIFIER = /^[A-Za-z_$][\\w$]*$/u;\n\nconst HALF = 2;\n\nconst outsideTypeIn = (project: Project): ((name: string) => boolean) => {\n const exported = HashSet.fromIterable(project.library.typeNames);\n const values = HashSet.fromIterable([\n ...project.library.tagNames,\n ...pipe(\n project.library.vocabularies,\n Arr.flatMap(({ vocabulary }) => vocabulary.values),\n ),\n ]);\n const known = new Map<string, boolean>();\n const isOutside = isOutsideDeclaration(project.program);\n const isGlobalType = (name: string): boolean =>\n pipe(\n Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)),\n Option.map(declarationsOf),\n Option.exists(\n (declarations) =>\n declaresAType(declarations) &&\n !carriesTag(name)(declarations) &&\n pipe(declarations, Arr.every(isOutside)),\n ),\n );\n return (name) =>\n known.getOrInsertComputed(\n name,\n () =>\n IDENTIFIER.test(name) &&\n !HashSet.has(values, name) &&\n (HashSet.has(exported, name) || isGlobalType(name)),\n );\n};\n\nconst namesIn = (list: ArrayLiteralExpression): readonly string[] =>\n pipe(\n list.elements,\n Arr.filter(isStringLiteral),\n Arr.map((element) => element.text),\n );\n\nconst problemIn =\n (isOutsideType: (name: string) => boolean) =>\n (list: ArrayLiteralExpression): Option.Option<Problem> => {\n const names = namesIn(list);\n const outside = pipe(names, Arr.filter(isOutsideType));\n if (outside.length < Math.max(MINIMUM_NAMES, names.length / HALF)) {\n return Option.none();\n }\n return Option.some(\n listedProblem({\n file: list.getSourceFile().fileName,\n line: lineOf(list),\n column: columnOf(list),\n names,\n reason: `${formatValues(outside)} are types that the language or a package declares. Let the code that reads this list decide by where each type is declared, so that a new type does not mean a new entry.`,\n }),\n );\n };\n\nexport const outsideNameProblemsIn = (\n project: Project,\n): ((sourceFile: SourceFile) => readonly Problem[]) => {\n const problemOfList = problemIn(outsideTypeIn(project));\n return (sourceFile) => {\n if (TEST_FILE.test(sourceFile.fileName)) {\n return [];\n }\n return pipe(\n descendantsOf(sourceFile),\n Arr.filter(isArrayLiteralExpression),\n Arr.map(problemOfList),\n Arr.getSomes,\n );\n };\n};\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport {\n getJSDocTags,\n getTextOfJSDocComment,\n isIdentifier,\n isSourceFile,\n isVariableDeclaration,\n isVariableDeclarationList,\n isVariableStatement,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SourceFile,\n Type,\n VariableDeclaration,\n VariableDeclarationList,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, descendantsOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, formatValues, literalValuesOf, sameValues } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface Owner {\n readonly conceptId: string;\n readonly key: string;\n readonly name: string;\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly packageName: Option.Option<string>;\n readonly values: readonly Value[];\n}\n\nexport interface OwnerScan {\n readonly owners: readonly Owner[];\n readonly problems: readonly Problem[];\n}\n\ninterface Annotated {\n readonly node: Node;\n readonly conceptId: string;\n}\n\nexport const OWNER_TAG = \"msch\";\nconst FIRST_OWNER_COUNT = 1;\n\nexport const ownerKeyOf = (declaration: Declaration): Option.Option<string> => {\n if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) {\n return Option.none();\n }\n return Option.some(`${declaration.getSourceFile().fileName}#${declaration.name.text}`);\n};\n\nconst annotationsOf = (node: Node): readonly Annotated[] =>\n pipe(\n getJSDocTags(node),\n Arr.filter((tag) => tag.tagName.text === OWNER_TAG),\n Arr.map((tag) => ({ node, conceptId: Str.trim(getTextOfJSDocComment(tag.comment) ?? \"\") })),\n );\n\nconst ANNOTATABLE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.VariableDeclaration,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.PropertyAssignment,\n SyntaxKind.PropertyDeclaration,\n]);\n\nconst isAnnotatable = (node: Node): boolean => ANNOTATABLE_KINDS.has(node.kind);\n\nconst isConstList = (list: VariableDeclarationList): boolean =>\n Option.fromUndefinedOr(list.getFirstToken()).pipe(\n Option.exists((token) => token.kind === SyntaxKind.ConstKeyword),\n );\n\nconst isModuleStatementList = (list: VariableDeclarationList): boolean =>\n isVariableStatement(list.parent) && isSourceFile(list.parent.parent);\n\nconst isModuleConstList = (node: Node): node is VariableDeclarationList =>\n isVariableDeclarationList(node) && isModuleStatementList(node) && isConstList(node);\n\nconst isModuleConst = (node: Node): node is VariableDeclaration =>\n isVariableDeclaration(node) && isIdentifier(node.name) && isModuleConstList(node.parent);\n\nconst objectValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalValuesOf(\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => checker.getTypeOfSymbol(property)),\n ),\n );\n\nconst ownerValuesOf =\n (checker: Checker) =>\n (declaration: VariableDeclaration): Option.Option<readonly Value[]> => {\n const type = checker.getTypeAtLocation(declaration.name);\n return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));\n };\n\nconst annotationProblem = (message: string): ((node: Node) => Problem) =>\n problemAt({ rule: \"owner-annotation\", message });\n\nconst scanned = (owners: readonly Owner[], problems: readonly Problem[]): OwnerScan => ({\n owners,\n problems,\n});\n\nconst ownerOf =\n (project: Project) =>\n (annotated: Annotated): OwnerScan => {\n const { node, conceptId } = annotated;\n if (!isModuleConst(node)) {\n return scanned(\n [],\n [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)],\n );\n }\n if (conceptId === \"\") {\n return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);\n }\n const values = ownerValuesOf(project.checker)(node);\n return Option.match(Option.all([values, ownerKeyOf(node)]), {\n onNone: () =>\n scanned(\n [],\n [annotationProblem(`The owner of ${conceptId} holds no finite value set.`)(node)],\n ),\n onSome: ([ownedValues, key]) =>\n scanned(\n [\n {\n conceptId,\n key,\n name: node.name.getText(),\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n packageName: project.packageName,\n values: ownedValues,\n },\n ],\n [],\n ),\n });\n };\n\nconst annotatedIn = (sourceFile: SourceFile): readonly Annotated[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isAnnotatable(node)),\n Arr.flatMap((node) => annotationsOf(node)),\n );\n\nconst ownerProblem =\n (message: string) =>\n (owner: Owner): Problem => ({\n file: owner.file,\n line: owner.line,\n column: owner.column,\n rule: \"owner-annotation\",\n message,\n });\n\nconst conflictProblems = (owners: readonly Owner[]): readonly Problem[] =>\n pipe(\n owners,\n Arr.flatMap((owner, index) => {\n const earlier = Arr.take(owners, index);\n const sameConcept = pipe(\n earlier,\n Arr.filter((other) => other.conceptId === owner.conceptId),\n );\n const sameSet = pipe(\n earlier,\n Arr.filter(\n (other) => other.conceptId !== owner.conceptId && sameValues(other.values, owner.values),\n ),\n );\n return [\n ...pipe(\n Arr.take(sameConcept, FIRST_OWNER_COUNT),\n Arr.map(() =>\n ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner),\n ),\n ),\n ...pipe(\n Arr.take(sameSet, FIRST_OWNER_COUNT),\n Arr.map((other) =>\n ownerProblem(\n `The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`,\n )(owner),\n ),\n ),\n ];\n }),\n );\n\nexport const ownersIn = (project: Project): OwnerScan => {\n const results = pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n annotatedIn(sourceFile),\n Arr.map((annotated) => ownerOf(project)(annotated)),\n ),\n ),\n );\n return scanned(\n pipe(\n results,\n Arr.flatMap((result) => result.owners),\n ),\n pipe(\n results,\n Arr.flatMap((result) => result.problems),\n ),\n );\n};\n\nexport const combineOwnerScans = (scans: readonly OwnerScan[]): OwnerScan => {\n const owners = Arr.dedupeWith(\n pipe(\n scans,\n Arr.flatMap((scan) => scan.owners),\n ),\n (left, right) => left.key === right.key,\n );\n const problems = [\n ...pipe(\n scans,\n Arr.flatMap((scan) => scan.problems),\n ),\n ...conflictProblems(owners),\n ];\n return { owners, problems };\n};\n\nexport const ownerDeclarationsIn =\n (owners: readonly Owner[]) =>\n (project: Project): readonly VariableDeclaration[] => {\n const keys = new Set(\n pipe(\n owners,\n Arr.map((owner) => owner.key),\n ),\n );\n return pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) =>\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isVariableDeclaration(node)),\n Arr.filter((declaration) =>\n Option.exists(ownerKeyOf(declaration), (key) => keys.has(key)),\n ),\n ),\n ),\n );\n };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { declarationKey, locationOf } from \"#/entities/project/index.ts\";\nimport { isSatisfiesExpression, isVariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, Node } from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, referencedSymbols } from \"#/shared/lib/syntax.ts\";\n\nconst contractOf = (node: Node): readonly Node[] => {\n const { parent } = node;\n if (isSatisfiesExpression(parent) && parent.expression === node) {\n return [parent.type];\n }\n if (isVariableDeclaration(parent) && parent.initializer === node) {\n return Option.toArray(Option.fromUndefinedOr(parent.type));\n }\n return [];\n};\n\nexport const derivedDeclarationsOf =\n (checker: Checker) =>\n (node: Node): ReadonlySet<string> => {\n const scopes = Arr.prepend(contractOf(node), node);\n return new Set(\n pipe(\n scopes,\n Arr.flatMap((scope) => referencedSymbols(checker)(scope)),\n Arr.flatMap((symbol) => declarationsOf(symbol)),\n Arr.map((declaration) => declarationKey(locationOf(declaration))),\n ),\n );\n };\n","import { Array as Arr, pipe } from \"effect\";\n\nimport type { LibraryShape } from \"#/entities/project/index.ts\";\nimport type { Checker, Type, TypeSymbol } from \"#/shared/lib/compiler.ts\";\nimport { declarationsOf, packageOf } from \"#/shared/lib/syntax.ts\";\n\nexport interface OpenTypeIds {\n readonly any: number;\n readonly unknown: number;\n}\n\nexport const openTypeIdsOf = (checker: Checker): OpenTypeIds => ({\n any: checker.getAnyType().id,\n unknown: checker.getUnknownType().id,\n});\n\nexport interface PropertyContext {\n readonly checker: Checker;\n readonly open: OpenTypeIds;\n}\n\nexport const sameProperty =\n ({ checker, open }: PropertyContext) =>\n (localType: Type, library: TypeSymbol): boolean => {\n const libraryType = checker.getTypeOfSymbol(library);\n return (\n libraryType.id !== open.any &&\n libraryType.id !== open.unknown &&\n checker.isTypeAssignableTo(localType, libraryType) &&\n checker.isTypeAssignableTo(libraryType, localType)\n );\n };\n\nexport const declaredBy =\n (shape: LibraryShape) =>\n (library: TypeSymbol): boolean => {\n const owner = packageOf(shape.declaration.file);\n return pipe(\n declarationsOf(library),\n Arr.some((declaration) => packageOf(declaration.getSourceFile().fileName) === owner),\n );\n };\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport { declarationKey, describeLibraryType, isObjectType } from \"#/entities/project/index.ts\";\nimport type { DeclarationLocation, LibraryShape } from \"#/entities/project/index.ts\";\nimport {\n isCallExpression,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isObjectLiteralExpression,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n VariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n descendantsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n symbolAtLocation,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf } from \"#/shared/lib/values.ts\";\n\nimport { derivedDeclarationsOf } from \"./derivation.ts\";\nimport { declaredBy, openTypeIdsOf, sameProperty } from \"./property-match.ts\";\nimport type { OpenTypeIds } from \"./property-match.ts\";\n\nexport interface ShapeContext {\n readonly checker: Checker;\n readonly program: Program;\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface ShapeSite {\n readonly node: Node;\n readonly type: Type;\n}\n\ninterface ShapeMatch {\n readonly shape: LibraryShape;\n readonly extra: number;\n}\n\nconst MINIMUM_SHAPE_PROPERTIES = 3;\nconst EXACT = 0;\n\nconst augmentsAModule = (node: Node): boolean => {\n const block = node.parent;\n return (\n isModuleBlock(block) && isModuleDeclaration(block.parent) && isStringLiteral(block.parent.name)\n );\n};\n\nconst isPlainInterface = (node: Node): node is InterfaceDeclaration =>\n isInterfaceDeclaration(node) && !isGenericDeclaration(node) && !augmentsAModule(node);\n\nconst isPlainTypeLiteral = (node: Node): node is TypeAliasDeclaration =>\n isTypeAliasDeclaration(node) && !isGenericDeclaration(node) && isTypeLiteralNode(node.type);\n\nconst isDeclaredShape = (node: Node): node is InterfaceDeclaration | TypeAliasDeclaration =>\n isPlainInterface(node) || isPlainTypeLiteral(node);\n\nconst declaredShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> =>\n Option.liftPredicate(node, isDeclaredShape).pipe(\n Option.map((declaration) => checker.getTypeAtLocation(declaration.name)),\n );\n\nconst schemaShapeOf =\n (checker: Checker) =>\n (node: Node): Option.Option<Type> => {\n if (!isCallExpression(node)) {\n return Option.none();\n }\n const { arguments: callArguments } = node;\n if (\n !pipe(\n callArguments,\n Arr.some((argument) => isObjectLiteralExpression(argument)),\n )\n ) {\n return Option.none();\n }\n return schemaTypeOf(checker)(checker.getTypeAtLocation(node)).pipe(\n Option.filter((type) => isObjectType(checker)(type)),\n );\n };\n\nconst shapeSitesIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly ShapeSite[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.map((node) =>\n declaredShapeOf(checker)(node).pipe(\n Option.orElse(() => schemaShapeOf(checker)(node)),\n Option.map((type) => ({ node, type })),\n ),\n ),\n ),\n );\n\ninterface LocalProperty {\n readonly name: string;\n readonly type: Type;\n}\n\ntype IndexedDeclaration =\n | TypeAliasDeclaration\n | InterfaceDeclaration\n | EnumDeclaration\n | VariableDeclaration;\n\nconst isIndexedDeclaration = (node: Node): node is IndexedDeclaration =>\n isTypeDeclaration(node) || isVariableDeclaration(node);\n\nconst declarationAt =\n (program: Program) =>\n (location: DeclarationLocation): Option.Option<IndexedDeclaration> =>\n Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(\n Option.flatMap((sourceFile) =>\n Arr.findFirst(\n descendantsOf(sourceFile),\n (node): node is IndexedDeclaration =>\n node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node),\n ),\n ),\n );\n\nconst shapeTypeOf =\n (context: ShapeContext) =>\n (shape: LibraryShape): Option.Option<Type> => {\n const { checker } = context;\n return declarationAt(context.program)(shape.declaration).pipe(\n Option.flatMap((declaration) =>\n symbolAtLocation(checker)(declaration.name).pipe(\n Option.flatMap((symbol) => {\n if (shape.form === \"declared\") {\n return Option.some(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return schemaTypeOf(checker)(checker.getTypeOfSymbolAtLocation(symbol, declaration));\n }),\n ),\n ),\n );\n };\n\nconst hasEveryName =\n (locals: readonly LocalProperty[]) =>\n (shape: LibraryShape): boolean => {\n const names: ReadonlySet<string> = new Set(shape.propertyNames);\n return pipe(\n locals,\n Arr.every((local) => names.has(local.name)),\n );\n };\n\nconst matchOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (locals: readonly LocalProperty[], shape: LibraryShape): Option.Option<ShapeMatch> => {\n const { checker } = context;\n const matches = shapeTypeOf(context)(shape).pipe(\n Option.exists((shapeType) =>\n pipe(\n locals,\n Arr.every((local) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(\n Option.exists(\n (library) =>\n declaredBy(shape)(library) &&\n sameProperty({ checker, open })(local.type, library),\n ),\n ),\n ),\n ),\n ),\n );\n if (!matches) {\n return Option.none();\n }\n return Option.some({ shape, extra: shape.propertyNames.length - locals.length });\n };\n\nconst localPropertiesOf =\n (checker: Checker) =>\n (symbols: readonly TypeSymbol[]): readonly LocalProperty[] =>\n pipe(\n Arr.zip(symbols, checker.getTypeOfSymbol(symbols)),\n Arr.map(([symbol, type]) => ({ name: symbol.name, type })),\n );\n\nconst matchOrder = Order.mapInput(Order.Number, (match: ShapeMatch) => match.extra);\n\nconst shapeProblem = (site: ShapeSite, matches: readonly ShapeMatch[]): Problem => {\n const shown = pipe(\n Arr.take(matches, CANDIDATE_LIMIT),\n Arr.map((match) => describeLibraryType(match.shape)),\n Arr.join(\", \"),\n );\n const advice = Option.match(\n Arr.findFirst(matches, (match) => match.extra === EXACT),\n {\n onNone: () =>\n \"Derive it from the library type, for example with Pick, instead of copying its properties.\",\n onSome: () => \"Use the library type instead of copying it.\",\n },\n );\n return problemAt({ rule: \"library-shape\", message: `This shape copies ${shown}. ${advice}` })(\n site.node,\n );\n};\n\nconst candidatesOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite, locals: readonly LocalProperty[]): readonly ShapeMatch[] => {\n const derived = derivedDeclarationsOf(context.checker)(site.node);\n const named = pipe(context.shapes, Arr.filter(hasEveryName(locals)));\n if (\n pipe(\n named,\n Arr.some((shape) => derived.has(declarationKey(shape.declaration))),\n )\n ) {\n return [];\n }\n const candidates = pipe(\n named,\n Arr.map((shape) => matchOf(context, open)(locals, shape)),\n Arr.getSomes,\n );\n return Arr.sort(candidates, matchOrder);\n };\n\nconst shapeProblemOf =\n (context: ShapeContext, open: OpenTypeIds) =>\n (site: ShapeSite): Option.Option<Problem> => {\n const symbols = context.checker.getPropertiesOfType(site.type);\n if (symbols.length < MINIMUM_SHAPE_PROPERTIES) {\n return Option.none();\n }\n const locals = localPropertiesOf(context.checker)(symbols);\n return Option.liftPredicate(\n candidatesOf(context, open)(site, locals),\n Arr.isReadonlyArrayNonEmpty,\n ).pipe(Option.map((found) => shapeProblem(site, found)));\n };\n\nexport const shapeProblemsIn =\n (context: ShapeContext) =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const sites = shapeSitesIn(context.checker)(sourceFile);\n if (!Arr.isReadonlyArrayNonEmpty(sites)) {\n return [];\n }\n const open = openTypeIdsOf(context.checker);\n return Arr.getSomes(\n pipe(\n sites,\n Arr.map((site) => shapeProblemOf(context, open)(site)),\n ),\n );\n };\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Project } from \"#/entities/project/index.ts\";\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isElementAccessExpression,\n isEnumDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n isSpreadElement,\n isTypeAliasDeclaration,\n isTypeReferenceNode,\n isUnionTypeNode,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n ArrayLiteralExpression,\n CallExpression,\n Checker,\n Expression,\n Node,\n TypeSymbol,\n TypeNode,\n UnionTypeNode,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n childrenOf,\n isInsideAny,\n declarationsOf,\n isTypeDeclaration,\n propertyNamesOf,\n referencedSymbols,\n symbolAtLocation,\n} from \"#/shared/lib/syntax.ts\";\nimport { finiteValuesOf, isSubsetOf, literalUnionOf, schemaTypeOf } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nexport interface ValueSite {\n readonly node: Node;\n readonly values: readonly Value[];\n readonly sources: readonly TypeSymbol[];\n}\n\nconst namedValuesOf =\n (checker: Checker) =>\n (symbol: TypeSymbol): Option.Option<readonly Value[]> => {\n if (\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isTypeDeclaration(declaration)),\n )\n ) {\n return finiteValuesOf(checker)(checker.getDeclaredTypeOfSymbol(symbol));\n }\n return finiteValuesOf(checker)(checker.getTypeOfSymbol(symbol));\n };\n\nconst hasFiniteContext =\n (checker: Checker) =>\n (node: Expression): boolean =>\n Option.fromUndefinedOr(checker.getContextualType(node)).pipe(\n Option.flatMap(finiteValuesOf(checker)),\n Option.isSome,\n );\n\nconst isNamedValue = (element: Expression): boolean => {\n if (isSpreadElement(element)) {\n return isNamedValue(element.expression);\n }\n return (\n isIdentifier(element) ||\n isPropertyAccessExpression(element) ||\n isElementAccessExpression(element)\n );\n};\n\nconst namesEveryElement = (array: ArrayLiteralExpression): boolean =>\n pipe(\n array.elements,\n Arr.every((element) => isNamedValue(element)),\n );\n\nconst expressionValuesOf =\n (checker: Checker) =>\n (node: Expression): Option.Option<readonly Value[]> => {\n if (hasFiniteContext(checker)(node)) {\n return Option.none();\n }\n const type = checker.getTypeAtLocation(node);\n if (isArrayLiteralExpression(node)) {\n return Option.liftPredicate(node, (array) => !namesEveryElement(array)).pipe(\n Option.flatMap(() => finiteValuesOf(checker)(type)),\n );\n }\n return schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf));\n };\n\nconst selectsKeys =\n (checker: Checker) =>\n (node: UnionTypeNode, values: readonly Value[]): boolean => {\n const { parent } = node;\n if (!isTypeReferenceNode(parent)) {\n return false;\n }\n const typeArguments: readonly TypeNode[] = parent.typeArguments ?? [];\n return pipe(\n typeArguments,\n Arr.filter((argument) => argument !== node),\n Arr.some((argument) =>\n isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument))),\n ),\n );\n };\n\nconst FILTERED_TYPE = 0;\n\nconst isConditionalAlias = (declaration: Node): boolean =>\n isTypeAliasDeclaration(declaration) && declaration.type.kind === SyntaxKind.ConditionalType;\n\nconst filtersBy =\n (checker: Checker) =>\n (node: Node): boolean => {\n const { parent } = node;\n const filtering =\n isTypeReferenceNode(parent) &&\n Arr.findFirstIndex(parent.typeArguments ?? [], (argument) => argument === node).pipe(\n Option.exists((position) => position > FILTERED_TYPE),\n ) &&\n symbolAtLocation(checker)(parent.typeName).pipe(\n Option.map(declarationsOf),\n Option.exists(Arr.some(isConditionalAlias)),\n );\n return filtering || (parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent));\n };\n\nconst unionValuesOf =\n (checker: Checker) =>\n (node: UnionTypeNode): Option.Option<readonly Value[]> =>\n literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(\n Option.filter((values) => !selectsKeys(checker)(node, values) && !filtersBy(checker)(node)),\n );\n\nconst isExpressionSite = (node: Node): node is ArrayLiteralExpression | CallExpression =>\n isArrayLiteralExpression(node) || isCallExpression(node);\n\nconst expressionSiteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> =>\n Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));\n\nconst siteValuesOf =\n (checker: Checker) =>\n (node: Node): Option.Option<readonly Value[]> => {\n if (isUnionTypeNode(node)) {\n return unionValuesOf(checker)(node);\n }\n if (isEnumDeclaration(node)) {\n return literalUnionOf(checker.getTypeAtLocation(node.name));\n }\n return expressionSiteValuesOf(checker)(node);\n };\n\nconst derivationScopeOf = (node: Node): Node => {\n if (isTypeReferenceNode(node.parent)) {\n return node.parent;\n }\n return node;\n};\n\nconst sourcesOf =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] =>\n pipe(\n referencedSymbols(checker)(derivationScopeOf(node)),\n Arr.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))),\n );\n\nexport const sitesUnder =\n (checker: Checker) =>\n (node: Node): readonly ValueSite[] => {\n const nested = pipe(\n childrenOf(node),\n Arr.flatMap((child) => sitesUnder(checker)(child)),\n );\n if (Arr.isReadonlyArrayNonEmpty(nested)) {\n return nested;\n }\n return siteValuesOf(checker)(node).pipe(\n Option.map((values) => ({ node, values, sources: sourcesOf(checker)(node) })),\n Option.toArray,\n );\n };\n\nexport const sitesOutside =\n (checker: Checker) =>\n (project: Project, outers: readonly Node[]): readonly ValueSite[] =>\n pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)),\n Arr.filter((site) => !isInsideAny(outers)(site.node)),\n );\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport { describeLibraryType } from \"#/entities/project/index.ts\";\nimport type { LibraryVocabulary } from \"#/entities/project/index.ts\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isNewExpression,\n isNumericLiteral,\n isPropertyAssignment,\n isStringLiteral,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n SyntaxKind,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n NumericLiteral,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n} from \"#/shared/lib/compiler.ts\";\nimport { CANDIDATE_LIMIT, problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport {\n isInsideAny,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n referencedSymbols,\n uniqueByReference,\n} from \"#/shared/lib/syntax.ts\";\nimport { formatValues, isSubsetOf, vocabularyOf } from \"#/shared/lib/values.ts\";\n\nimport type { Flow } from \"./flows.ts\";\nimport { ownerKeyOf } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { contextSymbolsOf } from \"./slots.ts\";\n\nexport interface ValueContext {\n readonly checker: Checker;\n readonly owners: readonly Owner[];\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly flows: readonly Flow[];\n}\n\nexport interface SiteVerdict {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n}\n\nconst OWNER_SEARCH_DEPTH = 4;\nconst NOTHING_HIDDEN = 0;\n\nconst directOwners =\n (context: ValueContext) =>\n (symbol: TypeSymbol): readonly Owner[] => {\n const keys = Arr.getSomes(\n pipe(\n declarationsOf(symbol),\n Arr.map((declaration) => ownerKeyOf(declaration)),\n ),\n );\n return pipe(\n context.owners,\n Arr.filter((owner) => keys.includes(owner.key)),\n );\n };\n\nconst isFollowable = (declaration: Declaration): boolean =>\n !declaration.getSourceFile().isDeclarationFile &&\n (isTypeAliasDeclaration(declaration) || isVariableDeclaration(declaration));\n\nconst ownersBehind =\n (context: ValueContext) =>\n (symbol: TypeSymbol, ancestors: readonly TypeSymbol[]): readonly Owner[] => {\n const direct = directOwners(context)(symbol);\n if (Arr.isReadonlyArrayNonEmpty(direct) || ancestors.length >= OWNER_SEARCH_DEPTH) {\n return direct;\n }\n const visited = [...ancestors, symbol];\n return uniqueByReference(\n pipe(\n declarationsOf(symbol),\n Arr.filter((declaration) => isFollowable(declaration)),\n Arr.flatMap((declaration) => referencedSymbols(context.checker)(declaration)),\n Arr.filter((referenced) => !visited.includes(referenced)),\n Arr.flatMap((referenced) => ownersBehind(context)(referenced, visited)),\n ),\n );\n };\n\nconst describeOwners = (owners: readonly Owner[]): string =>\n pipe(\n owners,\n Arr.map((owner) => `${owner.conceptId} (${owner.name})`),\n Arr.join(\", \"),\n );\n\nconst verdict = (problems: readonly Problem[], unowned: readonly ValueSite[]): SiteVerdict => ({\n problems,\n unowned,\n});\n\nconst derivedVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = uniqueByReference(\n pipe(\n site.sources,\n Arr.flatMap((source) => ownersBehind(context)(source, [])),\n ),\n );\n const held = pipe(\n owners,\n Arr.flatMap((owner) => owner.values),\n );\n const added = pipe(\n site.values,\n Arr.filter((value) => !isSubsetOf([value], held)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(owners) || !Arr.isReadonlyArrayNonEmpty(added)) {\n return verdict([], []);\n }\n const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;\n return verdict([problemAt({ rule: \"owner-extension\", message })(site.node)], []);\n };\n\nconst libraryCandidates =\n (context: ValueContext) =>\n (site: ValueSite): readonly string[] => {\n const flowing = Arr.dedupe(\n pipe(\n context.flows,\n Arr.filter((flow) => flow.site.node === site.node),\n Arr.map((flow) => flow.target),\n ),\n );\n if (Arr.isReadonlyArrayNonEmpty(flowing)) {\n return flowing;\n }\n if (\n !pipe(\n site.values,\n Arr.some((value) => typeof value === \"string\"),\n )\n ) {\n return [];\n }\n const imported = importedModulesOf(site.node.getSourceFile());\n return Arr.dedupe(\n pipe(\n context.vocabularies,\n Arr.filter((library) => imported.includes(library.specifier)),\n Arr.filter((library) => isSubsetOf(site.values, library.vocabulary.values)),\n Arr.map((library) => describeLibraryType(library)),\n ),\n );\n };\n\nconst listCandidates = (candidates: readonly string[]): string => {\n const shown = pipe(Arr.take(candidates, CANDIDATE_LIMIT), Arr.join(\", \"));\n const hidden = candidates.length - CANDIDATE_LIMIT;\n if (hidden > NOTHING_HIDDEN) {\n return `${shown} and ${String(hidden)} more`;\n }\n return shown;\n};\n\nconst originalVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n const owners = pipe(\n context.owners,\n Arr.filter((owner) => isSubsetOf(site.values, owner.values)),\n );\n if (Arr.isReadonlyArrayNonEmpty(owners)) {\n const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;\n return verdict([problemAt({ rule: \"owner-value-set\", message })(site.node)], []);\n }\n const candidates = libraryCandidates(context)(site);\n if (Arr.isReadonlyArrayNonEmpty(candidates)) {\n const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;\n return verdict([problemAt({ rule: \"library-value-set\", message })(site.node)], []);\n }\n return verdict([], [site]);\n };\n\nexport const siteVerdict =\n (context: ValueContext) =>\n (site: ValueSite): SiteVerdict => {\n if (Arr.isReadonlyArrayNonEmpty(site.sources)) {\n return derivedVerdict(context)(site);\n }\n return originalVerdict(context)(site);\n };\n\nconst VALUE_PARENT_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ReturnStatement,\n SyntaxKind.ArrayLiteralExpression,\n SyntaxKind.ConditionalExpression,\n SyntaxKind.ParenthesizedExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.JsxExpression,\n]);\n\nconst isCallArgument = (node: Node, parent: Node): boolean =>\n (isCallExpression(parent) || isNewExpression(parent)) && parent.expression !== node;\n\nconst isInitializer = (node: Node, parent: Node): boolean =>\n (isPropertyAssignment(parent) || isVariableDeclaration(parent)) && parent.initializer === node;\n\nconst isRightOperand = (node: Node, parent: Node): boolean =>\n isBinaryExpression(parent) && parent.right === node;\n\nconst VALUE_SLOTS = [isCallArgument, isInitializer, isRightOperand];\n\nconst isValuePosition = (node: Node): boolean => {\n const { parent } = node;\n return (\n VALUE_PARENT_KINDS.has(parent.kind) ||\n pipe(\n VALUE_SLOTS,\n Arr.some((isSlot) => isSlot(node, parent)),\n )\n );\n};\n\nconst ownedLiteralProblem =\n (context: ValueContext) =>\n (literal: StringLiteral | NumericLiteral): Option.Option<Problem> =>\n Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(\n Option.filter((contextual) =>\n vocabularyOf(context.checker)(contextual).pipe(\n Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues),\n ),\n ),\n Option.map(() =>\n pipe(\n contextSymbolsOf(context.checker)(literal),\n Arr.flatMap((symbol) => ownersBehind(context)(symbol, [])),\n uniqueByReference,\n Arr.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Arr.map(String)))),\n ),\n ),\n Option.filter((owners) => Arr.isReadonlyArrayNonEmpty(owners)),\n Option.map((owners) =>\n problemAt({\n rule: \"owned-literal\",\n message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`,\n })(literal),\n ),\n );\n\nexport const ownedLiteralProblems =\n (context: ValueContext) =>\n (sourceFile: SourceFile, excluded: readonly Node[]): readonly Problem[] =>\n Arr.getSomes(\n pipe(\n descendantsOf(sourceFile),\n Arr.filter((node) => isStringLiteral(node) || isNumericLiteral(node)),\n Arr.filter((node) => isValuePosition(node)),\n Arr.filter((node) => !isInsideAny(excluded)(node)),\n Arr.map((node) => ownedLiteralProblem(context)(node)),\n ),\n );\n","import { Option, Array as Arr, pipe } from \"effect\";\n\nimport type { Project, SourceCheck } from \"#/entities/project/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { flowsIn } from \"./flows.ts\";\nimport { fileFactsIn } from \"./free-literals.ts\";\nimport type { FileFacts } from \"./free-literals.ts\";\nimport { outsideNameProblemsIn } from \"./outside-names.ts\";\nimport { ownerDeclarationsIn } from \"./owners.ts\";\nimport type { Owner } from \"./owners.ts\";\nimport { shapeProblemsIn } from \"./shapes.ts\";\nimport { sitesOutside } from \"./sites.ts\";\nimport type { ValueSite } from \"./sites.ts\";\nimport { ownedLiteralProblems, siteVerdict } from \"./value-checks.ts\";\n\nexport interface ProjectAnalysis {\n readonly problems: readonly Problem[];\n readonly unowned: readonly ValueSite[];\n readonly literals: readonly FileFacts[];\n}\n\nconst isVisibleTo =\n (project: Project) =>\n (owner: Owner): boolean =>\n pipe(\n project.sourceFiles,\n Arr.some((sourceFile) => sourceFile.fileName === owner.file),\n ) ||\n Option.exists(\n owner.packageName,\n (name) =>\n Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name),\n );\n\nconst nodesOf = (sites: readonly ValueSite[]): readonly ValueSite[\"node\"][] =>\n pipe(\n sites,\n Arr.map((site) => site.node),\n );\n\nexport interface ProjectChecks {\n readonly owners: readonly Owner[];\n readonly sourceChecks: readonly SourceCheck[];\n}\n\nconst fileChecksOf = (\n project: Project,\n sourceChecks: readonly SourceCheck[],\n): readonly ReturnType<SourceCheck>[] => [\n shapeProblemsIn({\n checker: project.checker,\n program: project.program,\n shapes: project.library.shapes,\n }),\n outsideNameProblemsIn(project),\n ...pipe(\n sourceChecks,\n Arr.map((check) => check(project.checker)),\n ),\n];\n\nexport const analyzeProject =\n ({ owners, sourceChecks }: ProjectChecks) =>\n (project: Project): ProjectAnalysis => {\n const { checker } = project;\n const ownerDeclarations = ownerDeclarationsIn(owners)(project);\n const sites = sitesOutside(checker)(project, ownerDeclarations);\n const flowContext = { checker, program: project.program, sites };\n const context = {\n checker,\n owners: pipe(\n owners,\n Arr.filter((owner) => isVisibleTo(project)(owner)),\n ),\n vocabularies: project.library.vocabularies,\n flows: pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => flowsIn(flowContext)(sourceFile)),\n ),\n };\n const verdicts = pipe(\n sites,\n Arr.map((site) => siteVerdict(context)(site)),\n );\n const excluded = [...ownerDeclarations, ...nodesOf(sites)];\n const fileChecks = fileChecksOf(project, sourceChecks);\n return {\n problems: [\n ...pipe(\n verdicts,\n Arr.flatMap((found) => found.problems),\n ),\n ...pipe(\n project.sourceFiles,\n Arr.flatMap((sourceFile) => [\n ...ownedLiteralProblems(context)(sourceFile, excluded),\n ...pipe(\n fileChecks,\n Arr.flatMap((check) => check(sourceFile)),\n ),\n ]),\n ),\n ],\n unowned: pipe(\n verdicts,\n Arr.flatMap((found) => found.unowned),\n ),\n literals: fileFactsIn(checker)(project.sourceFiles, excluded),\n };\n };\n","import {\n Array as Arr,\n Effect,\n Option,\n Schema,\n SchemaTransformation,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { implementationFingerprint } from \"#/entities/project/index.ts\";\nimport type { ProjectInputs } from \"#/entities/project/index.ts\";\nimport { ProblemList } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst CACHE_DIRECTORY = [NODE_MODULES, \".cache\", \"msch\", \"value-owners\"] as const;\nconst CACHE_SUFFIX = \".json\";\nconst EMPTY = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nconst ValueSchema = Schema.Union([Schema.String, Schema.Finite]);\n\nconst Strings = Schema.Array(Schema.String);\n\nconst ScopeSchema = Schema.Struct({ name: Schema.String, dependencies: Strings });\n\nconst FileLiteralsSchema = Schema.Struct({\n scope: ScopeSchema,\n file: Schema.String,\n values: Strings,\n imports: Strings,\n});\n\nconst UnownedSiteSchema = Schema.Struct({\n scope: ScopeSchema,\n file: Schema.String,\n start: Schema.Int,\n line: Schema.Int,\n column: Schema.Int,\n values: Schema.Array(ValueSchema),\n});\n\nconst AnalysisSchema = Schema.Struct({\n problems: ProblemList,\n unowned: Schema.Array(UnownedSiteSchema),\n literals: Schema.Array(FileLiteralsSchema),\n});\n\nexport type Analysis = typeof AnalysisSchema.Type;\n\nexport type Hasher = (text: string) => Effect.Effect<string>;\n\nexport type FileDigest = (file: string) => Effect.Effect<string, never, RepositoryFiles>;\n\nexport interface AnalysisCache {\n readonly root: string;\n readonly directory: string;\n readonly salt: string;\n readonly digestFile: FileDigest;\n readonly hash: Hasher;\n}\n\nconst hasher = Effect.gen(function* currentHasher() {\n const files = yield* RepositoryFiles;\n const hash: Hasher = files.hash;\n return hash;\n});\n\nconst entryOf = (file: string, found: string): string => `${file}${FIELD_SEPARATOR}${found}`;\n\nconst fileDigest = (hash: Hasher): FileDigest => {\n const digests = new Map<string, string>();\n return (file) =>\n Option.match(Option.fromUndefinedOr(digests.get(file)), {\n onSome: Effect.succeed,\n onNone: () =>\n Effect.gen(function* readDigest() {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n const found = yield* hash(Option.getOrElse(text, () => EMPTY));\n digests.set(file, found);\n return found;\n }),\n });\n};\n\nconst digestEntries =\n (digestFile: FileDigest) =>\n (\n named: readonly (readonly [string, string])[],\n ): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.forEach(\n named,\n ([name, file]) => digestFile(file).pipe(Effect.map((found) => entryOf(name, found))),\n { concurrency: 1 },\n );\n\nexport const analysisCache = Effect.fn(\"analysisCache\")(function* analysisCache(\n root: string,\n owners: string,\n) {\n const files = yield* RepositoryFiles;\n const hash = yield* hasher;\n const fingerprint = yield* implementationFingerprint(import.meta.dirname);\n const salt = yield* hash(\n Arr.join([fingerprint, Str.replaceAll(root, EMPTY)(owners)], FIELD_SEPARATOR),\n );\n return {\n root,\n directory: files.join(root, ...CACHE_DIRECTORY),\n salt,\n digestFile: fileDigest(hash),\n hash,\n } satisfies AnalysisCache;\n});\n\nexport const keyOf =\n (cache: AnalysisCache) =>\n (configPath: string, inputs: ProjectInputs): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* deriveKey() {\n const files = yield* RepositoryFiles;\n const entries = yield* digestEntries(cache.digestFile)(\n pipe(\n inputs.files,\n Arr.map((file) => [file, files.join(cache.root, file)] as const),\n ),\n );\n const header = [\n cache.salt,\n files.relative(cache.root, configPath),\n Str.replaceAll(cache.root, EMPTY)(inputs.options),\n ];\n return yield* cache.hash(\n Arr.join([...header, ...inputs.dependencies, ...entries], LINE_SEPARATOR),\n );\n });\n\nconst moved =\n (move: (file: string) => string) =>\n (analysis: Analysis): Analysis => ({\n problems: pipe(\n analysis.problems,\n Arr.map((problem) => ({ ...problem, file: move(problem.file) })),\n ),\n unowned: pipe(\n analysis.unowned,\n Arr.map((site) => ({ ...site, file: move(site.file) })),\n ),\n literals: pipe(\n analysis.literals,\n Arr.map((found) => ({\n ...found,\n file: move(found.file),\n imports: pipe(found.imports, Arr.map(move)),\n })),\n ),\n });\n\nconst entryFile = (cache: AnalysisCache, key: string): string =>\n `${cache.directory}/${key}${CACHE_SUFFIX}`;\n\nconst portableOf = (\n cache: AnalysisCache,\n files: typeof RepositoryFiles.Service,\n): SchemaTransformation.Transformation<Analysis, Analysis> =>\n SchemaTransformation.transform({\n decode: moved((file) => files.resolve(cache.root, file)),\n encode: moved((file) => files.relative(cache.root, file)),\n });\n\nconst codecOf = (\n cache: AnalysisCache,\n): Effect.Effect<Schema.Codec<Analysis, string>, never, RepositoryFiles> =>\n Effect.gen(function* buildCodec() {\n const files = yield* RepositoryFiles;\n const portable = AnalysisSchema.pipe(Schema.decodeTo(AnalysisSchema, portableOf(cache, files)));\n return Schema.fromJsonString(portable);\n });\n\nexport const readAnalysis =\n (cache: AnalysisCache) =>\n (key: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* readCached() {\n const files = yield* RepositoryFiles;\n const codec = yield* codecOf(cache);\n const text = yield* files.readFile(entryFile(cache, key));\n return yield* Option.match(text, {\n onNone: () => Effect.succeedNone,\n onSome: (found) => Schema.decodeEffect(codec)(found).pipe(Effect.option),\n });\n });\n\nexport const writeAnalysis =\n (cache: AnalysisCache) =>\n (key: string, analysis: Analysis): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* writeCached() {\n const files = yield* RepositoryFiles;\n const codec = yield* codecOf(cache);\n const text = yield* Schema.encodeEffect(codec)(analysis).pipe(Effect.option);\n yield* Option.match(text, {\n onNone: () => Effect.void,\n onSome: (found) => files.writeFile(entryFile(cache, key), found),\n });\n });\n\nexport const pruneAnalyses =\n (cache: AnalysisCache) =>\n (kept: readonly string[]): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* pruneCached() {\n const files = yield* RepositoryFiles;\n const keep = new Set(\n pipe(\n kept,\n Arr.map((key) => `${key}${CACHE_SUFFIX}`),\n ),\n );\n const present = yield* files.readDirectory(cache.directory);\n yield* pipe(\n present,\n Arr.filter((name) => !keep.has(name)),\n (items) =>\n Effect.forEach(items, (name) => files.removeFile(files.join(cache.directory, name)), {\n concurrency: 1,\n }),\n Effect.asVoid,\n );\n });\n","import { Array as Arr, Order, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { columnOf, lineOf } from \"#/shared/lib/syntax.ts\";\nimport { formatValues, valueKey } from \"#/shared/lib/values.ts\";\nimport type { Value } from \"#/shared/lib/values.ts\";\n\nimport { OWNER_TAG } from \"./owners.ts\";\nimport type { ValueSite } from \"./sites.ts\";\n\nexport interface PackageScope {\n readonly name: string;\n readonly dependencies: readonly string[];\n}\n\nexport interface UnownedSite {\n readonly scope: PackageScope;\n readonly file: string;\n readonly start: number;\n readonly line: number;\n readonly column: number;\n readonly values: readonly Value[];\n}\n\nconst DUPLICATE_THRESHOLD = 1;\n\nexport const unownedSiteOf =\n (scope: PackageScope) =>\n (site: ValueSite): UnownedSite => ({\n scope,\n file: site.node.getSourceFile().fileName,\n start: site.node.getStart(),\n line: lineOf(site.node),\n column: columnOf(site.node),\n values: site.values,\n });\n\nconst canDerive = (left: UnownedSite, right: UnownedSite): boolean =>\n left.scope.name === right.scope.name ||\n left.scope.dependencies.includes(right.scope.name) ||\n right.scope.dependencies.includes(left.scope.name);\n\nconst siteKey = (site: UnownedSite): string => `${site.file}#${String(site.start)}`;\n\nconst valueSetKey = (site: UnownedSite): string => {\n const keys = pipe(\n site.values,\n Arr.map((value) => valueKey(value)),\n );\n return pipe(Arr.sort(keys, Order.String), Arr.join(\"\\0\"));\n};\n\nexport const duplicateProblems =\n (relative: (file: string) => string) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const unique = Arr.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));\n const groups = Rec.values(Arr.groupBy(unique, (site) => valueSetKey(site)));\n return pipe(\n groups,\n Arr.filter((group) => group.length > DUPLICATE_THRESHOLD),\n Arr.flatMap((group) =>\n pipe(\n group,\n Arr.flatMap((site): readonly Problem[] => {\n const related = pipe(\n group,\n Arr.filter((other) => other !== site && canDerive(site, other)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(related)) {\n return [];\n }\n const others = pipe(\n related,\n Arr.map((other) => `${relative(other.file)}:${String(other.line)}`),\n Arr.join(\", \"),\n );\n return [\n {\n file: site.file,\n line: site.line,\n column: site.column,\n rule: \"duplicate-value-set\",\n message: `The values ${formatValues(site.values)} are also declared at ${others}. Register one owner with /** @${OWNER_TAG} <concept> */ and derive the others from it.`,\n },\n ];\n }),\n ),\n ),\n );\n };\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { MINIMUM_NAMES, TEST_FILE, mostNamesOf, problemOf } from \"./name-lists.ts\";\nimport type { FileLiterals, NameList } from \"./name-lists.ts\";\n\nconst MOST_DEFINING_FILES = 2;\n\nconst SINGLE_NAME = 1;\n\nconst SHOWN_FILES = 3;\n\ninterface Defined {\n readonly scope: PackageScope;\n readonly file: string;\n}\n\ntype DefinedIndex = Readonly<Record<string, readonly Defined[]>>;\n\ntype NameFiles = readonly [string, readonly string[]];\n\nconst canDerive = (left: PackageScope, right: PackageScope): boolean =>\n left.name === right.name ||\n left.dependencies.includes(right.name) ||\n right.dependencies.includes(left.name);\n\nconst definitionsOf = (entry: FileLiterals): readonly (readonly [string, Defined])[] =>\n pipe(\n entry.values,\n Arr.map((value) => [value, { scope: entry.scope, file: entry.file }] as const),\n );\n\nconst uniqueFiles = (pairs: readonly (readonly [string, Defined])[]): readonly Defined[] =>\n pipe(\n pairs,\n Arr.map(([, defined]) => defined),\n Arr.dedupeWith((left, right) => left.file === right.file),\n );\n\nconst definedIndexOf = (files: readonly FileLiterals[]): DefinedIndex =>\n pipe(\n files,\n Arr.filter((entry) => !TEST_FILE.test(entry.file)),\n Arr.flatMap(definitionsOf),\n Arr.groupBy(([value]) => value),\n Rec.map(uniqueFiles),\n );\n\nconst ownedOneByOne = (defined: readonly NameFiles[]): readonly NameFiles[] => {\n const hosted = pipe(\n defined,\n Arr.flatMap(([, files]) => files),\n Arr.groupBy((file) => file),\n Rec.map((files) => files.length),\n );\n const hostsOne = (file: string): boolean =>\n Rec.get(hosted, file).pipe(Option.exists((count) => count === SINGLE_NAME));\n return pipe(\n defined,\n Arr.map(([name, files]) => [name, pipe(files, Arr.filter(hostsOne))] as const),\n );\n};\n\nconst filesDefining =\n (index: DefinedIndex, list: NameList) =>\n (name: string): NameFiles => {\n const files = pipe(\n Rec.get(index, name),\n Option.getOrElse((): readonly Defined[] => []),\n Arr.filter(\n (defined) => defined.file !== list.site.file && canDerive(list.site.scope, defined.scope),\n ),\n Arr.map((defined) => defined.file),\n );\n return [name, files];\n };\n\nconst definingFiles =\n (index: DefinedIndex) =>\n (list: NameList): readonly NameFiles[] =>\n pipe(\n list.names,\n Arr.map(filesDefining(index, list)),\n ownedOneByOne,\n Arr.filter(\n ([, files]) => Arr.isReadonlyArrayNonEmpty(files) && files.length <= MOST_DEFINING_FILES,\n ),\n );\n\nexport const declaredNameProblem = ({\n literals,\n relative,\n}: Readonly<{\n literals: readonly FileLiterals[];\n relative: (file: string) => string;\n}>): ((list: NameList) => Option.Option<Problem>) => {\n const index = definedIndexOf(literals);\n return (list) => {\n const defined = definingFiles(index)(list);\n const files = pipe(\n defined,\n Arr.flatMap(([, found]) => found),\n Arr.dedupe,\n );\n if (defined.length < mostNamesOf(list) || files.length < MINIMUM_NAMES) {\n return Option.none();\n }\n const names = pipe(\n defined,\n Arr.map(([name]) => name),\n );\n const shown = pipe(files, Arr.take(SHOWN_FILES), Arr.map(relative), Arr.join(\", \"));\n return Option.some(\n problemOf({\n list,\n reason: `${formatValues(names)} are each written in another module (${shown}). Type those values with this list, or build this list from them, so that adding one does not mean editing two places.`,\n }),\n );\n };\n};\n","import { Array as Arr, HashSet, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { formatValues } from \"#/shared/lib/values.ts\";\n\nimport { MINIMUM_NAMES, MISSING_ALLOWANCE, problemOf } from \"./name-lists.ts\";\nimport type { NameList } from \"./name-lists.ts\";\nimport type { RepositoryNames } from \"./repository-names.ts\";\n\nconst PATH_PREFIX = /^(?:!|\\.\\/)+/u;\n\nconst GLOB = /[*?{[]/u;\n\nconst EXTENSION = /\\.[^./]+$/u;\n\nconst SEPARATOR = \"/\";\n\nconst ROOT = \".\";\n\nconst namedPath =\n (repository: RepositoryNames, file: string) =>\n (name: string): Option.Option<string> => {\n const bare = pipe(name, Str.replace(PATH_PREFIX, \"\"));\n if (GLOB.test(bare) || Str.isEmpty(bare)) {\n return Option.none();\n }\n const fromFile = repository.relative(repository.join(repository.dirname(file), bare));\n return pipe(\n [fromFile, bare],\n Arr.findFirst((path) => HashSet.has(repository.paths, path)),\n );\n };\n\nconst kindOf =\n (repository: RepositoryNames) =>\n (path: string): string => {\n if (HashSet.has(repository.directories, path)) {\n return SEPARATOR;\n }\n return pipe(\n path,\n Str.match(EXTENSION),\n Option.flatMap(Arr.head),\n Option.getOrElse(() => path),\n );\n };\n\nconst siblingsOf =\n (repository: RepositoryNames) =>\n (path: string): readonly string[] =>\n pipe(\n Rec.get(repository.entries, repository.dirname(path)),\n Option.getOrElse((): readonly string[] => []),\n Arr.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)),\n );\n\nconst coversDirectory =\n (repository: RepositoryNames) =>\n (group: readonly string[]): boolean =>\n pipe(\n Arr.head(group),\n Option.exists(\n (first) =>\n group.length >=\n Math.max(MINIMUM_NAMES, siblingsOf(repository)(first).length - MISSING_ALLOWANCE),\n ),\n );\n\nconst enumeratedDirectory =\n (repository: RepositoryNames) =>\n (paths: readonly string[]): Option.Option<string> =>\n pipe(\n paths,\n Arr.groupBy((path) => `${repository.dirname(path)}${SEPARATOR}${kindOf(repository)(path)}`),\n Rec.values,\n Arr.findFirst(coversDirectory(repository)),\n Option.flatMap(Arr.head),\n Option.map(repository.dirname),\n );\n\nconst directoryLabel = (directory: string): string => {\n if (directory === ROOT) {\n return \"the repository root\";\n }\n return directory;\n};\n\nexport const listedPathProblem =\n (repository: RepositoryNames) =>\n (list: NameList): Option.Option<Problem> => {\n const paths = pipe(list.names, Arr.map(namedPath(repository, list.site.file)), Arr.getSomes);\n const packages = pipe(\n list.names,\n Arr.filter((name) => HashSet.has(repository.packages, name)),\n );\n const directory = enumeratedDirectory(repository)(paths);\n if (Option.isSome(directory)) {\n return Option.some(\n problemOf({\n list,\n reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`,\n }),\n );\n }\n if (packages.length >= MINIMUM_NAMES) {\n return Option.some(\n problemOf({\n list,\n reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`,\n }),\n );\n }\n return Option.none();\n };\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { formatValues, isSubsetOf, sameValues } from \"#/shared/lib/values.ts\";\n\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { problemOf } from \"./name-lists.ts\";\nimport type { FileLiterals, NameList } from \"./name-lists.ts\";\n\nconst SUBSET_SHARE = 2;\n\ntype ImportIndex = Readonly<Record<string, readonly string[]>>;\n\nconst canImport = (importer: PackageScope, imported: PackageScope): boolean =>\n importer.name === imported.name || importer.dependencies.includes(imported.name);\n\nconst importIndexOf = (files: readonly FileLiterals[]): ImportIndex =>\n pipe(\n files,\n Arr.map((entry) => [entry.file, entry.imports] as const),\n Rec.fromEntries,\n );\n\nconst imports =\n (index: ImportIndex) =>\n (importer: string, imported: string): boolean =>\n Rec.get(index, importer).pipe(Option.exists(Arr.contains(imported)));\n\nconst connected =\n (index: ImportIndex) =>\n (left: string, right: string): boolean =>\n left === right || imports(index)(left, right) || imports(index)(right, left);\n\nconst isPartOf =\n (index: ImportIndex, list: NameList) =>\n (other: NameList): boolean =>\n other !== list &&\n canImport(list.site.scope, other.site.scope) &&\n connected(index)(list.site.file, other.site.file) &&\n isSubsetOf(list.names, other.names) &&\n list.names.length * SUBSET_SHARE >= other.names.length &&\n !sameValues(list.names, other.names);\n\nexport const subsetListProblem = ({\n lists,\n literals,\n relative,\n}: Readonly<{\n lists: readonly NameList[];\n literals: readonly FileLiterals[];\n relative: (file: string) => string;\n}>): ((list: NameList) => Option.Option<Problem>) => {\n const index = importIndexOf(literals);\n return (list) =>\n pipe(\n lists,\n Arr.findFirst(isPartOf(index, list)),\n Option.map((other) =>\n problemOf({\n list,\n reason: `they are a part of ${formatValues(other.names)} at ${relative(other.site.file)}:${String(other.site.line)}. Name that list once and select from it with Extract or Exclude.`,\n }),\n ),\n );\n};\n","import { Array as Arr, pipe } from \"effect\";\n\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { declaredNameProblem } from \"./declared-names.ts\";\nimport type { UnownedSite } from \"./duplicates.ts\";\nimport { listedPathProblem } from \"./listed-paths.ts\";\nimport { nameListOf } from \"./name-lists.ts\";\nimport type { FileLiterals } from \"./name-lists.ts\";\nimport type { RepositoryNames } from \"./repository-names.ts\";\nimport { subsetListProblem } from \"./subset-lists.ts\";\n\nexport const handWrittenNameProblems =\n ({\n repository,\n literals,\n }: Readonly<{ repository: RepositoryNames; literals: readonly FileLiterals[] }>) =>\n (sites: readonly UnownedSite[]): readonly Problem[] => {\n const lists = pipe(\n sites,\n Arr.dedupeWith((left, right) => left.file === right.file && left.start === right.start),\n Arr.map(nameListOf),\n Arr.getSomes,\n );\n const { relative } = repository;\n const checks = [\n listedPathProblem(repository),\n declaredNameProblem({ literals, relative }),\n subsetListProblem({ lists, literals, relative }),\n ];\n return pipe(\n lists,\n Arr.map((list) => Arr.findFirst(checks, (check) => check(list))),\n Arr.getSomes,\n );\n };\n","import { Array as Arr, Effect, HashSet, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nexport interface RepositoryNames {\n readonly root: string;\n readonly paths: HashSet.HashSet<string>;\n readonly directories: HashSet.HashSet<string>;\n readonly entries: Readonly<Record<string, readonly string[]>>;\n readonly packages: HashSet.HashSet<string>;\n readonly relative: (file: string) => string;\n readonly join: (...segments: readonly string[]) => string;\n readonly dirname: (file: string) => string;\n}\n\nconst MANIFEST = \"package.json\";\n\nconst SEPARATOR = \"/\";\n\nconst FIRST_SEGMENT = 1;\n\nconst ManifestJson = Schema.fromJsonString(\n Schema.Struct({ name: Schema.optionalKey(Schema.String) }),\n);\n\nconst decodeManifest = Schema.decodeUnknownOption(ManifestJson);\n\nconst prefixesOf = (file: string): readonly string[] => {\n const segments = pipe(file, Str.split(SEPARATOR));\n return pipe(\n Arr.range(FIRST_SEGMENT, segments.length),\n Arr.map((count) => pipe(Arr.take(segments, count), Arr.join(SEPARATOR))),\n );\n};\n\nconst directoriesOf = (file: string): readonly string[] =>\n pipe(prefixesOf(file), Arr.dropRight(FIRST_SEGMENT));\n\nconst nameOf = (text: Option.Option<string>): Option.Option<string> =>\n pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)),\n );\n\nexport const repositoryNamesOf = Effect.fn(\"repositoryNamesOf\")(function* repositoryNamesOf(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const names = yield* pipe(\n listed,\n Arr.filter((file) => files.basename(file) === MANIFEST),\n (items) =>\n Effect.forEach(\n items,\n (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)),\n { concurrency: 1 },\n ),\n );\n const paths = pipe(listed, Arr.flatMap(prefixesOf), Arr.dedupe);\n const repository: RepositoryNames = {\n root,\n paths: HashSet.fromIterable(paths),\n directories: HashSet.fromIterable(pipe(listed, Arr.flatMap(directoriesOf))),\n entries: pipe(paths, Arr.groupBy(files.dirname)),\n packages: HashSet.fromIterable(Arr.getSomes(names)),\n relative: (file) => files.relative(root, file),\n join: files.join,\n dirname: files.dirname,\n };\n return repository;\n});\n","import { Effect, Option, Schema, Array as Arr, pipe } from \"effect\";\n\nimport {\n listConfigFiles,\n mentions,\n projectInputs,\n typeScriptCompiler,\n withProject,\n} from \"#/entities/project/index.ts\";\nimport type { Project, SourceCheck, Workspace } from \"#/entities/project/index.ts\";\nimport { sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { analyzeProject } from \"./analysis.ts\";\nimport type { ProjectChecks } from \"./analysis.ts\";\nimport { analysisCache, keyOf, pruneAnalyses, readAnalysis, writeAnalysis } from \"./cache.ts\";\nimport type { Analysis, AnalysisCache } from \"./cache.ts\";\nimport { duplicateProblems, unownedSiteOf } from \"./duplicates.ts\";\nimport type { PackageScope } from \"./duplicates.ts\";\nimport { handWrittenNameProblems } from \"./hand-lists.ts\";\nimport { OWNER_TAG, combineOwnerScans, ownersIn } from \"./owners.ts\";\nimport type { Owner, OwnerScan } from \"./owners.ts\";\nimport { repositoryNamesOf } from \"./repository-names.ts\";\nimport type { RepositoryNames } from \"./repository-names.ts\";\n\nconst scanOwners = Effect.fn(\"scanOwners\")(function* scanOwners(\n workspace: Workspace,\n configPaths: readonly string[],\n) {\n const ownerConfigs = yield* pipe(\n configPaths,\n Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)),\n );\n const scans = yield* Effect.forEach(\n ownerConfigs,\n (configPath) =>\n withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))),\n { concurrency: 1 },\n );\n return combineOwnerScans(Arr.getSomes(scans));\n});\n\nconst scopeOf = (project: Project, configPath: string): PackageScope => ({\n name: Option.getOrElse(project.packageName, () => configPath),\n dependencies: project.workspaceDependencies,\n});\n\ninterface Context {\n readonly workspace: Workspace;\n readonly owners: readonly Owner[];\n readonly sourceChecks: readonly SourceCheck[];\n readonly cache: AnalysisCache;\n readonly listed: readonly string[];\n}\n\nconst freshAnalysis =\n ({ workspace, owners, sourceChecks }: Context) =>\n (configPath: string): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n withProject(workspace)(configPath)((project) =>\n Effect.sync(() => {\n const analysis = analyzeProject({ owners, sourceChecks })(project);\n const scope = scopeOf(project, configPath);\n return {\n problems: analysis.problems,\n unowned: pipe(analysis.unowned, Arr.map(unownedSiteOf(scope))),\n literals: pipe(\n analysis.literals,\n Arr.map((entry) => ({ ...entry, scope })),\n ),\n };\n }).pipe(Effect.withSpan(\"analyzeProject\")),\n );\n\nconst keyedAnalysis =\n (context: Context) =>\n (\n configPath: string,\n key: string,\n ): Effect.Effect<Option.Option<Analysis>, never, RepositoryFiles> =>\n Effect.gen(function* lookupAnalysis() {\n const cached = yield* readAnalysis(context.cache)(key);\n if (Option.isSome(cached)) {\n return cached;\n }\n const fresh = yield* freshAnalysis(context)(configPath);\n yield* Option.match(fresh, {\n onNone: () => Effect.void,\n onSome: (analysis) => writeAnalysis(context.cache)(key, analysis),\n });\n return fresh;\n });\n\nconst analyzeConfig =\n (context: Context) =>\n (\n configPath: string,\n ): Effect.Effect<Option.Option<readonly [string, Analysis]>, never, RepositoryFiles> =>\n Effect.gen(function* analyzeOne() {\n const inputs = yield* projectInputs(context)(configPath);\n if (Option.isNone(inputs)) {\n return Option.none();\n }\n const key = yield* keyOf(context.cache)(configPath, inputs.value);\n const analysis = yield* keyedAnalysis(context)(configPath, key);\n return pipe(\n analysis,\n Option.map((found) => [key, found] as const),\n );\n });\n\nconst encodeOwners = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst cacheFor = Effect.fn(\"cacheFor\")(function* cacheFor(root: string, owners: readonly Owner[]) {\n const plain = pipe(\n owners,\n Arr.map((owner) => ({ ...owner, packageName: Option.getOrNull(owner.packageName) })),\n );\n const encoded = yield* encodeOwners(plain).pipe(Effect.orElseSucceed(() => \"\"));\n return yield* analysisCache(root, encoded);\n});\n\nconst analyzeProjects = Effect.fn(\"analyzeProjects\")(function* analyzeProjects(\n workspace: Workspace,\n { owners, sourceChecks }: ProjectChecks,\n configPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const cache = yield* cacheFor(workspace.root, owners);\n const listed = yield* files.listedFiles(workspace.root);\n const keyed = yield* Effect.forEach(\n configPaths,\n analyzeConfig({ workspace, owners, sourceChecks, cache, listed }),\n {\n concurrency: 1,\n },\n );\n const found = Arr.getSomes(keyed);\n yield* pruneAnalyses(cache)(\n pipe(\n found,\n Arr.map(([key]) => key),\n ),\n );\n return pipe(\n found,\n Arr.map(([, analysis]) => analysis),\n );\n});\n\nconst repositoryProblems =\n (repository: RepositoryNames) =>\n (analyses: readonly Analysis[]): readonly Problem[] => {\n const unowned = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.unowned),\n );\n const literals = pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.literals),\n );\n return [\n ...pipe(\n analyses,\n Arr.flatMap((analysis) => analysis.problems),\n ),\n ...duplicateProblems(repository.relative)(unowned),\n ...handWrittenNameProblems({ repository, literals })(unowned),\n ];\n };\n\nexport const checkRepository = Effect.fn(\"checkRepository\")(function* checkRepository(\n root: string,\n sourceChecks: readonly SourceCheck[] = [],\n) {\n const files = yield* RepositoryFiles;\n const compiler = yield* typeScriptCompiler;\n const generated = yield* files.generatedFiles(root);\n const workspace: Workspace = { compiler, root, generated };\n const configPaths = yield* listConfigFiles(root);\n const ownerScan: OwnerScan = yield* scanOwners(workspace, configPaths);\n const analyses = yield* analyzeProjects(\n workspace,\n { owners: ownerScan.owners, sourceChecks },\n configPaths,\n );\n const repository = yield* repositoryNamesOf(root);\n return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);\n}, Effect.scoped);\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport {\n SyntaxKind,\n isIdentifier,\n isImportDeclaration,\n isStringLiteral,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type { Node, SourceFile, VariableDeclaration } from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf } from \"#/shared/lib/syntax.ts\";\n\nconst RULE: RuleName = \"namespace-destructuring\";\nconst LOCAL = /^[.#/]/u;\n\nconst messageOf = (name: string): string =>\n `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;\n\nconst isPackage = (specifier: Node): boolean =>\n isStringLiteral(specifier) && !LOCAL.test(specifier.text);\n\nconst importedNames = (sourceFile: SourceFile): readonly string[] => {\n const bindings = pipe(\n sourceFile.statements,\n Arr.filter(isImportDeclaration),\n Arr.filter((declaration) => isPackage(declaration.moduleSpecifier)),\n Arr.map((declaration) => Option.fromUndefinedOr(declaration.importClause)),\n Arr.getSomes,\n Arr.filter((clause) => clause.phaseModifier !== SyntaxKind.TypeKeyword),\n Arr.map((clause) => Option.fromUndefinedOr(clause.namedBindings)),\n Arr.getSomes,\n );\n return pipe(\n bindings,\n Arr.flatMap((binding) => {\n if (binding.kind === SyntaxKind.NamespaceImport) {\n return [binding.name.text];\n }\n return pipe(\n binding.elements,\n Arr.filter((element) => !element.isTypeOnly),\n Arr.map((element) => element.name.text),\n );\n }),\n );\n};\n\nconst destructuredName = (declaration: VariableDeclaration): Option.Option<string> => {\n if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) {\n return Option.none();\n }\n return pipe(\n Option.fromUndefinedOr(declaration.initializer),\n Option.filter(isIdentifier),\n Option.map((initializer) => initializer.text),\n );\n};\n\nconst problemOf =\n (names: readonly string[]) =>\n (declaration: VariableDeclaration): Option.Option<Problem> =>\n pipe(\n destructuredName(declaration),\n Option.filter((name) => names.includes(name)),\n Option.map((name) => problemAt({ rule: RULE, message: messageOf(name) })),\n Option.map((report) => report(declaration)),\n );\n\nexport const namespaceDestructuringIn =\n () =>\n (sourceFile: SourceFile): readonly Problem[] => {\n const names = importedNames(sourceFile);\n return pipe(\n descendantsOf(sourceFile),\n Arr.filter(isVariableDeclaration),\n Arr.map(problemOf(names)),\n Arr.getSomes,\n );\n };\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport {\n SignatureKind,\n SyntaxKind,\n isArrowFunction,\n isBlock,\n isCallExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isIdentifier,\n isNewExpression,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isReturnStatement,\n isSpreadElement,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n ArrowFunction,\n CallExpression,\n Checker,\n Expression,\n FunctionDeclaration,\n FunctionExpression,\n Identifier,\n Node,\n ParameterDeclaration,\n SourceFile,\n} from \"#/shared/lib/compiler.ts\";\nimport { problemAt } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { descendantsOf, symbolAtLocation } from \"#/shared/lib/syntax.ts\";\n\ntype Wrapper = FunctionDeclaration | ArrowFunction | FunctionExpression;\n\ninterface Forward {\n readonly node: Expression;\n readonly callee: Expression;\n readonly kind: SignatureKind;\n readonly arguments: readonly Expression[];\n readonly typed: boolean;\n readonly optional: boolean;\n}\n\ninterface Candidate {\n readonly name: Identifier;\n readonly wrapper: Wrapper;\n}\n\nconst RULE: RuleName = \"pass-through-wrapper\";\nconst SINGLE_STATEMENT = 1;\nconst SINGLE_DECLARATION = 1;\nconst THIS_PARAMETER = \"this\";\nconst NO_ARGUMENTS: readonly Expression[] = [];\n\nconst messageOf = (callee: string): string =>\n `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;\n\nconst unwrapped = (expression: Expression): Expression => {\n if (isParenthesizedExpression(expression)) {\n return unwrapped(expression.expression);\n }\n return expression;\n};\n\nconst isWrapperExpression = (\n expression: Expression,\n): expression is ArrowFunction | FunctionExpression =>\n isArrowFunction(expression) || isFunctionExpression(expression);\n\nconst candidateOf = (node: Node): Option.Option<Candidate> => {\n if (isFunctionDeclaration(node)) {\n return pipe(\n Option.fromUndefinedOr(node.name),\n Option.map((name) => ({ name, wrapper: node })),\n );\n }\n if (!isVariableDeclaration(node) || !isIdentifier(node.name)) {\n return Option.none();\n }\n const { name } = node;\n return pipe(\n Option.fromUndefinedOr(node.initializer),\n Option.map(unwrapped),\n Option.filter(isWrapperExpression),\n Option.map((wrapper) => ({ name, wrapper })),\n );\n};\n\nconst changesTheCall = (wrapper: Wrapper): boolean =>\n Predicate.isNotUndefined(wrapper.asteriskToken) ||\n Option.exists(\n Option.fromUndefinedOr(wrapper.type),\n (type) => type.kind === SyntaxKind.TypePredicate,\n ) ||\n pipe(\n wrapper.modifiers ?? [],\n Arr.some((modifier) => modifier.kind === SyntaxKind.AsyncKeyword),\n );\n\nconst returnedExpression = (wrapper: Wrapper): Option.Option<Expression> => {\n const { body } = wrapper;\n if (Predicate.isUndefined(body)) {\n return Option.none();\n }\n if (!isBlock(body)) {\n return Option.some(body);\n }\n if (body.statements.length !== SINGLE_STATEMENT) {\n return Option.none();\n }\n return pipe(\n Arr.head(body.statements),\n Option.filter((statement) => isReturnStatement(statement)),\n Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)),\n );\n};\n\nconst callForward = (call: CallExpression): Forward => ({\n node: call,\n callee: call.expression,\n kind: SignatureKind.Call,\n arguments: call.arguments,\n typed: Predicate.isNotUndefined(call.typeArguments),\n optional: Predicate.isNotUndefined(call.questionDotToken),\n});\n\nconst forwardOf = (expression: Expression): Option.Option<Forward> => {\n const inner = unwrapped(expression);\n if (isCallExpression(inner)) {\n return Option.some(callForward(inner));\n }\n if (isNewExpression(inner)) {\n return Option.some({\n node: inner,\n callee: inner.expression,\n kind: SignatureKind.Construct,\n arguments: inner.arguments ?? NO_ARGUMENTS,\n typed: Predicate.isNotUndefined(inner.typeArguments),\n optional: false,\n });\n }\n return Option.none();\n};\n\nconst rootOf = (callee: Expression): Option.Option<Identifier> => {\n if (isIdentifier(callee)) {\n return Option.some(callee);\n }\n if (\n isPropertyAccessExpression(callee) &&\n Predicate.isUndefined(callee.questionDotToken) &&\n isIdentifier(callee.name)\n ) {\n return rootOf(callee.expression);\n }\n return Option.none();\n};\n\nconst parameterName = (parameter: ParameterDeclaration): Option.Option<string> => {\n const { name } = parameter;\n if (\n !isIdentifier(name) ||\n Predicate.isNotUndefined(parameter.initializer) ||\n name.text === THIS_PARAMETER\n ) {\n return Option.none();\n }\n return Option.some(name.text);\n};\n\nconst isRest = (parameter: ParameterDeclaration): boolean =>\n Predicate.isNotUndefined(parameter.dotDotDotToken);\n\nconst forwardsParameter = ([parameter, name, argument]: readonly [\n ParameterDeclaration,\n string,\n Expression,\n]): boolean => {\n if (!isRest(parameter)) {\n return isIdentifier(argument) && argument.text === name;\n }\n return (\n isSpreadElement(argument) &&\n isIdentifier(argument.expression) &&\n argument.expression.text === name\n );\n};\n\nconst forwardedNames = (wrapper: Wrapper, forward: Forward): Option.Option<readonly string[]> => {\n const { parameters } = wrapper;\n const names = pipe(parameters, Arr.map(parameterName), Arr.getSomes);\n if (names.length !== parameters.length || forward.arguments.length !== parameters.length) {\n return Option.none();\n }\n const triples = Arr.zipWith(\n Arr.zip(parameters, names),\n forward.arguments,\n ([parameter, name], argument) => [parameter, name, argument] as const,\n );\n return pipe(\n Option.some(names),\n Option.filter(() => pipe(triples, Arr.every(forwardsParameter))),\n );\n};\n\nconst calleeTakesExactly =\n (checker: Checker) =>\n (forward: Forward, count: number): boolean => {\n const signatures = checker.getSignaturesOfType(\n checker.getTypeAtLocation(forward.callee),\n forward.kind,\n );\n return (\n Arr.isReadonlyArrayNonEmpty(signatures) &&\n pipe(\n signatures,\n Arr.every(\n (signature) =>\n !signature.hasRestParameter &&\n signature.parameters.length === count &&\n !Arr.isReadonlyArrayNonEmpty(signature.typeParameters ?? []),\n ),\n )\n );\n };\n\nconst keepsTheReturnType =\n (checker: Checker) =>\n (wrapper: Wrapper, forward: Forward): boolean =>\n Option.match(Option.fromUndefinedOr(wrapper.type), {\n onNone: () => true,\n onSome: (type) =>\n checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id,\n });\n\nconst isOverloaded =\n (checker: Checker) =>\n (name: Identifier): boolean =>\n Option.exists(\n symbolAtLocation(checker)(name),\n (symbol) => symbol.declarations.length > SINGLE_DECLARATION,\n );\n\nconst callsAnotherFunction = (\n { name }: Candidate,\n forward: Forward,\n names: readonly string[],\n): boolean =>\n Option.exists(\n rootOf(forward.callee),\n (root) => root.text !== name.text && !names.includes(root.text),\n );\n\nconst isPassThrough =\n (checker: Checker) =>\n (candidate: Candidate) =>\n (forward: Forward): boolean => {\n const { wrapper, name } = candidate;\n if (forward.typed || forward.optional) {\n return false;\n }\n const restForwarded = pipe(wrapper.parameters, Arr.some(isRest));\n return (\n Option.exists(forwardedNames(wrapper, forward), (names) =>\n callsAnotherFunction(candidate, forward, names),\n ) &&\n (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) &&\n keepsTheReturnType(checker)(wrapper, forward) &&\n !isOverloaded(checker)(name)\n );\n };\n\nconst problemOf =\n (checker: Checker) =>\n (candidate: Candidate): Option.Option<Problem> => {\n if (changesTheCall(candidate.wrapper)) {\n return Option.none();\n }\n return pipe(\n returnedExpression(candidate.wrapper),\n Option.flatMap(forwardOf),\n Option.filter(isPassThrough(checker)(candidate)),\n Option.map((forward) =>\n problemAt({ rule: RULE, message: messageOf(forward.callee.getText()) })(candidate.name),\n ),\n );\n };\n\nexport const passThroughWrappersIn =\n (checker: Checker) =>\n (sourceFile: SourceFile): readonly Problem[] =>\n pipe(\n descendantsOf(sourceFile),\n Arr.map(candidateOf),\n Arr.getSomes,\n Arr.map(problemOf(checker)),\n Arr.getSomes,\n );\n","import { checkRepository } from \"#/features/check-value-owners/index.ts\";\nimport { namespaceDestructuringIn } from \"#/features/source-code/find-namespace-destructuring/index.ts\";\nimport { passThroughWrappersIn } from \"#/features/source-code/find-pass-through-wrappers/index.ts\";\n\n/** @internal */\nexport const checkSources = (root: string): ReturnType<typeof checkRepository> =>\n checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);\n","","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport marketplace from \"#/shared/config/masseater-marketplace.json\" with { type: \"json\" };\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"known-plugins\";\nconst SETTINGS_FILE = \".claude/settings.json\";\nconst GITHUB = \"github\";\n\nconst Source = Schema.Struct({ source: Schema.String, repo: Schema.optionalKey(Schema.String) });\nconst KnownMarketplace = Schema.Struct({ source: Source });\nconst Marketplaces = Schema.Record(Schema.String, KnownMarketplace);\nconst Plugins = Schema.Record(Schema.String, Schema.Boolean);\nconst SettingsSchema = Schema.Struct({\n extraKnownMarketplaces: Schema.optionalKey(Marketplaces),\n enabledPlugins: Schema.optionalKey(Plugins),\n});\nconst decodeSettings = Schema.decodeUnknownOption(Schema.fromJsonString(SettingsSchema));\n\ntype Settings = typeof SettingsSchema.Type;\n\nconst REPOSITORY_NAME = \"masseater/masseater.dev\";\nconst MARKETPLACE = marketplace.name;\nconst PLUGINS = pipe(\n marketplace.plugins,\n Arr.map(({ name }) => `${name}@${MARKETPLACE}`),\n);\n\nconst problem = problemInFile(RULE);\n\nconst fromGithub = ({ source }: typeof KnownMarketplace.Type): boolean =>\n source.source === GITHUB && source.repo === REPOSITORY_NAME;\n\nconst marketplaceKnown = (settings: Settings): boolean =>\n pipe(\n Option.fromUndefinedOr(settings.extraKnownMarketplaces),\n Option.flatMap(Rec.get(MARKETPLACE)),\n Option.exists(fromGithub),\n );\n\nconst pluginEnabled =\n (settings: Settings) =>\n (plugin: string): boolean =>\n pipe(\n Option.fromUndefinedOr(settings.enabledPlugins),\n Option.flatMap(Rec.get(plugin)),\n Option.getOrElse(() => false),\n );\n\nconst marketplaceProblems = (file: string, settings: Settings): readonly Problem[] => {\n if (marketplaceKnown(settings)) {\n return [];\n }\n return [\n problem(\n file,\n `Agents miss masseater's own tools when the ${MARKETPLACE} marketplace is not known. Add \"extraKnownMarketplaces\": { \"${MARKETPLACE}\": { \"source\": { \"source\": \"${GITHUB}\", \"repo\": \"${REPOSITORY_NAME}\" } } }.`,\n ),\n ];\n};\n\nconst pluginProblems = (file: string, settings: Settings): readonly Problem[] => {\n const enabled = pluginEnabled(settings);\n return pipe(\n PLUGINS,\n Arr.filter((plugin) => !enabled(plugin)),\n Arr.map((plugin) =>\n problem(file, `Enable \"${plugin}\" in \"enabledPlugins\" so every session gets it.`),\n ),\n );\n};\n\n/** @internal */\nexport const checkKnownPlugins = Effect.fn(\"checkKnownPlugins\")(function* checkKnownPlugins(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, SETTINGS_FILE);\n const text = yield* files.readFile(file);\n const settings = pipe(\n text,\n Option.flatMap(decodeSettings),\n Option.getOrElse((): Settings => ({})),\n );\n return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"missing-hook\";\nconst SETTINGS_FILE = /^\\.claude\\/settings\\.json$/u;\nconst PLUGIN_HOOKS_FILE = /(?:^|\\/)hooks\\/hooks\\.json$/u;\nconst PROJECT_PATH =\n /(?<optional>--env-file-if-exists=)?\\$\\{?CLAUDE_PROJECT_DIR\\}?(?:\\\\\")?\\/(?<path>[\\w.@/-]+)/gu;\nconst PLUGIN_PATH =\n /(?<optional>--env-file-if-exists=)?\\$\\{?CLAUDE_PLUGIN_ROOT\\}?(?:\\\\\")?\\/(?<path>[\\w.@/-]+)/gu;\nconst PLUGIN_ROOT = \"..\";\nconst READ_CONCURRENCY = 16;\n\ninterface HookFile {\n readonly root: string;\n readonly file: string;\n readonly base: string;\n readonly pattern: RegExp;\n}\n\ninterface Reference {\n readonly path: string;\n readonly index: number;\n}\n\nconst START = 0;\n\nconst referenceOf = (found: RegExpMatchArray): readonly Reference[] =>\n pipe(\n groupOf(\"path\")(found),\n Option.filter(() => Option.isNone(groupOf(\"optional\")(found))),\n Option.map((path): Reference => ({ path, index: found.index ?? START })),\n Option.toArray,\n );\n\nconst referencesIn = (pattern: RegExp, source: string): readonly Reference[] =>\n pipe(Arr.fromIterable(Str.matchAll(pattern)(source)), Arr.flatMap(referenceOf));\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn({\n root,\n file,\n base,\n pattern,\n}: HookFile) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return [];\n }\n const source = text.value;\n const absent = yield* Effect.filter(referencesIn(pattern, source), ({ path }) =>\n files.exists(files.join(base, path)).pipe(Effect.map((exists) => !exists)),\n );\n const targetOf = ({ path }: Reference): string => files.join(base, path);\n const built = yield* files.ignoredPaths(root, pipe(absent, Arr.map(targetOf)));\n const missing = pipe(\n absent,\n Arr.filter((reference) => !Arr.contains(built, targetOf(reference))),\n );\n return pipe(\n missing,\n Arr.map(({ path, index }): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`,\n })),\n );\n});\n\n/** @internal */\nexport const checkMissingHooks = Effect.fn(\"checkMissingHooks\")(function* checkMissingHooks(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const hookFiles = pipe(\n listed,\n Arr.flatMap((name): readonly HookFile[] => {\n const file = files.join(root, name);\n if (SETTINGS_FILE.test(name)) {\n return [{ root, file, base: root, pattern: PROJECT_PATH }];\n }\n if (PLUGIN_HOOKS_FILE.test(name)) {\n return [\n { root, file, base: files.join(files.dirname(file), PLUGIN_ROOT), pattern: PLUGIN_PATH },\n ];\n }\n return [];\n }),\n );\n const found = yield* Effect.forEach(hookFiles, problemsIn, { concurrency: READ_CONCURRENCY });\n return Arr.flatten(found);\n});\n","import { Context, Effect, Option, Schema, Stream, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nconst SUCCESS = 0;\n\nconst PackageSchema = Schema.Struct({ name: Schema.optional(Schema.String) });\nconst TaskSchema = Schema.Struct({ package: Schema.String, name: Schema.String });\n\nconst TaskGraphSchema = Schema.Struct({\n packages: Schema.Record(Schema.String, PackageSchema),\n tasks: Schema.Record(Schema.String, TaskSchema),\n});\n\nexport type TaskGraph = typeof TaskGraphSchema.Type;\n\nconst decodeGraph = Schema.decodeUnknownOption(Schema.fromJsonString(TaskGraphSchema));\n\n/** @internal */\nexport const listedTasks = Effect.fn(\"listedTasks\")(\n function* listedTasks(root: string) {\n const handle = yield* ChildProcess.make(\"vp\", [\"run\", \"--json\"], {\n cwd: root,\n extendEnv: true,\n stdin: \"ignore\",\n stderr: \"ignore\",\n });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return pipe(\n Option.liftPredicate(text, () => Number(code) === SUCCESS),\n Option.flatMap(decodeGraph),\n );\n },\n Effect.scoped,\n Effect.orElseSucceed(() => Option.none<TaskGraph>()),\n);\n\nexport const GivenTaskGraph = Context.Reference<Option.Option<TaskGraph>>(\"msch/GivenTaskGraph\", {\n defaultValue: () => Option.none(),\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { GivenTaskGraph, listedTasks } from \"./task-graph.ts\";\nimport type { TaskGraph } from \"./task-graph.ts\";\n\nconst RULE: RuleName = \"documented-commands\";\nconst DOCUMENTS = [\"*AGENTS.md\", \"*CLAUDE.md\"];\nconst DOCUMENT_NAMES: ReadonlySet<string> = new Set([\"AGENTS.md\", \"CLAUDE.md\"]);\nconst COMMAND = /`vp run (?<args>[^`]+)`/gu;\nconst COMMAND_START = \"`vp run \";\nconst ARGS = \"args\";\nconst PLACEHOLDER = /[<>*{}$]/u;\nconst WHITESPACE = /\\s+/u;\nconst ROOT = \".\";\nconst SEPARATOR = \"/\";\nconst END_OF_OPTIONS = \"--\";\nconst FLAG = \"-\";\nconst TASK_SEPARATOR = \"#\";\nconst LOCAL_PREFIX = \"./\";\nconst FILTER_FLAGS: ReadonlySet<string> = new Set([\"--filter\", \"-F\"]);\nconst FILTER_ASSIGNMENT = \"--filter=\";\nconst RECURSIVE_FLAGS: ReadonlySet<string> = new Set([\"-r\", \"--recursive\"]);\nconst ROOT_FLAGS: ReadonlySet<string> = new Set([\"-w\", \"--workspace-root\"]);\nconst ONE = 1;\nconst START = 0;\n\ntype Scope =\n | { readonly kind: \"here\" }\n | { readonly kind: \"root\" }\n | { readonly kind: \"anywhere\" }\n | { readonly kind: \"package\"; readonly name: string };\n\ninterface Invocation {\n readonly task: string;\n readonly scope: Scope;\n}\n\ninterface Document {\n readonly file: string;\n readonly text: string;\n}\n\nconst optionsOf = (args: string): readonly string[] =>\n pipe(\n Str.split(Str.trim(args), WHITESPACE),\n Arr.takeWhile((token) => token !== END_OF_OPTIONS),\n );\n\nconst filterOf = (tokens: readonly string[]): Option.Option<string> =>\n pipe(\n tokens,\n Arr.findFirstIndex((token) => FILTER_FLAGS.has(token)),\n Option.flatMap((index) => Arr.get(tokens, index + ONE)),\n Option.orElse(() =>\n pipe(\n tokens,\n Arr.findFirst(Str.startsWith(FILTER_ASSIGNMENT)),\n Option.map(Str.slice(FILTER_ASSIGNMENT.length)),\n ),\n ),\n );\n\nconst follows =\n (tokens: readonly string[]) =>\n (index: number): boolean =>\n pipe(\n Arr.get(tokens, index - ONE),\n Option.exists((previous) => FILTER_FLAGS.has(previous)),\n );\n\nconst specifierOf = (tokens: readonly string[]): Option.Option<string> =>\n pipe(\n tokens,\n Arr.findFirstIndex((token, index) => !Str.startsWith(FLAG)(token) && !follows(tokens)(index)),\n Option.flatMap((index) => Arr.get(tokens, index)),\n );\n\nconst hasAny =\n (flags: ReadonlySet<string>) =>\n (tokens: readonly string[]): boolean =>\n pipe(\n tokens,\n Arr.some((token) => flags.has(token)),\n );\n\nconst scopeOf = (tokens: readonly string[]): Scope => {\n const filter = filterOf(tokens);\n if (Option.isSome(filter)) {\n return { kind: \"package\", name: filter.value };\n }\n if (hasAny(RECURSIVE_FLAGS)(tokens)) {\n return { kind: \"anywhere\" };\n }\n if (hasAny(ROOT_FLAGS)(tokens)) {\n return { kind: \"root\" };\n }\n return { kind: \"here\" };\n};\n\nconst invocationOf =\n (tokens: readonly string[]) =>\n (specifier: string): Invocation => {\n const [owner, ...rest] = Str.split(specifier, TASK_SEPARATOR);\n return pipe(\n Arr.head(rest),\n Option.match({\n onNone: (): Invocation => ({ task: specifier, scope: scopeOf(tokens) }),\n onSome: (task): Invocation => ({ task, scope: { kind: \"package\", name: owner } }),\n }),\n );\n };\n\nconst parsed = (args: string): Option.Option<Invocation> => {\n const tokens = optionsOf(args);\n return pipe(\n specifierOf(tokens),\n Option.filter(\n () =>\n !pipe(\n tokens,\n Arr.some((token) => PLACEHOLDER.test(token)),\n ),\n ),\n Option.map(invocationOf(tokens)),\n );\n};\n\nconst ancestorsOf = (file: string): readonly string[] => {\n const parts = pipe(Str.split(file, SEPARATOR), Arr.dropRight(ONE));\n return [\n ...Arr.makeBy(parts.length, (index) =>\n pipe(parts, Arr.take(parts.length - index), Arr.join(SEPARATOR)),\n ),\n ROOT,\n ];\n};\n\nconst named =\n (graph: TaskGraph, name: string) =>\n (directory: string): boolean =>\n directory === Str.replace(LOCAL_PREFIX, \"\")(name) ||\n pipe(\n Rec.get(graph.packages, directory),\n Option.exists((found) => found.name === name),\n );\n\nconst packagesOf =\n (graph: TaskGraph, file: string) =>\n (scope: Scope): readonly string[] => {\n const directories = Rec.keys(graph.packages);\n if (scope.kind === \"anywhere\") {\n return directories;\n }\n if (scope.kind === \"root\") {\n return [ROOT];\n }\n if (scope.kind === \"package\") {\n return pipe(directories, Arr.filter(named(graph, scope.name)));\n }\n return pipe(\n ancestorsOf(file),\n Arr.findFirst((directory) => Rec.has(graph.packages, directory)),\n Option.toArray,\n );\n };\n\nconst hasTask =\n (graph: TaskGraph, task: string) =>\n (directory: string): boolean =>\n pipe(\n Rec.values(graph.tasks),\n Arr.some((found) => found.package === directory && found.name === task),\n );\n\nconst whereOf = (scope: Scope, file: string): string => {\n if (scope.kind === \"anywhere\") {\n return \"any package\";\n }\n if (scope.kind === \"root\") {\n return \"the workspace root\";\n }\n if (scope.kind === \"package\") {\n return `package ${scope.name}`;\n }\n return `the package that holds ${file}`;\n};\n\nconst isMissing =\n (graph: TaskGraph, file: string) =>\n ({ task, scope }: Invocation): boolean =>\n !pipe(packagesOf(graph, file)(scope), Arr.some(hasTask(graph, task)));\n\nconst problemsIn = (\n graph: TaskGraph,\n absolute: (file: string) => string,\n { file, text }: Document,\n): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(COMMAND)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap(Rec.get(ARGS)),\n Option.flatMap(parsed),\n Option.filter(isMissing(graph, file)),\n Option.map(({ task, scope }): Problem => ({\n file: absolute(file),\n ...positionOf(text)(match.index ?? START),\n rule: RULE,\n message: `${match[START]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`,\n })),\n Option.toArray,\n ),\n ),\n );\n\nconst isDocument = (file: string): boolean =>\n pipe(\n Str.split(file, SEPARATOR),\n Arr.last,\n Option.exists((name) => DOCUMENT_NAMES.has(name)),\n );\n\n/** @internal */\nexport const checkDocumentedCommands = Effect.fn(\"checkDocumentedCommands\")(\n function* checkDocumentedCommands(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.trackedFiles(root, DOCUMENTS);\n const documents = yield* Effect.forEach(\n pipe(listed, Arr.filter(isDocument)),\n (file) =>\n files\n .readFile(files.join(root, file))\n .pipe(Effect.map(Option.map((text): Document => ({ file, text })))),\n { concurrency: \"unbounded\" },\n );\n const commanded = pipe(\n Arr.getSomes(documents),\n Arr.filter(({ text }) => Str.includes(COMMAND_START)(text)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(commanded)) {\n return [];\n }\n const given = yield* GivenTaskGraph;\n const graph = yield* Option.match(given, {\n onNone: () => listedTasks(root),\n onSome: Effect.succeedSome,\n });\n const absolute = (file: string): string => files.join(root, file);\n return Option.match(graph, {\n onNone: (): readonly Problem[] => [\n {\n file: absolute(Arr.headNonEmpty(commanded).file),\n line: ONE,\n column: ONE,\n rule: RULE,\n message: \"msch could not list the tasks with `vp run --json`\",\n },\n ],\n onSome: (found) =>\n pipe(\n commanded,\n Arr.flatMap((document) => problemsIn(found, absolute, document)),\n ),\n });\n },\n);\n","import { fileURLToPath } from \"node:url\";\n\nimport { Array as Arr, Effect, Schema, Stream, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"legacy-web\";\nconst FIRST_COLUMN = 1;\nconst SCANNER = fileURLToPath(\n new URL(\n \"./skills/modern-web-guidance/modern-web.mjs\",\n import.meta.resolve(\"modern-web-guidance/package.json\"),\n ),\n);\n\nconst Finding = Schema.Struct({ file: Schema.String, line: Schema.Int, message: Schema.String });\n\nconst Rule = Schema.Struct({ ruleId: Schema.String, findings: Schema.Array(Finding) });\n\nconst Guide = Schema.Struct({ guideId: Schema.String, rules: Schema.Array(Rule) });\n\nconst Scan = Schema.fromJsonString(Schema.Struct({ guides: Schema.Array(Guide) }));\n\nconst scanOutput = Effect.fn(\"scanOutput\")(function* scanOutput(root: string) {\n const handle = yield* ChildProcess.make(\"node\", [SCANNER, \"legacy-scan\", \".\", \"--json\"], {\n cwd: root,\n extendEnv: true,\n env: { DISABLE_TELEMETRY: \"1\" },\n stdin: \"ignore\",\n });\n return yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n}, Effect.scoped);\n\n/** @internal */\nexport const checkLegacyWeb = Effect.fn(\"checkLegacyWeb\")(function* checkLegacyWeb(root: string) {\n const files = yield* RepositoryFiles;\n const output = yield* scanOutput(root).pipe(Effect.orDie);\n const scan = yield* Schema.decodeEffect(Scan)(output).pipe(Effect.orDie);\n const problemOf =\n (guideId: string, ruleId: string) =>\n ({ file, line, message }: typeof Finding.Type): Problem => ({\n file: files.join(root, file),\n line,\n column: FIRST_COLUMN,\n rule: RULE,\n message: `${ruleId}: ${message} Read the guide with \\`modern-web-guidance retrieve ${guideId}\\` and apply it.`,\n });\n return pipe(\n scan.guides,\n Arr.flatMap(({ guideId, rules }) =>\n pipe(\n rules,\n Arr.flatMap(({ ruleId, findings }) => pipe(findings, Arr.map(problemOf(guideId, ruleId)))),\n ),\n ),\n );\n});\n","import { Array as Arr, Effect, Metric, Option, Result, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { problemInFile } from \"./problem.ts\";\nimport type { Problem, RuleName } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass SectionConfigUnreadable extends taggedError<\n SectionConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"SectionConfigUnreadable\", { file: Schema.String }) {}\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst FIRST = 1;\nconst ONE = 1;\n\nconst diagnostics = Metric.counter(\"lint.diagnostics\", {\n description: \"Diagnostics that each lint rule reported, before msch keeps only the errors\",\n});\n\nconst countDiagnostics = (check: string, found: readonly Linted[]): Effect.Effect<void> =>\n Effect.forEach(\n found,\n (diagnostic) =>\n Metric.update(\n Metric.withAttributes(diagnostics, {\n \"lint.check\": check,\n \"lint.rule\": diagnostic.rule,\n \"lint.severity\": diagnostic.severity,\n }),\n ONE,\n ),\n { concurrency: 1, discard: true },\n );\n\nexport interface Linted {\n readonly path: string;\n readonly line: number;\n readonly column?: number;\n readonly rule: string;\n readonly message: string;\n readonly severity: string;\n}\n\nexport interface LintRequest<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface SectionCheck<\n Config,\n Found extends Linted,\n Failure extends { readonly message: string },\n> {\n readonly name: string;\n readonly rule: RuleName;\n readonly pick: (config: unknown) => Config;\n readonly pathspecs: (config: Config) => readonly string[];\n readonly lint: (request: LintRequest<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly detail: (found: Found) => string;\n}\n\nconst sectionAt = <Config>(\n file: string,\n pick: (config: unknown) => Config,\n): Effect.Effect<Option.Option<Config>, never, RepositoryFiles> =>\n Effect.gen(function* readSection() {\n const files = yield* RepositoryFiles;\n const exists = yield* files.exists(file);\n if (!exists) {\n return Option.none<Config>();\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => SectionConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.map(pick));\n });\n\nexport const checkSection =\n <Config, Found extends Linted, Failure extends { readonly message: string }>(\n check: SectionCheck<Config, Found, Failure>,\n ) =>\n (root: string): Effect.Effect<readonly Problem[], never, RepositoryFiles> =>\n Effect.gen(function* runSection() {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, CONFIG_FILE);\n const section = yield* sectionAt(configFile, check.pick);\n if (Option.isNone(section)) {\n return [];\n }\n const config = section.value;\n const [listed, projectFiles] = yield* Effect.all(\n [files.matchingFiles(root, check.pathspecs(config)), files.listedFiles(root)],\n { concurrency: \"unbounded\" },\n );\n const linted = yield* Effect.result(\n check.lint({ root, files: listed, projectFiles, config }),\n );\n yield* Result.match(linted, {\n onFailure: () => Effect.void,\n onSuccess: (found) => countDiagnostics(check.name, found),\n });\n return Result.match(linted, {\n onFailure: (failure) => [problemInFile(check.rule)(configFile, failure.message)],\n onSuccess: (found) =>\n pipe(\n found,\n Arr.filter(({ severity }) => severity === \"error\"),\n Arr.map((diagnostic): Problem => ({\n file: files.join(root, diagnostic.path),\n line: diagnostic.line,\n column: diagnostic.column ?? FIRST,\n rule: check.rule,\n message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`,\n })),\n ),\n });\n }).pipe(Effect.withSpan(check.name));\n","import { diagnosticDetail, lint, markdownPathspecs, y8Section } from \"@r_masseater/y8\";\n\nimport { checkSection } from \"#/shared/lib/section-check.ts\";\n\nexport const checkMarkdown = checkSection({\n name: \"checkMarkdown\",\n rule: \"markdown\",\n pick: y8Section,\n pathspecs: (config) => markdownPathspecs({ config }),\n lint,\n detail: diagnosticDetail,\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst SHELL_FILE = /\\.(?:sh|bash|zsh|ksh|fish|command)$/u;\nconst SHELL_SHEBANG = /^#!\\S*(?:\\/|\\s)(?:env\\s+)?(?:-\\S+\\s+)*(?:ba|z|k|da)?sh\\b|^#!\\S*fish\\b/u;\nconst EXTENSION = /\\.[^./]+$/u;\nconst SETTINGS_FILE = \".claude/settings.json\";\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"shell-script\";\nconst MESSAGE =\n \"is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.\";\n\nconst HookSchema = Schema.Struct({\n command: Schema.optional(Schema.String),\n args: Schema.String.pipe(Schema.Array, Schema.optional),\n});\nconst MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });\nconst HooksSchema = Schema.Struct({\n SessionStart: MatcherSchema.pipe(Schema.Array, Schema.optional),\n});\nconst SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });\nconst decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));\n\ntype Hook = typeof HookSchema.Type;\ntype Matcher = typeof MatcherSchema.Type;\n\nconst NO_TEXT: readonly string[] = [];\n\nconst commandText = ({ command, args }: Hook): readonly string[] => [\n ...Option.toArray(Option.fromUndefinedOr(command)),\n ...pipe(\n Option.fromUndefinedOr(args),\n Option.getOrElse(() => NO_TEXT),\n ),\n];\n\nconst matcherText = ({ hooks }: Matcher): readonly string[] =>\n pipe(\n hooks,\n Arr.flatMap((hook) => commandText(hook)),\n );\n\nconst sessionStartCommands = (source: string): readonly string[] => {\n const matchers = pipe(\n decodeSettings(source),\n Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)),\n Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)),\n );\n return pipe(\n matchers,\n Option.map(Arr.flatMap((matcher) => matcherText(matcher))),\n Option.getOrElse(() => NO_TEXT),\n );\n};\n\nconst hasExtension = (name: string): boolean => EXTENSION.test(baseName(name));\n\n/** @internal */\nexport const checkShellScripts = Effect.fn(\"checkShellScripts\")(function* checkShellScripts(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));\n const commands = pipe(\n settings,\n Option.map(sessionStartCommands),\n Option.getOrElse(() => NO_TEXT),\n );\n const isSessionStartHook = (name: string): boolean =>\n pipe(commands, Arr.some(Str.includes(name)));\n const isShell = (name: string): Effect.Effect<boolean> => {\n const file = files.join(root, name);\n if (SHELL_FILE.test(name)) {\n return files.exists(file);\n }\n if (hasExtension(name)) {\n return Effect.succeed(false);\n }\n return files\n .readFile(file)\n .pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));\n };\n const candidates = pipe(\n names,\n Arr.filter((name) => !isSessionStartHook(name)),\n );\n const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY });\n return pipe(\n shell,\n Arr.map((name) => problemInFile(RULE)(files.join(root, name), MESSAGE)),\n );\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst WORKFLOW_FILE = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/u;\nconst READ_CONCURRENCY = 16;\n\ninterface WorkflowFile {\n readonly file: string;\n readonly source: string;\n}\n\nexport const readWorkflows = Effect.fn(\"readWorkflows\")(function* readWorkflows(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n names,\n Arr.filter((name) => WORKFLOW_FILE.test(name)),\n ),\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(Effect.map(Option.map((source): WorkflowFile => ({ file, source }))));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(found);\n});\n","import { Option, pipe } from \"effect\";\nimport type { Range } from \"yaml\";\nimport { isPair, isScalar, parseDocument, visit } from \"yaml\";\n\nconst RUN_KEY = \"run\";\nconst START = 0;\n\nexport interface RunScript {\n readonly text: string;\n readonly start: number;\n}\n\nconst startOf = (range: Readonly<Range> | null | undefined): number =>\n pipe(\n Option.fromNullishOr(range),\n Option.map(([start]) => start),\n Option.getOrElse(() => START),\n );\n\nexport const runScriptsOf = (source: string): readonly RunScript[] => {\n const found: RunScript[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (\n isPair(pair) &&\n isScalar(pair.key) &&\n pair.key.value === RUN_KEY &&\n isScalar(pair.value) &&\n typeof pair.value.value === \"string\"\n ) {\n found.push({ text: pair.value.value, start: startOf(pair.value.range) });\n }\n },\n });\n return found;\n};\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport { problemAtPosition } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { readWorkflows } from \"#/shared/lib/workflow-files.ts\";\nimport { runScriptsOf } from \"#/shared/lib/workflow-run.ts\";\nimport type { RunScript } from \"#/shared/lib/workflow-run.ts\";\n\nconst COMMAND_CHAIN = /&&|\\|\\||;|\\|/u;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst COMMENT = \"#\";\nconst RULE: RuleName = \"workflow-script\";\nconst ONE_COMMAND = 1;\nconst MESSAGE =\n \"runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.\";\n\nconst isCommand = (line: string): boolean => Str.isNonEmpty(line) && !Str.startsWith(COMMENT)(line);\n\nconst chainsCommands = (line: string): boolean =>\n COMMAND_CHAIN.test(Str.replaceAll(QUOTED, \"\")(line));\n\nconst runsMoreThanOneCommand = ({ text }: RunScript): boolean => {\n const lines = pipe(Str.split(\"\\n\")(text), Arr.map(Str.trim), Arr.filter(isCommand));\n return lines.length > ONE_COMMAND || pipe(lines, Arr.some(chainsCommands));\n};\n\nconst problemsIn =\n (file: string) =>\n (source: string): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n runScriptsOf(source),\n Arr.filter(runsMoreThanOneCommand),\n Arr.map(({ start }) => problemAtPosition(RULE)(file, at(start), MESSAGE)),\n );\n };\n\n/** @internal */\nexport const checkWorkflows = Effect.fn(\"checkWorkflows\")(function* checkWorkflows(root: string) {\n const workflows = yield* readWorkflows(root);\n return pipe(\n workflows,\n Arr.flatMap(({ file, source }) => problemsIn(file)(source)),\n );\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkShellScripts } from \"./shell-scripts.ts\";\nimport { checkWorkflows } from \"./workflows.ts\";\n\n/** @internal */\nexport const checkScripts = Effect.fn(\"checkScripts\")(function* checkScripts(root: string) {\n const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","import { lint, wismPathspecs, wismSection } from \"@r_masseater/wism\";\n\nimport { checkSection } from \"#/shared/lib/section-check.ts\";\n\nexport const checkStructure = checkSection({\n name: \"checkStructure\",\n rule: \"structure\",\n pick: wismSection,\n pathspecs: (config) => wismPathspecs({ config }),\n lint,\n detail: () => \"\",\n});\n","import { Array as Arr, String as Str, pipe } from \"effect\";\n\nconst CONTINUATION = /\\\\\\n/gu;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst SEPARATOR = /&&|\\|\\||[;|\\n`]|\\$\\(/u;\nconst BLANK = /\\s+/u;\nconst ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;\nconst QUOTE = '\"\"';\n\nexport type CommandWords = Arr.NonEmptyReadonlyArray<string>;\n\nconst wordsOf = (segment: string): readonly string[] =>\n pipe(\n Str.split(Str.trim(segment), BLANK),\n Arr.filter(Str.isNonEmpty),\n Arr.dropWhile((word) => ASSIGNMENT.test(word)),\n );\n\nexport const simpleCommands = (text: string): readonly CommandWords[] =>\n pipe(\n text,\n Str.replaceAll(CONTINUATION, \" \"),\n Str.replaceAll(QUOTED, QUOTE),\n Str.split(SEPARATOR),\n Arr.map(wordsOf),\n Arr.filter(Arr.isReadonlyArrayNonEmpty),\n );\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nimport type { CommandKind, CommandSource } from \"./command-sources.ts\";\nimport { simpleCommands } from \"./command-words.ts\";\nimport type { CommandWords } from \"./command-words.ts\";\n\nconst PACKAGE_MANAGERS: readonly string[] = [\"pnpm\", \"pnpx\", \"npm\", \"npx\", \"yarn\", \"bun\", \"bunx\"];\nconst VITE_PLUS = \"vp\";\nconst RUN = \"run\";\nconst GIT = \"git\";\nconst GITHUB = \"gh\";\nconst MERGE = \"merge\";\nconst SKIP_HOOKS = \"--no-verify\";\nconst BYPASS_RULESET = \"--admin\";\nconst FILTER = /^(?:--filter(?:=.*)?|-F)$/u;\nconst TASK_KINDS: readonly CommandKind[] = [\"script\", \"task\"];\nconst SECOND = 1;\nconst DOC_KIND: CommandKind = \"doc\";\nconst NODE = \"node\";\nconst INLINE_CODE = /^(?:--eval(?:=.*)?|--print(?:=.*)?|-[a-z]*[ep][a-z]*)$/u;\n\ninterface CommandRule {\n readonly rule: RuleName;\n readonly applies: (source: CommandSource, words: CommandWords) => boolean;\n readonly message: (command: string) => string;\n}\n\nconst programOf = (words: CommandWords): string => Arr.headNonEmpty(words);\n\nconst subcommandOf = (words: CommandWords): Option.Option<string> => Arr.get(words, SECOND);\n\nconst RULES: readonly CommandRule[] = [\n {\n rule: \"package-manager-command\",\n applies: (source, words) =>\n Arr.contains(PACKAGE_MANAGERS, programOf(words)) &&\n (source.kind !== DOC_KIND || words.length > SECOND),\n message: (command) =>\n `\\`${command}\\` calls the package manager directly. Run it through vp (vp install, vp add, vp exec, vp dlx, vp run), so that hooks, CI and sessions all use the toolchain Vite+ pins.`,\n },\n {\n rule: \"skipped-gate\",\n applies: (_source, words) =>\n (programOf(words) === GIT && Arr.contains(words, SKIP_HOOKS)) ||\n (programOf(words) === GITHUB &&\n Arr.contains(words, MERGE) &&\n Arr.contains(words, BYPASS_RULESET)),\n message: (command) =>\n `\\`${command}\\` skips a gate: ${SKIP_HOOKS} skips the hooks that run verify, and ${BYPASS_RULESET} bypasses the ruleset. Remove the flag and fix what the gate reports.`,\n },\n {\n rule: \"filter-task\",\n applies: (source, words) =>\n Arr.contains(TASK_KINDS, source.kind) &&\n programOf(words) === VITE_PLUS &&\n Option.contains(subcommandOf(words), RUN) &&\n pipe(\n words,\n Arr.some((word) => FILTER.test(word)),\n ),\n message: (command) =>\n `\\`${command}\\` wraps one package's task in another task. Write <package>#<task> in dependsOn instead, so that Vite+ sees the dependency and caches it.`,\n },\n {\n rule: \"inline-script\",\n applies: (source, words) =>\n source.kind !== DOC_KIND &&\n programOf(words) === NODE &&\n pipe(\n Arr.drop(words, SECOND),\n Arr.some((word) => INLINE_CODE.test(word)),\n ),\n message: (command) =>\n `\\`${command}\\` runs code written inside a command, which gets copied from package to package. Put the code in bin/<name>.ts of the package that owns it, or in a shared package, and run it with node bin/<name>.ts.`,\n },\n];\n\nconst problemsOf = (source: CommandSource): readonly Problem[] =>\n pipe(\n simpleCommands(source.text),\n Arr.flatMap((words) =>\n pipe(\n RULES,\n Arr.filter(({ applies }) => applies(source, words)),\n Arr.map(({ rule, message }): Problem => ({\n file: source.file,\n ...source.position,\n rule,\n message: message(Str.trim(Arr.join(words, \" \"))),\n })),\n ),\n ),\n );\n\nexport const commandProblems = (sources: readonly CommandSource[]): readonly Problem[] =>\n pipe(sources, Arr.flatMap(problemsOf));\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport type { CommandSource } from \"./command-sources.ts\";\n\nconst FENCE = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \\t]*\\n)(?<body>[\\s\\S]*?)^```[ \\t]*$/gmu;\nconst INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\\n]+)`(?!`)/gu;\n\ninterface CodeSpan {\n readonly text: string;\n readonly start: number;\n readonly end: number;\n}\n\nconst codeIn =\n (pattern: RegExp) =>\n (source: string): readonly CodeSpan[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.flatMap((match) =>\n pipe(\n Option.all({\n open: groupOf(\"open\")(match),\n text: groupOf(\"body\")(match),\n whole: Arr.head(match),\n index: Option.fromUndefinedOr(match.index),\n }),\n Option.map(({ open, text, whole, index }) => ({\n text,\n start: index + open.length,\n end: index + whole.length,\n })),\n Option.toArray,\n ),\n ),\n );\n\nconst outside =\n (fences: readonly CodeSpan[]) =>\n (span: CodeSpan): boolean =>\n !pipe(\n fences,\n Arr.some((fence) => span.start >= fence.start && span.start < fence.end),\n );\n\nexport const docSources =\n (file: string) =>\n (source: string): readonly CommandSource[] => {\n const fences = codeIn(FENCE)(source);\n const inline = pipe(codeIn(INLINE_CODE)(source), Arr.filter(outside(fences)));\n return pipe(\n [...fences, ...inline],\n Arr.map(({ text, start }): CommandSource => ({\n kind: \"doc\",\n file,\n position: positionOf(source)(start),\n name: \"code\",\n text,\n })),\n );\n };\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n childrenOf,\n keyName,\n literalOf,\n propertyValue,\n runTasksOf,\n workspaceDirectories,\n} from \"#/entities/workspace/index.ts\";\nimport type { RunTask } from \"#/entities/workspace/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { runScriptsOf } from \"#/shared/lib/workflow-run.ts\";\n\nimport { docSources } from \"./doc-sources.ts\";\n\nconst ROOT_DIRECTORY = \".\";\nconst COMMAND_KEY = \"command\";\nconst ARGUMENTS_KEY = \"args\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst MANIFESTS: readonly string[] = [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED];\nconst STEP_FILES: readonly string[] = [\n \":(glob).github/workflows/*.yml\",\n \":(glob).github/workflows/*.yaml\",\n \":(glob)**/action.yml\",\n \":(glob)**/action.yaml\",\n ...EXCLUDED,\n];\nconst HOOK_FILES: readonly string[] = [\":(glob).vite-hooks/*\"];\nconst AGENT_FILES: readonly string[] = [\".claude/settings.json\", \".mcp.json\"];\nconst AGENT_DOCS: readonly string[] = [\":(glob)**/AGENTS.md\", \":(glob)**/CLAUDE.md\", ...EXCLUDED];\nconst READ_CONCURRENCY = 16;\nconst START = 0;\nconst FIRST = 1;\nconst LINE = \"\\n\";\n\nexport type CommandKind = \"script\" | \"task\" | \"step\" | \"hook\" | \"agent\" | \"doc\";\n\nexport interface CommandSource {\n readonly kind: CommandKind;\n readonly file: string;\n readonly position: Pick<Problem, \"line\" | \"column\">;\n readonly name: string;\n readonly text: string;\n}\n\nconst CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);\nconst decodeCommandText = Schema.decodeUnknownOption(CommandText);\nconst Scripts = Schema.Struct({\n scripts: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts));\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\nconst decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));\n\nconst NO_SOURCES: readonly CommandSource[] = [];\n\nconst offsetOf = (source: string, text: string): number =>\n pipe(\n Str.indexOf(text)(source),\n Option.getOrElse(() => START),\n );\n\nconst scriptSources =\n (file: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n decodeScripts(source),\n Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n Arr.map(([name, text]): CommandSource => {\n const offset = offsetOf(source, `\"${name}\"`);\n return { kind: \"script\", file, position: positionOf(source)(offset), name, text };\n }),\n );\n\nconst stepSources =\n (file: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n runScriptsOf(source),\n Arr.map(({ text, start }): CommandSource => ({\n kind: \"step\",\n file,\n position: positionOf(source)(start),\n name: \"run\",\n text,\n })),\n );\n\nconst hookSources =\n (file: string, name: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n Str.split(source, LINE),\n Arr.map((text, index): CommandSource => ({\n kind: \"hook\",\n file,\n position: { line: index + FIRST, column: FIRST },\n name,\n text,\n })),\n );\n\nconst commandIn = (node: unknown): Option.Option<string> => {\n if (!Predicate.isReadonlyObject(node)) {\n return Option.none();\n }\n const record: Readonly<Record<string, unknown>> = node;\n return pipe(\n Option.fromUndefinedOr(record[COMMAND_KEY]),\n Option.filter(Predicate.isString),\n Option.map((command) =>\n pipe(\n decodeArguments(record[ARGUMENTS_KEY]),\n Option.getOrElse((): readonly string[] => []),\n Arr.prepend(command),\n Arr.join(\" \"),\n ),\n ),\n );\n};\n\nconst commandsIn = (node: unknown): readonly string[] => [\n ...Option.toArray(commandIn(node)),\n ...pipe(childrenOf(node), Arr.flatMap(commandsIn)),\n];\n\nconst agentSources =\n (file: string) =>\n (source: string): readonly CommandSource[] =>\n pipe(\n decodeJson(source),\n Option.map(commandsIn),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((text): CommandSource => {\n const program = Arr.headNonEmpty(Str.split(text, \" \"));\n const offset = offsetOf(source, `\"${program}\"`);\n return {\n kind: \"agent\",\n file,\n position: positionOf(source)(offset),\n name: COMMAND_KEY,\n text,\n };\n }),\n );\n\nconst taskCommand = (value: unknown): Option.Option<string> =>\n pipe(\n propertyValue(COMMAND_KEY)(value),\n Option.orElse(() => Option.some(value)),\n Option.flatMap(literalOf),\n Option.flatMap(decodeCommandText),\n Option.map((command) => Arr.join(Arr.ensure(command), LINE)),\n );\n\nconst taskSource =\n (file: string, source: string) =>\n (task: RunTask): Option.Option<CommandSource> =>\n pipe(\n taskCommand(task.value),\n Option.map((text) => ({\n kind: \"task\",\n file,\n position: positionOf(source)(task.start),\n name: keyName(task.key),\n text,\n })),\n );\n\nconst taskSources = Effect.fn(\"taskSources\")(function* taskSources(\n root: string,\n directory: string,\n) {\n const found = yield* runTasksOf(root, directory);\n if (Option.isNone(found)) {\n return NO_SOURCES;\n }\n const { file, source, tasks } = found.value;\n return pipe(\n tasks,\n Arr.flatMap((task) => Option.toArray(taskSource(file, source)(task))),\n );\n});\n\nconst workspaceTasks = Effect.fn(\"workspaceTasks\")(function* workspaceTasks(\n root: string,\n directories: readonly string[],\n) {\n const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.flatten(found);\n});\n\nconst readSources = Effect.fn(\"readSources\")(function* readSources(\n root: string,\n names: readonly string[],\n sourcesOf: (file: string, name: string) => (source: string) => readonly CommandSource[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n const sourcesIn = Option.match({ onNone: () => NO_SOURCES, onSome: sourcesOf(file, name) });\n return files.readFile(file).pipe(Effect.map(sourcesIn));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\n/** @internal */\nexport const commandSources = Effect.fn(\"commandSources\")(function* commandSources(root: string) {\n const files = yield* RepositoryFiles;\n const [manifests, steps, hooks, docs, workspaces] = yield* Effect.all(\n [\n files.matchingFiles(root, MANIFESTS),\n files.matchingFiles(root, STEP_FILES),\n files.matchingFiles(root, HOOK_FILES),\n files.matchingFiles(root, AGENT_DOCS),\n workspaceDirectories(root),\n ],\n { concurrency: \"unbounded\" },\n );\n const found = yield* Effect.all(\n [\n readSources(root, manifests, scriptSources),\n readSources(root, steps, stepSources),\n readSources(root, hooks, hookSources),\n readSources(root, AGENT_FILES, agentSources),\n readSources(root, docs, docSources),\n workspaceTasks(root, Arr.dedupe([ROOT_DIRECTORY, ...workspaces])),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\n\nimport type { CommandSource } from \"./command-sources.ts\";\n\nconst RULE: RuleName = \"package-script\";\nconst LIFECYCLE: readonly string[] = [\n \"preinstall\",\n \"install\",\n \"postinstall\",\n \"preprepare\",\n \"prepare\",\n \"postprepare\",\n \"prepublish\",\n \"prepublishOnly\",\n \"prepack\",\n \"postpack\",\n \"publish\",\n \"postpublish\",\n \"preversion\",\n \"version\",\n \"postversion\",\n \"dependencies\",\n \"pnpm:devPreinstall\",\n];\n\nconst problemOf = ({ file, position, name }: CommandSource): Problem => ({\n file,\n ...position,\n rule: RULE,\n message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`,\n});\n\nexport const packageScriptProblems = (sources: readonly CommandSource[]): readonly Problem[] =>\n pipe(\n sources,\n Arr.filter(({ kind, name }) => kind === \"script\" && !Arr.contains(LIFECYCLE, name)),\n Arr.map(problemOf),\n );\n","import { Array as Arr, Option, String as Str } from \"effect\";\n\nimport { agentDocProblems } from \"#/shared/lib/agent-docs.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"vite-plus-block\";\nconst MARKER = Arr.join([\"<!--\", \"VITE PLUS START\", \"-->\"], \"\");\nconst MESSAGE =\n \"holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.\";\n\nconst problemIn =\n (file: string) =>\n (source: string): Option.Option<Problem> => {\n const index = Str.indexOf(MARKER)(source);\n if (Option.isNone(index)) {\n return Option.none();\n }\n return Option.some({ file, ...positionOf(source)(index.value), rule: RULE, message: MESSAGE });\n };\n\n/** @internal */\nexport const checkVitePlusBlock = (root: string): ReturnType<typeof agentDocProblems> =>\n agentDocProblems(root, problemIn);\n","import { Effect } from \"effect\";\n\nimport { commandProblems } from \"./command-problems.ts\";\nimport { commandSources } from \"./command-sources.ts\";\nimport { packageScriptProblems } from \"./package-scripts.ts\";\nimport { checkVitePlusBlock } from \"./vite-plus-block.ts\";\n\n/** @internal */\nexport const checkVitePlus = Effect.fn(\"checkVitePlus\")(function* checkVitePlus(root: string) {\n const [sources, blocks] = yield* Effect.all([commandSources(root), checkVitePlusBlock(root)], {\n concurrency: \"unbounded\",\n });\n return [...packageScriptProblems(sources), ...commandProblems(sources), ...blocks];\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\nimport { isMap, isPair, isScalar, parseDocument, visit } from \"yaml\";\nimport type { Pair } from \"yaml\";\n\nimport type { Finding, Problem } from \"#/shared/lib/problem.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\nimport { readWorkflows } from \"#/shared/lib/workflow-files.ts\";\n\nexport const pairsNamed =\n (name: string) =>\n (source: string): readonly Pair[] => {\n const found: Pair[] = [];\n visit(parseDocument(source), {\n Pair: (_key, pair) => {\n if (isPair(pair) && isScalar(pair.key) && pair.key.value === name) {\n found.push(pair);\n }\n },\n });\n return found;\n };\n\nexport const pairIn =\n (name: string) =>\n (node: unknown): Option.Option<Pair> =>\n pipe(\n Option.liftPredicate(node, isMap),\n Option.flatMap((map) =>\n Arr.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === name),\n ),\n );\n\nexport const keyOffsetIn =\n (name: string) =>\n (node: unknown): Option.Option<number> =>\n pipe(\n pairIn(name)(node),\n Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)),\n Option.flatMap((key) => Option.fromNullishOr(key.range)),\n Option.map(([start]) => start),\n );\n\nexport interface WorkflowFinding extends Finding {\n readonly offsetsOf: (source: string) => readonly number[];\n}\n\nexport const workflowCheck = ({\n rule,\n message,\n offsetsOf,\n}: WorkflowFinding): ((\n root: string,\n) => Effect.Effect<readonly Problem[], never, RepositoryFiles>) =>\n Effect.fn(rule)(function* checkWorkflows(root: string) {\n const workflows = yield* readWorkflows(root);\n return pipe(\n workflows,\n Arr.flatMap(({ file, source }): readonly Problem[] => {\n const at = positionOf(source);\n return pipe(\n offsetsOf(source),\n Arr.map((offset): Problem => {\n const { line, column } = at(offset);\n return { file, line, column, rule, message };\n }),\n );\n }),\n );\n });\n\nexport interface ScalarKey {\n readonly name: string;\n readonly matches: (value: string) => boolean;\n}\n\nexport const scalarKeyOffsets =\n ({ name, matches }: ScalarKey) =>\n (source: string): readonly number[] =>\n pipe(\n pairsNamed(name)(source),\n Arr.filter(({ value }) => isScalar(value) && matches(String(value.value))),\n Arr.flatMap(({ key }) =>\n pipe(\n Option.liftPredicate(key, isScalar),\n Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)),\n Option.map(([start]) => start),\n Option.toArray,\n ),\n ),\n );\n","import type { RuleName } from \"#/shared/lib/problem.ts\";\n\nimport { scalarKeyOffsets, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst DEPTH_KEY = \"fetch-depth\";\nconst WHOLE_HISTORY = \"0\";\nconst RULE: RuleName = \"full-history-checkout\";\nconst MESSAGE =\n \"fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.\";\n\nconst fullHistoryOffsetsOf = scalarKeyOffsets({\n name: DEPTH_KEY,\n matches: (value) => value === WHOLE_HISTORY,\n});\n\n/** @internal */\nexport const checkFullHistoryCheckout = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: fullHistoryOffsetsOf,\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isMap, isScalar, isSeq, parseDocument } from \"yaml\";\n\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { runScriptsOf } from \"#/shared/lib/workflow-run.ts\";\n\nimport { keyOffsetIn, pairIn, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst RULE: RuleName = \"publish-trigger\";\nconst PUBLISH = /\\bmsch-publish\\s+(?:plan|npm|release)\\b/u;\nconst MANUAL = \"workflow_dispatch\";\nconst TRIGGER_KEY = \"on\";\nconst MESSAGE =\n \"publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch-publish dispatch`.\";\n\nconst triggersOf = (node: unknown): readonly string[] => {\n if (isScalar(node)) {\n return [String(node.value)];\n }\n if (isSeq(node)) {\n return pipe(\n node.items,\n Arr.filter(isScalar),\n Arr.map((item) => String(item.value)),\n );\n }\n if (isMap(node)) {\n return pipe(\n node.items,\n Arr.flatMap(({ key }) =>\n pipe(\n Option.liftPredicate(key, isScalar),\n Option.map((scalar) => String(scalar.value)),\n Option.toArray,\n ),\n ),\n );\n }\n return [];\n};\n\nconst publishTriggerOffsetsOf = (source: string): readonly number[] => {\n const publishes = pipe(\n runScriptsOf(source),\n Arr.some(({ text }) => PUBLISH.test(text)),\n );\n if (!publishes) {\n return [];\n }\n const { contents } = parseDocument(source);\n const triggers = pipe(\n pairIn(TRIGGER_KEY)(contents),\n Option.map(({ value }) => triggersOf(value)),\n Option.getOrElse((): readonly string[] => []),\n );\n if (\n pipe(\n triggers,\n Arr.every((trigger) => trigger === MANUAL),\n )\n ) {\n return [];\n }\n return Option.toArray(keyOffsetIn(TRIGGER_KEY)(contents));\n};\n\n/** @internal */\nexport const checkPublishTrigger = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: publishTriggerOffsetsOf,\n});\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { scalarKeyOffsets, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst RULE: RuleName = \"release-please\";\nconst RELEASE_PLEASE = /^googleapis\\/release-please-action(?:@|$)/u;\nconst RELEASE_PLEASE_FILE = /(?:^|\\/)(?:release-please-config|\\.release-please-manifest)\\.json$/u;\nconst FIRST = 1;\nconst MESSAGE =\n \"releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.\";\n\nconst releasePleaseOffsetsOf = scalarKeyOffsets({\n name: \"uses\",\n matches: (value) => RELEASE_PLEASE.test(value),\n});\n\nconst checkReleasePleaseSteps = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: releasePleaseOffsetsOf,\n});\n\nconst checkReleasePleaseFiles = Effect.fn(\"checkReleasePleaseFiles\")(\n function* checkReleasePleaseFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.filter((name) => RELEASE_PLEASE_FILE.test(name)),\n Arr.map((name): Problem => ({\n file: files.join(root, name),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: MESSAGE,\n })),\n );\n },\n);\n\n/** @internal */\nexport const checkReleasePlease = Effect.fn(\"checkReleasePlease\")(function* checkReleasePlease(\n root: string,\n) {\n const found = yield* Effect.all([checkReleasePleaseSteps(root), checkReleasePleaseFiles(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\n\nimport { keyOffsetIn, pairsNamed, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst CONCURRENCY_KEY = \"concurrency\";\nconst QUEUE_KEY = \"queue\";\nconst RULE: RuleName = \"workflow-queue\";\nconst MESSAGE =\n \"queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.\";\n\nconst queueOffsetsOf = (source: string): readonly number[] =>\n pipe(\n pairsNamed(CONCURRENCY_KEY)(source),\n Arr.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))),\n );\n\n/** @internal */\nexport const checkWorkflowQueues = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: queueOffsetsOf,\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { isScalar } from \"yaml\";\n\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\n\nimport { pairsNamed, workflowCheck } from \"./workflow-yaml.ts\";\n\nconst RULE: RuleName = \"workflow-commit\";\nconst GIT_WRITE = /\\bgit\\s+(?:-{1,2}\\S+\\s+(?:\\S+\\s+)?)*(?:commit|push)\\b/u;\nconst COMMIT_ACTION = /^[^@/]+\\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;\nconst MESSAGE =\n \"commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.\";\n\nconst offsetsWhere =\n (name: string, pattern: RegExp) =>\n (source: string): readonly number[] =>\n pipe(\n pairsNamed(name)(source),\n Arr.filter(\n ({ value }) =>\n isScalar(value) && typeof value.value === \"string\" && pattern.test(value.value),\n ),\n Arr.flatMap(({ key }) =>\n pipe(\n Option.liftPredicate(key, isScalar),\n Option.flatMap(({ range }) => Option.fromNullishOr(range)),\n Option.map(([start]) => start),\n Option.toArray,\n ),\n ),\n );\n\nconst commitOffsetsOf = (source: string): readonly number[] => [\n ...offsetsWhere(\"run\", GIT_WRITE)(source),\n ...offsetsWhere(\"uses\", COMMIT_ACTION)(source),\n];\n\n/** @internal */\nexport const checkWorkflowCommits = workflowCheck({\n rule: RULE,\n message: MESSAGE,\n offsetsOf: commitOffsetsOf,\n});\n","import { fu4Section, lint, workflowPathspecs } from \"@r_masseater/fu4\";\n\nimport { checkSection } from \"#/shared/lib/section-check.ts\";\n\nexport const checkWorkflowLint = checkSection({\n name: \"checkWorkflowLint\",\n rule: \"workflow-lint\",\n pick: fu4Section,\n pathspecs: (config) => workflowPathspecs({ config }),\n lint,\n detail: () => \"\",\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkKnownPlugins, checkMissingHooks } from \"#/features/check-agent-settings/index.ts\";\nimport { checkDocumentedCommands } from \"#/features/check-documented-commands/index.ts\";\nimport { checkLegacyWeb } from \"#/features/check-legacy-web/index.ts\";\nimport { checkMarkdown } from \"#/features/check-markdown/index.ts\";\nimport { checkRestrictedRules, checkTypeExemptions } from \"#/features/check-overrides/index.ts\";\nimport { checkScripts } from \"#/features/check-scripts/index.ts\";\nimport { checkStructure } from \"#/features/check-structure/index.ts\";\nimport { checkVitePlus } from \"#/features/check-vite-plus/index.ts\";\nimport {\n checkFullHistoryCheckout,\n checkPublishTrigger,\n checkReleasePlease,\n checkWorkflowCommits,\n checkWorkflowLint,\n checkWorkflowQueues,\n} from \"#/features/check-workflows/index.ts\";\n\n/** @internal */\nexport const checkToolUse = Effect.fn(\"checkToolUse\")(function* checkToolUse(root: string) {\n const found = yield* Effect.all(\n [\n checkVitePlus(root),\n checkMissingHooks(root),\n checkKnownPlugins(root),\n checkScripts(root),\n checkWorkflowQueues(root),\n checkWorkflowCommits(root),\n checkFullHistoryCheckout(root),\n checkReleasePlease(root),\n checkPublishTrigger(root),\n checkRestrictedRules(root),\n checkTypeExemptions(root),\n checkMarkdown(root),\n checkLegacyWeb(root),\n checkDocumentedCommands(root),\n checkStructure(root),\n checkWorkflowLint(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","export const COMMENT_DIRECTIVES: readonly string[] = [\n \"oxlint-disable\",\n \"textlint-disable\",\n \"textlint-enable\",\n String.raw`\\* @internal \\*?$`,\n String.raw`\\* @msch \\S+ \\*?$`,\n String.raw`\\* @stability (?:experimental|unstable) \\*?$`,\n String.raw`shellcheck \\w`,\n String.raw`zizmor: ignore\\[`,\n String.raw`exit: \\S`,\n \"> statement-breakpoint$\",\n \"/ <reference (?:types|path|lib)=\",\n];\n","import { Array as Arr, Effect, Schema, String as Str, pipe } from \"effect\";\n\nexport interface FoundComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport type Found = Effect.Effect<readonly FoundComment[], CommentsUnreadable>;\n\nconst taggedError = Schema.TaggedError;\n\nexport class CommentsUnreadable extends taggedError<\n CommentsUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentsUnreadable\", { reader: Schema.String, message: Schema.String }) {}\n\nexport const unreadable =\n (reader: string) =>\n (cause: unknown): CommentsUnreadable =>\n CommentsUnreadable.make({ reader, message: String(cause) });\n\nconst trimmed = ({ index, text }: FoundComment): FoundComment => ({\n index,\n text: Str.trimEnd(text),\n});\n\nexport const commentsFrom =\n (reader: string) =>\n (read: (source: string) => readonly FoundComment[]) =>\n (source: string): Found =>\n Effect.try({\n try: () => pipe(read(source), Arr.map(trimmed)),\n catch: unreadable(reader),\n });\n","import { DockerfileParser } from \"dockerfile-ast\";\nimport { Array as Arr, Number as Num, String as Str, pipe } from \"effect\";\nimport { parse as parseSql } from \"sql-parser-cst\";\n\nimport {\n collectNodes,\n isRecord,\n tomlSourceComments,\n yamlSourceComments,\n} from \"#/shared/lib/config-comments.ts\";\n\nimport { commentsFrom } from \"./found-comment.ts\";\n\nconst NEXT = 1;\n\nexport const yamlComments = commentsFrom(\"yaml\")(yamlSourceComments);\n\nexport const tomlComments = commentsFrom(\"toml\")(tomlSourceComments);\n\ninterface SqlComment {\n readonly text: string;\n readonly range: readonly [number, number];\n}\n\nconst isSqlComment = (value: unknown): value is SqlComment =>\n isRecord(value) &&\n (value[\"type\"] === \"line_comment\" || value[\"type\"] === \"block_comment\") &&\n typeof value[\"text\"] === \"string\" &&\n Arr.isArray(value[\"range\"]);\n\nexport const sqlComments = commentsFrom(\"sql\")((source) => {\n const program = parseSql(source, {\n dialect: \"sqlite\",\n includeComments: true,\n includeRange: true,\n paramTypes: [],\n });\n return pipe(\n collectNodes(isSqlComment)(program),\n Arr.map(({ range: [start], text }) => ({ index: start, text })),\n );\n});\n\nconst offsetAt =\n (lines: readonly string[]) =>\n ({ line, character }: Readonly<{ line: number; character: number }>): number =>\n character +\n pipe(\n lines,\n Arr.take(line),\n Arr.map((text) => text.length + NEXT),\n Num.sumAll,\n );\n\nexport const dockerfileComments = commentsFrom(\"dockerfile\")((source) => {\n const lines = Str.split(source, \"\\n\");\n return pipe(\n DockerfileParser.parse(source).getComments(),\n Arr.map((comment) => ({\n index: offsetAt(lines)(comment.getRange().start),\n text: comment.toString(),\n })),\n );\n});\n","import { isComment, isTag, isText } from \"domhandler\";\nimport type { AnyNode, Text } from \"domhandler\";\nimport {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport { DomUtils, parseDocument } from \"htmlparser2\";\n\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { Language } from \"#/shared/lib/tree-sitter.ts\";\n\nimport { dockerfileComments, sqlComments, tomlComments, yamlComments } from \"./config-comments.ts\";\nimport { commentsFrom, unreadable } from \"./found-comment.ts\";\nimport type { CommentsUnreadable, Found, FoundComment } from \"./found-comment.ts\";\n\nconst GRAMMARS = [\n \"bash\",\n \"c-sharp\",\n \"cpp\",\n \"css\",\n \"javascript\",\n \"powershell\",\n \"rust\",\n \"tsx\",\n \"typescript\",\n] as const;\n\nexport type Grammar = (typeof GRAMMARS)[number];\n\nexport type Markup = \"html\" | \"xml\";\n\nexport type Reader = Grammar | Markup | \"yaml\" | \"toml\" | \"sql\" | \"dockerfile\";\n\nexport type Grammars = (grammar: Grammar) => Option.Option<Language>;\n\nconst COMMENT_NODES = [\"comment\", \"line_comment\", \"block_comment\", \"multiline_comment\"];\nconst START = 0;\nconst NEXT = 1;\nconst NONE: readonly FoundComment[] = [];\n\nconst loadGrammar = (\n grammar: Grammar,\n): Effect.Effect<readonly [Grammar, Language], CommentsUnreadable> =>\n loadLanguage(grammar).pipe(\n Effect.mapBoth({\n onFailure: ({ message }) => unreadable(grammar)(message),\n onSuccess: (language) => [grammar, language] as const,\n }),\n );\n\nexport const loadGrammars = Effect.fn(\"loadGrammars\")(function* loadGrammars() {\n const loaded = yield* Effect.forEach(GRAMMARS, (grammar) => loadGrammar(grammar), {\n concurrency: 1,\n });\n const languages = Rec.fromEntries(loaded);\n const grammars: Grammars = (grammar) => Rec.get(languages, grammar);\n return grammars;\n});\n\nconst commentNodesIn = (language: Language, source: string): readonly FoundComment[] =>\n pipe(\n readTree({\n language,\n source,\n read: (root) =>\n pipe(\n root.descendantsOfType(COMMENT_NODES),\n Arr.filter(Predicate.isNotNullish),\n Arr.map((node) => ({ index: node.startIndex, text: node.text })),\n ),\n }),\n Option.getOrElse(() => NONE),\n );\n\nconst syntaxComments =\n (grammars: Grammars, grammar: Grammar) =>\n (source: string): Found =>\n Option.match(grammars(grammar), {\n onNone: () => Effect.fail(unreadable(grammar)(\"the grammar is not loaded\")),\n onSome: (language) => commentsFrom(grammar)((text) => commentNodesIn(language, text))(source),\n });\n\nconst SCRIPT_TYPE = /^(?:|module|text\\/javascript|application\\/javascript)$/iu;\nconst SHADER_TYPE = /shader|glsl/iu;\n\ninterface EmbeddingTag {\n readonly name: string;\n readonly attribs: Readonly<Record<string, string>>;\n}\n\nconst scriptGrammar = (attribs: EmbeddingTag[\"attribs\"]): Option.Option<Grammar> => {\n const type = Str.trim(Option.getOrElse(Rec.get(attribs, \"type\"), () => \"\"));\n if (Rec.get(attribs, \"lang\").pipe(Option.contains(\"ts\"))) {\n return Option.some<Grammar>(\"typescript\");\n }\n if (SHADER_TYPE.test(type)) {\n return Option.some<Grammar>(\"cpp\");\n }\n return Option.liftPredicate<Grammar>(\"javascript\", () => SCRIPT_TYPE.test(type));\n};\n\nconst EMBEDDED_GRAMMARS: Readonly<\n Record<string, (attribs: EmbeddingTag[\"attribs\"]) => Option.Option<Grammar>>\n> = {\n style: () => Option.some<Grammar>(\"css\"),\n script: scriptGrammar,\n};\n\nconst embeddedGrammar = ({ name, attribs }: EmbeddingTag): Option.Option<Grammar> =>\n Rec.get(EMBEDDED_GRAMMARS, name).pipe(Option.flatMap((grammarOf) => grammarOf(attribs)));\n\nconst shifted =\n (offset: number) =>\n ({ index, text }: FoundComment): FoundComment => ({ index: index + offset, text });\n\nconst markupComment =\n (source: string) =>\n (node: AnyNode): readonly FoundComment[] => {\n if (!isComment(node) || node.startIndex === null || node.endIndex === null) {\n return NONE;\n }\n return [\n { index: node.startIndex, text: Str.slice(node.startIndex, node.endIndex + NEXT)(source) },\n ];\n };\n\nconst textComments =\n (grammars: Grammars, grammar: Grammar) =>\n (text: Text): Found => {\n const shift = shifted(text.startIndex ?? START);\n return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Arr.map(shift)));\n };\n\nconst embeddedComments =\n (grammars: Grammars) =>\n (node: AnyNode): Found => {\n if (!isTag(node)) {\n return Effect.succeed(NONE);\n }\n const texts = pipe(node.children, Arr.filter(isText));\n return Option.match(embeddedGrammar(node), {\n onNone: () => Effect.succeed(NONE),\n onSome: (grammar) =>\n pipe(\n texts,\n (items) => Effect.forEach(items, textComments(grammars, grammar), { concurrency: 1 }),\n Effect.map(Arr.flatten),\n ),\n });\n };\n\nconst markupComments =\n (grammars: Grammars, markup: Markup) =>\n (source: string): Found =>\n Effect.gen(function* readMarkup() {\n const document = parseDocument(source, {\n xmlMode: markup === \"xml\",\n withStartIndices: true,\n withEndIndices: true,\n });\n const nodes = DomUtils.filter(() => true, document.children, true);\n const own = pipe(nodes, Arr.flatMap(markupComment(source)));\n if (markup === \"xml\") {\n return own;\n }\n const embedded = yield* Effect.forEach(nodes, embeddedComments(grammars), { concurrency: 1 });\n return [...own, ...Arr.flatten(embedded)];\n });\n\nconst isGrammar = (reader: Reader): reader is Grammar => pipe(GRAMMARS, Arr.contains(reader));\n\nexport const commentsWith =\n (grammars: Grammars) =>\n (reader: Reader, source: string): Found => {\n if (isGrammar(reader)) {\n return syntaxComments(grammars, reader)(source);\n }\n const readers = {\n html: markupComments(grammars, \"html\"),\n xml: markupComments(grammars, \"xml\"),\n yaml: yamlComments,\n toml: tomlComments,\n sql: sqlComments,\n dockerfile: dockerfileComments,\n } satisfies Record<Exclude<Reader, Grammar>, (text: string) => Found>;\n return readers[reader](source);\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Reader } from \"./comment-readers.ts\";\n\nconst SHEBANG = \"#!\";\n\nconst READERS: readonly (readonly [RegExp, Reader])[] = [\n [/\\.(?:[cm]?jsx?)$/u, \"javascript\"],\n [/\\.(?:[cm]?ts)$/u, \"typescript\"],\n [/\\.tsx$/u, \"tsx\"],\n [/\\.rs$/u, \"rust\"],\n [/\\.(?:cs|csx)$/u, \"c-sharp\"],\n [/\\.(?:sh|bash|zsh|ksh)$/u, \"bash\"],\n [/(?:^|\\/)\\.(?:vite-hooks|husky|githooks)\\/[^./][^/]*$/u, \"bash\"],\n [/\\.(?:ps1|psm1|psd1)$/u, \"powershell\"],\n [/\\.(?:c|h|cc|cpp|cxx|hpp|hh|m|mm|glsl|frag|vert|comp|wgsl|hlsl|metal)$/u, \"cpp\"],\n [/\\.(?:css|pcss)$/u, \"css\"],\n [/\\.(?:html?|vue|svelte|astro)$/u, \"html\"],\n [/\\.(?:xml|xaml|plist|resx|props|targets|[a-z]+proj|manifest|nuspec)$/u, \"xml\"],\n [/\\.ya?ml$/u, \"yaml\"],\n [/\\.toml$/u, \"toml\"],\n [/\\.sql$/u, \"sql\"],\n [/(?:^|\\/)(?:Dockerfile|Containerfile)(?:\\.[^/]+)?$|\\.dockerfile$/u, \"dockerfile\"],\n];\n\nconst SHEBANG_READERS: readonly (readonly [RegExp, Reader])[] = [\n [/^#!.*\\b(?:ba|z|k|da)?sh\\b/u, \"bash\"],\n [/^#!.*\\b(?:node|bun|deno|tsx)\\b/u, \"javascript\"],\n [/^#!.*\\bpwsh\\b/u, \"powershell\"],\n];\n\nconst shebangReader = (source: string): Option.Option<readonly [RegExp, Reader]> => {\n if (!Str.startsWith(SHEBANG)(source)) {\n return Option.none();\n }\n return pipe(\n SHEBANG_READERS,\n Arr.findFirst(([pattern]) => pattern.test(source)),\n );\n};\n\nexport const readerOf =\n (name: string) =>\n (source: string): Option.Option<Reader> =>\n pipe(\n READERS,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.orElse(() => shebangReader(source)),\n Option.map(([, reader]) => reader),\n );\n","import { matcher } from \"@masseater.dev/path-kit\";\nimport {\n Array as Arr,\n Effect,\n HashSet,\n Option,\n Predicate,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { COMMENT_DIRECTIVES } from \"#/shared/lib/comment-directives.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { commentsWith, loadGrammars } from \"./comment-readers.ts\";\nimport type { FoundComment } from \"./found-comment.ts\";\nimport { readerOf } from \"./reader-of.ts\";\n\nconst RULE: RuleName = \"comment\";\nconst UNUSED_RULE: RuleName = \"unused-comment-allowance\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst VENDORED_PATHSPEC = \":(attr:linguist-vendored)\";\nconst READ_CONCURRENCY = 64;\nconst START = 0;\n\nconst SHEBANG = \"#!\";\nconst PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\\s*$/u;\nconst VERSION = /^\\s?v?\\d[\\w.+-]*$/u;\nconst DELIMITERS = /^(?:\\/\\/|\\/\\*|<!--|<#|#|--)|(?:\\*\\/|-->|#>)$/gu;\nconst MESSAGE =\n \"Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.\";\n\nconst Patterns = Schema.Array(Schema.String);\nconst CommentSettings = Schema.Struct({ allow: Patterns });\nconst MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });\nconst LintSettings = Schema.Struct({ ignorePatterns: Schema.optional(Patterns) });\n\nconst RootConfig = Schema.Struct({\n msch: Schema.optional(MschSettings),\n lint: Schema.optional(LintSettings),\n});\n\ntype RootConfigType = typeof RootConfig.Type;\n\ninterface RootSettings {\n readonly allow: readonly string[];\n readonly ignorePatterns: readonly string[];\n}\n\ninterface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nconst NO_SETTINGS: RootSettings = { allow: [], ignorePatterns: [] };\n\nconst taggedError = Schema.TaggedError;\n\nclass CommentConfigUnreadable extends taggedError<\n CommentConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"CommentConfigUnreadable\", { file: Schema.String }) {}\n\nconst valueOf = (text: string): string => Str.replaceAll(DELIMITERS, \"\")(text);\n\nconst lineBefore = (source: string, index: number): string => {\n const lines = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return Option.getOrElse(Arr.last(lines), () => \"\");\n};\n\nconst isPinVersion = (source: string, { index, text }: FoundComment): boolean =>\n PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));\n\nconst isShebang = ({ index, text }: FoundComment): boolean =>\n index === START && Str.startsWith(SHEBANG)(text);\n\nconst isAllowed =\n (source: string, directives: RegExp) =>\n (comment: FoundComment): boolean =>\n isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);\n\ninterface Scanned {\n readonly problems: readonly Problem[];\n readonly used: readonly number[];\n}\n\nconst NOTHING: Scanned = { problems: [], used: [] };\n\nconst unusedMessage = (entry: string): string =>\n `allows the comment pattern \\`${entry}\\`, but no comment in the repository matches it. Delete the entry and add it back when a comment needs it.`;\n\nconst problemOf =\n (file: string, source: string) =>\n ({ index }: FoundComment): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: MESSAGE,\n });\n\nconst settingsOf = ({ msch, lint }: RootConfigType): RootSettings => ({\n allow: pipe(\n Option.fromUndefinedOr(msch),\n Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)),\n Option.match({ onNone: () => NO_SETTINGS.allow, onSome: ({ allow }) => allow }),\n ),\n ignorePatterns: pipe(\n Option.fromUndefinedOr(lint),\n Option.flatMap(({ ignorePatterns }) => Option.fromUndefinedOr(ignorePatterns)),\n Option.getOrElse(() => NO_SETTINGS.ignorePatterns),\n ),\n});\n\nconst rootSettings = Effect.fn(\"rootSettings\")(function* rootSettings(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const exists = yield* files.exists(file);\n if (!exists) {\n return NO_SETTINGS;\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => CommentConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(\n config,\n Option.flatMap(Schema.decodeUnknownOption(RootConfig)),\n Option.match({ onNone: () => NO_SETTINGS, onSome: settingsOf }),\n );\n});\n\nconst directivePattern = (directives: readonly string[]): RegExp =>\n new RegExp(String.raw`^\\s?(?:${Arr.join(directives, \"|\")})`, \"u\");\n\nconst scannedFiles = Effect.fn(\"scannedFiles\")(function* scannedFiles(\n root: string,\n settings: RootSettings,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const generated = yield* files.generatedFiles(root);\n const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);\n const isIgnored = matcher(settings.ignorePatterns);\n const skipped = HashSet.fromIterable([\n ...generated,\n ...pipe(\n vendored,\n Arr.map((name) => files.join(root, name)),\n ),\n ]);\n return pipe(\n listed,\n Arr.filter((name) => !isIgnored(name)),\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n Arr.filter(({ file }) => !HashSet.has(skipped, file)),\n );\n});\n\nconst usedAllowances = (\n allowances: readonly RegExp[],\n found: readonly FoundComment[],\n): readonly number[] =>\n pipe(\n allowances,\n Arr.map((pattern, index) => [pattern, index] as const),\n Arr.filter(([pattern]) =>\n pipe(\n found,\n Arr.some((comment) => pattern.test(valueOf(comment.text))),\n ),\n ),\n Arr.map(([, index]) => index),\n );\n\nconst entryOffset = (source: string, entry: string): number =>\n pipe(\n Str.indexOf(entry)(source),\n Option.getOrElse(() => START),\n );\n\nconst unusedAllowances = Effect.fn(\"unusedAllowances\")(function* unusedAllowances(\n root: string,\n settings: RootSettings,\n used: HashSet.HashSet<number>,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const text = yield* files.readFile(file);\n const source = Option.getOrElse(text, () => \"\");\n return pipe(\n settings.allow,\n Arr.filter((_entry, index) => !HashSet.has(used, index)),\n Arr.map((entry): Problem => ({\n file,\n ...positionOf(source)(entryOffset(source, entry)),\n rule: UNUSED_RULE,\n message: unusedMessage(entry),\n })),\n );\n});\n\ninterface Scanning {\n readonly directives: RegExp;\n readonly allowances: readonly RegExp[];\n readonly comments: ReturnType<typeof commentsWith>;\n}\n\nconst scanFile =\n ({ directives, allowances, comments }: Scanning) =>\n ({ name, file }: Listed, source: string): Effect.Effect<Scanned> => {\n const kept = Predicate.not(isAllowed(source, directives));\n const toProblem = problemOf(file, source);\n return Option.match(readerOf(name)(source), {\n onNone: () => Effect.succeed(NOTHING),\n onSome: (reader) =>\n comments(reader, source).pipe(\n Effect.map((found): Scanned => ({\n problems: pipe(found, Arr.filter(kept), Arr.map(toProblem)),\n used: usedAllowances(allowances, found),\n })),\n Effect.catchTag(\"CommentsUnreadable\", ({ message }) =>\n Effect.succeed({\n problems: [\n problemInFile(RULE)(\n file,\n `msch could not read the comments in this file: ${message}`,\n ),\n ],\n used: [],\n }),\n ),\n ),\n });\n };\n\n/** @internal */\nexport const checkComments = Effect.fn(\"checkComments\")(function* checkComments(root: string) {\n const files = yield* RepositoryFiles;\n const settings = yield* rootSettings(root);\n const scanned = yield* scannedFiles(root, settings);\n const grammars = yield* loadGrammars();\n const scan = scanFile({\n directives: directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]),\n allowances: pipe(\n settings.allow,\n Arr.map((entry) => directivePattern([entry])),\n ),\n comments: commentsWith(grammars),\n });\n const found = yield* Effect.forEach(\n scanned,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.succeed(NOTHING),\n onSome: (source) => scan(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n const used = HashSet.fromIterable(\n pipe(\n found,\n Arr.flatMap(({ used: indexes }) => indexes),\n ),\n );\n const unused = yield* unusedAllowances(root, settings, used);\n return [\n ...pipe(\n found,\n Arr.flatMap(({ problems }) => problems),\n ),\n ...unused,\n ];\n});\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst PROGRAM_SOURCE = /\\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;\nconst CONFIG_SOURCE = /(?:^|\\/)[^/]*\\.config\\.[cm]?[jt]s$/u;\n\nexport const isProgramSource = ({ name }: Listed): boolean =>\n PROGRAM_SOURCE.test(name) && !CONFIG_SOURCE.test(name);\n\nexport interface PatternSets {\n readonly spawn: readonly RegExp[];\n readonly command: readonly RegExp[];\n readonly toolVersions?: readonly RegExp[];\n}\n\nexport const patternsBy =\n ({ spawn, command, toolVersions = [] }: PatternSets) =>\n (entry: Listed): readonly RegExp[] => {\n if (isProgramSource(entry)) {\n return spawn;\n }\n if (isToolVersions(entry)) {\n return [...command, ...toolVersions];\n }\n return command;\n };\n\nexport const spawnPattern = (program: string): RegExp =>\n new RegExp(\n String.raw`(?:\\bcommand[\"']?\\s*[:=]\\s*|(?:\\bspawn\\w*|\\bexec\\w*|\\bexeca|Command::new|ChildProcess\\.make)\\(\\s*|\\$\\(\\s*|\\$\\s*(?=\\x60))[\"'\\x60](?:${program})(?=[\"'\\x60\\s])`,\n \"gu\",\n );\n\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\n\nexport interface BannedTool {\n readonly fileRule: RuleName;\n readonly commandRule: RuleName;\n readonly isFile: (entry: Listed) => boolean;\n readonly patternsFor: (entry: Listed) => readonly RegExp[];\n readonly fileMessage: (entry: Listed) => string;\n readonly commandMessage: (command: string) => string;\n}\n\nconst fileProblem =\n (tool: BannedTool) =>\n (entry: Listed): Problem => ({\n file: entry.file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule: tool.fileRule,\n message: tool.fileMessage(entry),\n });\n\nconst commandProblem =\n (tool: BannedTool, entry: Listed, source: string) =>\n (found: RegExpMatchArray): Problem => ({\n file: entry.file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: tool.commandRule,\n message: tool.commandMessage(Str.trim(found[WHOLE_MATCH])),\n });\n\nconst commandProblems =\n (tool: BannedTool) =>\n (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n tool.patternsFor(entry),\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map(commandProblem(tool, entry, source)),\n );\n\n/** @internal */\nexport const checkBannedTool = Effect.fn(\"checkBannedTool\")(function* checkBannedTool(\n root: string,\n tool: BannedTool,\n) {\n const listed = yield* listedFiles(root);\n const isScanned = (entry: Listed): boolean => !tool.isFile(entry) && isScannedText(entry);\n const scanned = yield* scanText(pipe(listed, Arr.filter(isScanned)), commandProblems(tool));\n const present = yield* presentFiles(pipe(listed, Arr.filter(tool.isFile)));\n return [...pipe(present, Arr.map(fileProblem(tool))), ...scanned];\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nimport { checkBannedTool, patternsBy, spawnPattern } from \"./banned-tool.ts\";\nimport type { BannedTool } from \"./banned-tool.ts\";\n\nconst RENAMES: readonly (readonly [pattern: RegExp, name: string])[] = [\n [/(?:^|\\/)Dockerfile(?:\\.[^/]+)?$|\\.dockerfile$/iu, \"Containerfile\"],\n [/(?:^|\\/)(?:[^/]+)?\\.dockerignore$/u, \".containerignore\"],\n [/(?:^|\\/)docker-compose(?:\\.[^/]+)?\\.ya?ml$/u, \"compose.yaml\"],\n];\n\nconst SPAWN_PATTERNS: readonly RegExp[] = [spawnPattern(\"docker(?:-compose)?\")];\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\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,\n /(?<![\\w./@-])docker-compose[ \\t]+(?:up|down|build|run|exec|pull|push|ps|logs|stop|start|restart|config)\\b/gu,\n ...SPAWN_PATTERNS,\n /\\buses:\\s*[\"']?docker(?:\\/[\\w.-]+|:\\/\\/)/gu,\n];\n\nconst renameOf = ({ name }: Listed): Option.Option<string> =>\n pipe(\n RENAMES,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.map(([, renamed]) => renamed),\n );\n\nconst DOCKER: BannedTool = {\n fileRule: \"docker-file\",\n commandRule: \"docker-command\",\n isFile: (entry) => Option.isSome(renameOf(entry)),\n patternsFor: patternsBy({ spawn: SPAWN_PATTERNS, command: COMMAND_PATTERNS }),\n fileMessage: (entry) =>\n `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.`,\n commandMessage: (command) =>\n `Docker is not used in this repository. Replace \\`${command}\\` with podman, which takes the same arguments.`,\n};\n\n/** @internal */\nexport const checkDocker = (root: string): ReturnType<typeof checkBannedTool> =>\n checkBannedTool(root, DOCKER);\n","import { checkBannedTool, patternsBy, spawnPattern } from \"./banned-tool.ts\";\nimport type { BannedTool } from \"./banned-tool.ts\";\n\nconst PYTHON_FILE =\n /(?:\\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\\/)(?:pyproject\\.toml|uv\\.lock|uv\\.toml|poetry\\.lock|Pipfile|Pipfile\\.lock|setup\\.cfg|tox\\.ini|pytest\\.ini|\\.python-version|requirements[^/]*\\.txt))$/u;\n\nconst SPAWN_PATTERNS: readonly RegExp[] = [\n spawnPattern(String.raw`python[\\d.]*|pip3?|pipx|uvx?|poetry`),\n];\n\nconst COMMAND_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])python[\\d.]*[ \\t]+(?:[-\"'$./]|\\S+\\.py\\b)/gu,\n /(?<![\\w./@-])pip3?[ \\t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\\b/gu,\n /(?<![\\w./@-])pipx[ \\t]+(?:run|install|inject|upgrade)\\b/gu,\n /(?<![\\w./@-])uvx[ \\t]+[^\\s=:,;)|&]/gu,\n /(?<![\\w./@-])uv[ \\t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\\b/gu,\n /(?<![\\w./@-])poetry[ \\t]+(?:run|install|add|lock|build|publish|shell|export)\\b/gu,\n ...SPAWN_PATTERNS,\n /\\buses:\\s*[\"']?(?:actions\\/setup-python|astral-sh\\/setup-uv|astral-sh\\/ruff-action|pypa\\/[\\w.-]+|snok\\/install-poetry|abatilo\\/actions-poetry|conda-incubator\\/setup-miniconda|mamba-org\\/setup-micromamba|pdm-project\\/setup-pdm)\\b/gu,\n];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^\"'\\s=]+)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst PYTHON: BannedTool = {\n fileRule: \"python-file\",\n commandRule: \"python-command\",\n isFile: ({ name }) => PYTHON_FILE.test(name),\n patternsFor: patternsBy({\n spawn: SPAWN_PATTERNS,\n command: COMMAND_PATTERNS,\n toolVersions: TOOL_PATTERNS,\n }),\n fileMessage: () =>\n \"Python is not used in this repository. Replace this file with TypeScript or Rust.\",\n commandMessage: (command) =>\n `Python is not used in this repository. Remove \\`${command}\\` and do the work in TypeScript or Rust.`,\n};\n\n/** @internal */\nexport const checkPython = (root: string): ReturnType<typeof checkBannedTool> =>\n checkBannedTool(root, PYTHON);\n","import { Array as Arr, Effect, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n manifestSpecifiers,\n manifestPattern,\n offsetIn,\n} from \"#/entities/package/index.ts\";\nimport type { Specified } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"uncataloged-dependency\";\nconst OWNED_ELSEWHERE: readonly string[] = [\"catalog:\", \"workspace:\", \"link:\", \"file:\"];\nconst ROOT_DIRECTORY = \".\";\nconst PLUGIN_MANIFEST = \".claude-plugin/plugin.json\";\nconst MESSAGE =\n \"is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.\";\n\nconst isOwnedElsewhere = ({ specifier }: Specified): boolean =>\n pipe(\n OWNED_ELSEWHERE,\n Arr.some((protocol) => Str.startsWith(protocol)(specifier)),\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n manifestSpecifiers(source),\n Arr.filter((found) => !isOwnedElsewhere(found)),\n Arr.map((found): Problem => ({\n file: entry.file,\n ...positionOf(source)(offsetIn(source)(manifestPattern(found))),\n rule: RULE,\n message: `\\`${found.name}\\` \\`${found.specifier}\\` ${MESSAGE}`,\n })),\n );\n\n/** @internal */\nexport const uncatalogedDependencies = Effect.fn(\"uncatalogedDependencies\")(\n function* uncatalogedDependencies(root: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(root);\n const installed = yield* pipe(\n directories,\n Effect.filter((directory) =>\n files\n .exists(files.join(root, directory, PLUGIN_MANIFEST))\n .pipe(Effect.map((found) => !found)),\n ),\n );\n const listed = pipe(\n [ROOT_DIRECTORY, ...installed],\n Arr.map((directory): Listed => {\n const name = files.join(directory, MANIFEST_FILE);\n return { name, file: files.join(root, name) };\n }),\n );\n return yield* scanText(listed, problemsIn);\n },\n);\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { decodeManifest, fieldsOf, namedCatalogsOf } from \"#/entities/package/index.ts\";\nimport type { Fields } from \"#/entities/package/index.ts\";\nimport { lockedPackages, workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { uncatalogedDependencies } from \"./uncataloged-dependencies.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst MANIFEST = /(?:^|\\/)package\\.json$/u;\nconst CATALOG_PROTOCOL = \"catalog:\";\nconst DEFAULT_CATALOG = \"default\";\nconst VERSION_SEPARATOR = \"||\";\nconst WILDCARD = \"*\";\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;\nconst READ_CONCURRENCY = 16;\nconst STALE_RULE: RuleName = \"stale-release-age-exclude\";\nconst UNUSED_RULE: RuleName = \"unused-catalog-entry\";\nconst STALE_MESSAGE =\n \"excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.\";\nconst UNUSED_MESSAGE =\n \"is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.\";\n\ninterface CatalogEntry {\n readonly catalog: string;\n readonly name: string;\n}\n\nconst decodeString = Schema.decodeUnknownOption(Schema.String);\nconst decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));\n\nconst entriesOf =\n (catalog: string) =>\n (held: unknown): readonly CatalogEntry[] =>\n pipe(\n Rec.keys(fieldsOf(held)),\n Arr.map((name) => ({ catalog, name })),\n );\n\nconst catalogEntries = (settings: Fields): readonly CatalogEntry[] => [\n ...entriesOf(DEFAULT_CATALOG)(settings[\"catalog\"]),\n ...pipe(\n namedCatalogsOf(settings),\n Arr.flatMap(([catalog, held]) => entriesOf(catalog)(held)),\n ),\n];\n\nconst catalogOf = (specifier: string): Option.Option<string> =>\n pipe(\n Option.liftPredicate(specifier, Str.startsWith(CATALOG_PROTOCOL)),\n Option.map(Str.slice(CATALOG_PROTOCOL.length)),\n Option.map((name) =>\n Option.getOrElse(Option.liftPredicate(name, Str.isNonEmpty), () => DEFAULT_CATALOG),\n ),\n );\n\nconst referenceOf = ([name, specifier]: readonly [string, unknown]): readonly string[] =>\n pipe(\n decodeString(specifier),\n Option.flatMap(catalogOf),\n Option.map((catalog) => `${catalog}:${name}`),\n Option.toArray,\n );\n\nconst referencesIn = (manifest: Fields): readonly string[] =>\n pipe(\n Rec.values(manifest),\n Arr.flatMap((section) => pipe(fieldsOf(section), Rec.toEntries, Arr.flatMap(referenceOf))),\n );\n\nconst versionsOf = (raw: string | undefined): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(raw),\n Option.map((listed) => pipe(Str.split(listed, VERSION_SEPARATOR), Arr.map(Str.trim))),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst hasKeyWith =\n (keys: readonly string[]) =>\n (prefix: string): boolean =>\n pipe(keys, Arr.some(Str.startsWith(prefix)));\n\nconst isLocked =\n (keys: readonly string[]) =>\n (resolved: string): boolean =>\n Arr.contains(keys, resolved) || hasKeyWith(keys)(`${resolved}(`);\n\nconst hasPackage =\n (keys: readonly string[]) =>\n (name: string): boolean =>\n hasKeyWith(keys)(`${name}@`);\n\nconst lockedVersion =\n (keys: readonly string[], name: string) =>\n (version: string): boolean =>\n isLocked(keys)(`${name}@${version}`);\n\nconst resolvedIn =\n (keys: readonly string[]) =>\n (entry: string): boolean =>\n Str.includes(WILDCARD)(entry) ||\n pipe(\n Option.fromNullishOr(SCOPED_NAME.exec(entry)),\n Option.flatMap(({ groups }) => Option.fromUndefinedOr(groups)),\n Option.match({\n onNone: () => true,\n onSome: ({ name = \"\", versions }) =>\n Arr.match(versionsOf(versions), {\n onEmpty: () => hasPackage(keys)(name),\n onNonEmpty: Arr.some(lockedVersion(keys, name)),\n }),\n }),\n );\n\nconst lockedKeys = (root: string): Effect.Effect<Option.Option<readonly string[]>> =>\n lockedPackages(root).pipe(Effect.orElseSucceed(() => Option.none()));\n\nconst usedReferences = Effect.fn(\"usedReferences\")(function* usedReferences(\n root: string,\n settings: Fields,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const manifests = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((name) => MANIFEST.test(name)),\n ),\n (name) => files.readFile(files.join(root, name)),\n { concurrency: READ_CONCURRENCY },\n );\n const fromManifests = pipe(\n Arr.getSomes(manifests),\n Arr.flatMap((text) => Option.toArray(decodeManifest(text))),\n Arr.flatMap(referencesIn),\n );\n const fromOverrides = pipe(\n fieldsOf(settings[\"overrides\"]),\n Rec.toEntries,\n Arr.flatMap(referenceOf),\n );\n return new Set([...fromManifests, ...fromOverrides]);\n});\n\nconst lineOf =\n (source: string) =>\n (needle: RegExp): number =>\n pipe(\n Str.split(source, \"\\n\"),\n Arr.findFirstIndex((line) => needle.test(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst quoted = (name: string): string =>\n Str.replaceAll(/[$()*+.?[\\\\\\]^{|}]/gu, String.raw`\\$&`)(name);\n\nconst entryLine = (name: string): RegExp => new RegExp(`^\\\\s+[\"']?${quoted(name)}[\"']?:`, \"u\");\n\nconst excludeLine = (entry: string): RegExp =>\n new RegExp(`^\\\\s+-\\\\s+[\"']?${quoted(entry)}[\"']?\\\\s*$`, \"u\");\n\ninterface Located {\n readonly file: string;\n readonly at: (needle: RegExp) => number;\n}\n\nconst problemAt =\n ({ file, at }: Located, rule: RuleName, message: string) =>\n (name: string, needle: RegExp): Problem => ({\n file,\n line: at(needle),\n column: FIRST_COLUMN,\n rule,\n message: `\\`${name}\\` ${message}`,\n });\n\nconst unusedIn = (\n located: Located,\n settings: Fields,\n isUsed: (reference: string) => boolean,\n): readonly Problem[] =>\n pipe(\n catalogEntries(settings),\n Arr.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)),\n Arr.map(({ name }) => problemAt(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))),\n );\n\nconst staleIn = (\n located: Located,\n settings: Fields,\n keys: Option.Option<readonly string[]>,\n): readonly Problem[] => {\n const excludes = Option.getOrElse(\n decodeStrings(settings[\"minimumReleaseAgeExclude\"]),\n (): readonly string[] => [],\n );\n return pipe(\n Option.toArray(keys),\n Arr.flatMap((locked) =>\n pipe(\n excludes,\n Arr.filter((entry) => !resolvedIn(locked)(entry)),\n ),\n ),\n Arr.map((entry) => problemAt(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))),\n );\n};\n\nconst findingsIn = Effect.fn(\"findingsIn\")(function* findingsIn(\n root: string,\n file: string,\n settings: Fields,\n) {\n const files = yield* RepositoryFiles;\n const read = yield* files.readFile(file);\n const located: Located = { file, at: lineOf(Option.getOrElse(read, () => \"\")) };\n const used = yield* usedReferences(root, settings);\n const keys = yield* lockedKeys(root);\n return [\n ...unusedIn(located, settings, (reference) => used.has(reference)),\n ...staleIn(located, settings, keys),\n ];\n});\n\n/** @internal */\nexport const checkCatalogEntries = Effect.fn(\"checkCatalogEntries\")(function* checkCatalogEntries(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* workspaceManifest(root);\n const catalogs = yield* Option.match(manifest, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE), fieldsOf(settings)),\n });\n const uncataloged = yield* Option.match(manifest, {\n onNone: () => Effect.succeed<readonly Problem[]>([]),\n onSome: () => uncatalogedDependencies(root),\n });\n return [...catalogs, ...uncataloged];\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst ENTRY_RULE: RuleName = \"unlocked-skill\";\nconst VISIBLE_RULE: RuleName = \"skill-source-visible\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst RENOVATE_FILE = \"renovate.json\";\nconst SOURCE = \"masseater/skills\";\nconst PRESET = \"github>masseater/ecosystems//libs/vite-plus-adopt/renovate\";\nconst START = 0;\nconst LOCAL_PREFIX = \"./\";\nconst REGEX_SPECIAL = /[.*+?^${}()|[\\]\\\\/]/gu;\n\nconst Source = Schema.Struct({\n commit: Schema.optional(Schema.String),\n skills: Schema.Union([Schema.Literal(\"all\"), Schema.Array(Schema.String)]),\n});\nconst SkillsConfig = Schema.Struct({\n skills: Schema.Record(Schema.String, Source),\n});\nconst decodeSkills = Schema.decodeUnknownOption(SkillsConfig);\n\nconst taggedError = Schema.TaggedError;\n\nclass SkillsConfigUnreadable extends taggedError<\n SkillsConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"SkillsConfigUnreadable\", { file: Schema.String }) {}\n\ntype Sources = Readonly<Record<string, typeof Source.Type>>;\n\ninterface Declared {\n readonly file: string;\n readonly text: string;\n readonly sources: Sources;\n}\n\nconst problemAt =\n (rule: RuleName, file: string, text: string) =>\n (anchor: string, message: string): Problem => ({\n file,\n ...positionOf(text)(\n pipe(\n Str.indexOf(anchor)(text),\n Option.getOrElse(() => START),\n ),\n ),\n rule,\n message,\n });\n\nconst declaredSkills = Effect.fn(\"declaredSkills\")(function* declaredSkills(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<Declared>();\n }\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => SkillsConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(\n config,\n Option.flatMap(decodeSkills),\n Option.map(({ skills }): Declared => ({ file, text: text.value, sources: skills })),\n );\n});\n\nconst entryProblems = ({ file, text, sources }: Declared): readonly Problem[] => {\n const at = problemAt(ENTRY_RULE, file, text);\n return pipe(\n Rec.get(sources, SOURCE),\n Option.match({\n onNone: () => [\n at(\n \"skills\",\n `does not install ${SOURCE}. Add \"${SOURCE}\": { commit, root: \"plugins/masseater-skills/skills\", skills: \"all\" } to skills.`,\n ),\n ],\n onSome: (source) =>\n pipe(\n Option.liftPredicate(source, ({ skills }) => skills !== \"all\"),\n Option.map(() =>\n at(\n `\"${SOURCE}\"`,\n `picks skills from ${SOURCE} by name. Write skills: \"all\", so every repository gets each new skill with the next digest update.`,\n ),\n ),\n Option.toArray,\n ),\n }),\n );\n};\n\nconst literalPattern = (repository: string, commit: string): RegExp =>\n new RegExp(\n `\"${Str.replaceAll(REGEX_SPECIAL, String.raw`\\$&`)(repository)}\": \\\\{\\\\s*commit: \"${commit}\"`,\n \"u\",\n );\n\nconst visibleProblems = ({ file, text, sources }: Declared): readonly Problem[] =>\n pipe(\n Rec.toEntries(sources),\n Arr.filter(([repository]) => !Str.startsWith(LOCAL_PREFIX)(repository)),\n Arr.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? \"\").test(text)),\n Arr.map(([repository]) =>\n problemAt(\n VISIBLE_RULE,\n file,\n text,\n )(\n repository,\n `declares ${repository} in a form the Renovate preset cannot read. Write \"${repository}\": { commit: \"<sha>\", ... } with commit first and as a string literal.`,\n ),\n ),\n );\n\nconst presetProblems = Effect.fn(\"presetProblems\")(function* presetProblems(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, RENOVATE_FILE);\n const text = yield* files.readFile(file);\n const extended = pipe(text, Option.exists(Str.includes(`\"${PRESET}\"`)));\n if (extended) {\n return [];\n }\n return [\n problemAt(\n VISIBLE_RULE,\n file,\n Option.getOrElse(text, () => \"\"),\n )(\n \"extends\",\n `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`,\n ),\n ];\n});\n\n/** @internal */\nexport const checkSkillEntry = Effect.fn(\"checkSkillEntry\")(function* checkSkillEntry(\n root: string,\n) {\n const declared = yield* declaredSkills(root);\n if (Option.isNone(declared)) {\n return [];\n }\n const preset = yield* presetProblems(root);\n return [...entryProblems(declared.value), ...visibleProblems(declared.value), ...preset];\n});\n","import { fileURLToPath } from \"node:url\";\n\nimport { findSkillFiles } from \"@tanstack/intent\";\nimport { Array as Arr, Effect, Option, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { publishedProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"published-skills\";\nconst KEYWORD = \"tanstack-intent\";\nconst SKILLS = \"skills\";\nconst MANIFEST_FILE = \"package.json\";\nconst SKILL_FILE = \"SKILL.md\";\nconst SUCCEEDED = 0;\nconst INTENT_CLI = fileURLToPath(new URL(\"./cli.mjs\", import.meta.resolve(\"@tanstack/intent\")));\n\nconst problemAt = problemInFile(RULE);\n\nconst skillDirectoriesIn = (\n files: typeof RepositoryFiles.Service,\n directory: string,\n): readonly string[] =>\n pipe(\n findSkillFiles(files.join(directory, SKILLS)),\n Arr.filter((file) => files.basename(file) === SKILL_FILE),\n Arr.map((file) => files.relative(directory, files.dirname(file))),\n );\n\nconst isShipped =\n (listed: readonly string[]) =>\n (skill: string): boolean =>\n Arr.contains(listed, SKILLS) || Arr.contains(listed, skill);\n\nconst packagingMessages = (\n { keywords, files }: WorkspaceProject,\n skills: readonly string[],\n): readonly string[] => {\n const keyword = pipe(\n Option.liftPredicate(keywords, (own) => !Arr.contains(own, KEYWORD)),\n Option.map(\n () =>\n `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`,\n ),\n );\n const unshipped = pipe(\n files,\n Option.map((listed) =>\n pipe(\n skills,\n Arr.filter((skill) => !isShipped(listed)(skill)),\n ),\n ),\n Option.filter((left) => Arr.isReadonlyArrayNonEmpty(left)),\n Option.map(\n (left) =>\n `leaves ${Arr.join(left, \", \")} out of files, so the published package does not ship them. List them in files.`,\n ),\n );\n return Arr.getSomes([keyword, unshipped]);\n};\n\nconst validationOf = Effect.fn(\"validationOf\")(function* validationOf(directory: string) {\n const handle = yield* ChildProcess.make(\"node\", [INTENT_CLI, \"validate\", SKILLS], {\n cwd: directory,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [output, status] = yield* Effect.all(\n [handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n return Option.liftPredicate(Str.trim(output), () => Number(status) !== SUCCEEDED);\n}, Effect.scoped);\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n project: WorkspaceProject,\n) {\n const files = yield* RepositoryFiles;\n const directory = files.join(root, project.directory);\n const manifest = files.join(directory, MANIFEST_FILE);\n const skills = skillDirectoriesIn(files, directory);\n if (!Arr.isReadonlyArrayNonEmpty(skills)) {\n return [\n problemAt(\n manifest,\n `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`,\n ),\n ];\n }\n const validation = yield* validationOf(directory).pipe(\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return [\n ...pipe(\n packagingMessages(project, skills),\n Arr.map((message) => problemAt(manifest, message)),\n ),\n ...pipe(\n validation,\n Option.map((output) =>\n problemAt(files.join(directory, SKILLS), `fails intent validate:\\n${output}`),\n ),\n Option.toArray,\n ),\n ];\n});\n\n/** @internal */\nexport const checkPublishedSkills = Effect.fn(\"checkPublishedSkills\")(\n function* checkPublishedSkills(root: string) {\n const projects = yield* publishedProjects(root);\n const problems = yield* Effect.forEach(projects, (project) => problemsIn(root, project), {\n concurrency: 1,\n });\n return Arr.flatten(problems);\n },\n);\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"skill-file\";\nconst SKILL_FILE = /(?:^|\\/)SKILL\\.md$/u;\nconst INSTALLED = /(?:^|\\/)\\.(?:agents|claude|codex)\\/skills\\//u;\nconst FIXTURE = /(?:^|\\/)fixtures\\//u;\nconst MARKDOWN = \".md\";\nconst LICENSE_FILE = /^LICEN[CS]E(?:\\.[^/]+)?$/iu;\nconst FRONTMATTER = /^---\\n(?<yaml>[\\s\\S]*?)\\n---\\n/u;\nconst HEADING = /^# (?<title>.+)$/mu;\nconst NAME_KEY = /^name:/mu;\nconst LICENSE_KEY = /^license:/mu;\nconst CODE = /```[\\s\\S]*?```|`[^`\\n]*`/gu;\nconst LINK = /\\]\\((?<target>[^)\\s]+)\\)/gu;\nconst EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\\/)|[<>{}]/iu;\nconst FRAGMENT = /#.*$/u;\nconst GITHUB = \"https://github.com/\";\nconst COMMIT_LINK = /\\/(?:blob|tree)\\/[0-9a-f]{40}(?:\\/|$)/u;\nconst BLANK = /\\s+/u;\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst FIRST = 1;\nconst READ_CONCURRENCY = 16;\n\nconst Metadata = Schema.Struct({ \"derived-from\": Schema.optional(Schema.String) });\nconst Frontmatter = Schema.Struct({\n name: Schema.optional(Schema.String),\n license: Schema.optional(Schema.Unknown),\n metadata: Schema.optional(Metadata),\n});\nconst decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);\n\ninterface Skill {\n readonly file: string;\n readonly directory: string;\n readonly source: string;\n}\n\nconst offsetOf = (source: string, pattern: RegExp | string): number =>\n pipe(\n Str.search(pattern)(source),\n Option.getOrElse(() => START),\n );\n\nconst frontmatterOf = (source: string): Option.Option<typeof Frontmatter.Type> =>\n pipe(\n groupOf(\"yaml\")(FRONTMATTER.exec(source)),\n Option.flatMap(Option.liftThrowable((yaml: string): unknown => parse(yaml))),\n Option.flatMap(decodeFrontmatter),\n );\n\nconst bodyStartOf = (source: string): number =>\n pipe(\n Option.fromNullishOr(FRONTMATTER.exec(source)),\n Option.map((found) => found[START].length),\n Option.getOrElse(() => START),\n );\n\nconst headingText = (heading: Option.Option<string>): string =>\n pipe(\n heading,\n Option.map((title) => `\"# ${title}\"`),\n Option.getOrElse(() => \"missing\"),\n );\n\nconst nameProblems = (\n { source, directory }: Skill,\n name: string,\n folder: string,\n): readonly { readonly index: number; readonly message: string }[] => {\n const bodyStart = bodyStartOf(source);\n const body = Str.slice(bodyStart)(source);\n const heading = groupOf(\"title\")(HEADING.exec(body));\n return [\n ...pipe(\n Option.liftPredicate(name, (found) => found !== folder),\n Option.map((found) => ({\n index: offsetOf(source, NAME_KEY),\n message: `The frontmatter name \"${found}\" differs from the directory ${directory}. Give the skill the name of its directory.`,\n })),\n Option.toArray,\n ),\n ...pipe(\n Option.liftPredicate(heading, (found) => !Option.contains(found, name)),\n Option.map((found) => ({\n index: bodyStart + offsetOf(body, HEADING),\n message: `The first heading is ${headingText(found)}. Start the body with \"# ${name}\", the frontmatter name.`,\n })),\n Option.toArray,\n ),\n ];\n};\n\nconst derivedProblems = (\n source: string,\n derived: string,\n): readonly { readonly index: number; readonly message: string }[] =>\n pipe(\n Str.split(Str.trim(derived), BLANK),\n Arr.filter((url) => Str.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)),\n Arr.map((url) => ({\n index: offsetOf(source, url),\n message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`,\n })),\n );\n\nconst frontmatterProblems = (skill: Skill, folder: string): readonly Problem[] =>\n pipe(\n frontmatterOf(skill.source),\n Option.map((frontmatter) => [\n ...pipe(\n Option.fromUndefinedOr(frontmatter.name),\n Option.map((name) => nameProblems(skill, name, folder)),\n Option.getOrElse(() => []),\n ),\n ...pipe(\n Option.fromUndefinedOr(frontmatter.license),\n Option.map(() => ({\n index: offsetOf(skill.source, LICENSE_KEY),\n message:\n \"The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it.\",\n })),\n Option.toArray,\n ),\n ...pipe(\n Option.fromUndefinedOr(frontmatter.metadata),\n Option.flatMap((metadata) => Option.fromUndefinedOr(metadata[\"derived-from\"])),\n Option.map((derived) => derivedProblems(skill.source, derived)),\n Option.getOrElse(() => []),\n ),\n ]),\n Option.getOrElse(() => []),\n Arr.map(({ index, message }): Problem => ({\n file: skill.file,\n ...positionOf(skill.source)(index),\n rule: RULE,\n message,\n })),\n );\n\ninterface Link {\n readonly target: string;\n readonly index: number;\n}\n\nconst linkOf = (found: RegExpMatchArray): readonly Link[] =>\n pipe(\n groupOf(\"target\")(found),\n Option.filter((target) => !EXTERNAL.test(target)),\n Option.map((target) => Str.replace(FRAGMENT, \"\")(target)),\n Option.filter(Str.isNonEmpty),\n Option.map((target): Link => ({ target, index: found.index ?? START })),\n Option.toArray,\n );\n\ntype Range = readonly [start: number, end: number];\n\nconst rangeOf = (found: RegExpMatchArray): Range => {\n const start = found.index ?? START;\n return [start, start + found[START].length];\n};\n\nconst isOutside =\n (ranges: readonly Range[]) =>\n ({ index }: Link): boolean =>\n !pipe(\n ranges,\n Arr.some(([start, end]) => index >= start && index < end),\n );\n\nconst linksIn = (source: string): readonly Link[] => {\n const code = pipe(Arr.fromIterable(Str.matchAll(CODE)(source)), Arr.map(rangeOf));\n return pipe(\n Arr.fromIterable(Str.matchAll(LINK)(source)),\n Arr.flatMap(linkOf),\n Arr.filter(isOutside(code)),\n );\n};\n\nconst linkProblems = Effect.fn(\"linkProblems\")(function* linkProblems(file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return [];\n }\n const source = text.value;\n const directory = files.dirname(file);\n const isMissing = ({ target }: Link): Effect.Effect<boolean> =>\n files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));\n const missing = yield* Effect.filter(linksIn(source), isMissing);\n return pipe(\n missing,\n Arr.map(({ target, index }): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: `links to ${target}, which does not exist. Fix the path or remove the link.`,\n })),\n );\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n listed: readonly string[],\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, name);\n const directory = files.dirname(name);\n const inside = pipe(listed, Arr.filter(Str.startsWith(`${directory}${SEPARATOR}`)));\n const text = yield* files.readFile(file);\n const documents = pipe(\n inside,\n Arr.filter(Str.endsWith(MARKDOWN)),\n Arr.map((entry) => files.join(root, entry)),\n );\n const links = yield* Effect.forEach(documents, linkProblems, {\n concurrency: READ_CONCURRENCY,\n });\n const licenses = pipe(\n inside,\n Arr.filter((entry) => files.dirname(entry) === directory),\n Arr.filter((entry) => LICENSE_FILE.test(files.basename(entry))),\n Arr.map((entry): Problem => ({\n file: files.join(root, entry),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message:\n \"is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it.\",\n })),\n );\n return [\n ...pipe(\n text,\n Option.map((source) =>\n frontmatterProblems({ file, directory, source }, files.basename(directory)),\n ),\n Option.getOrElse((): readonly Problem[] => []),\n ),\n ...licenses,\n ...Arr.flatten(links),\n ];\n});\n\n/** @internal */\nexport const checkSkillFiles = Effect.fn(\"checkSkillFiles\")(function* checkSkillFiles(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const skills = pipe(\n listed,\n Arr.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)),\n );\n const found = yield* Effect.forEach(skills, (name) => problemsIn(root, listed, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\nimport { parse } from \"yaml\";\n\nimport { fieldsOf, namedCatalogsOf } from \"#/entities/package/index.ts\";\nimport type { Fields } from \"#/entities/package/index.ts\";\n\nexport interface VersionEntry {\n readonly key: string;\n readonly name: string;\n readonly spec: string;\n}\n\nconst MANIFEST_SECTIONS = [\"dependencies\", \"devDependencies\", \"optionalDependencies\", \"engines\"];\nconst CARGO_SECTIONS = [\"dependencies\", \"dev-dependencies\", \"build-dependencies\"];\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\nconst decodeString = Schema.decodeUnknownOption(Schema.String);\nconst decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));\n\nconst decodeSpec = (value: unknown): Option.Option<string> =>\n Option.orElse(decodeString(value), () =>\n Option.map(decodeVersioned(value), ({ version }) => version),\n );\n\nconst PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));\n\nconst decodePackageManager = Schema.decodeUnknownOption(PackageManager);\n\nconst fieldOf =\n (name: string) =>\n (value: unknown): unknown =>\n fieldsOf(value)[name];\n\nconst entriesIn =\n (section: string) =>\n (held: unknown): readonly VersionEntry[] =>\n pipe(\n Rec.toEntries(fieldsOf(held)),\n Arr.flatMap(([name, value]) =>\n pipe(\n decodeSpec(value),\n Option.map((spec) => ({ key: `${section}:${name}`, name, spec })),\n Option.toArray,\n ),\n ),\n );\n\nconst sectionsIn =\n (sections: readonly string[]) =>\n (fields: Fields): readonly VersionEntry[] =>\n pipe(\n sections,\n Arr.flatMap((section) => entriesIn(section)(fields[section])),\n );\n\nconst packageManagerOf = (value: unknown): readonly VersionEntry[] =>\n pipe(\n decodePackageManager(value),\n Option.map((raw) => {\n const [name, version = \"\"] = Str.split(raw, \"@\");\n return { key: `packageManager:${name}`, name, spec: version };\n }),\n Option.toArray,\n );\n\nexport const manifestEntries = (text: string): readonly VersionEntry[] => {\n const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);\n return [\n ...sectionsIn(MANIFEST_SECTIONS)(manifest),\n ...packageManagerOf(manifest[\"packageManager\"]),\n ];\n};\n\nconst catalogsIn = (settings: Fields): readonly VersionEntry[] =>\n pipe(\n namedCatalogsOf(settings),\n Arr.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)),\n );\n\nexport const workspaceEntries = (text: string): readonly VersionEntry[] => {\n const settings = Option.liftThrowable(() => parse(text) as unknown)().pipe(\n Option.getOrUndefined,\n fieldsOf,\n );\n return [...sectionsIn([\"catalog\", \"overrides\"])(settings), ...catalogsIn(settings)];\n};\n\nconst parseToml = (text: string): Fields =>\n pipe(\n Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(),\n Option.map(fieldsOf),\n Option.getOrElse(() => ({})),\n );\n\nconst singleEntry = (key: string, value: unknown): readonly VersionEntry[] =>\n pipe(\n decodeSpec(value),\n Option.map((spec) => ({ key, name: key, spec })),\n Option.toArray,\n );\n\nexport const cargoEntries = (text: string): readonly VersionEntry[] => {\n const cargo = parseToml(text);\n return [\n ...sectionsIn(CARGO_SECTIONS)(cargo),\n ...entriesIn(\"workspace.dependencies\")(fieldOf(\"dependencies\")(cargo[\"workspace\"])),\n ...singleEntry(\"rust-version\", fieldOf(\"rust-version\")(cargo[\"package\"])),\n ];\n};\n\nexport const toolchainEntries = (text: string): readonly VersionEntry[] =>\n singleEntry(\"channel\", fieldOf(\"channel\")(parseToml(text)[\"toolchain\"]));\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { baseRevision } from \"#/shared/lib/base-revision.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport {\n cargoEntries,\n manifestEntries,\n toolchainEntries,\n workspaceEntries,\n} from \"./version-entries.ts\";\nimport type { VersionEntry } from \"./version-entries.ts\";\n\nconst RULE: RuleName = \"version-downgrade\";\nconst READ_CONCURRENCY = 16;\n\nconst READERS: readonly (readonly [RegExp, (text: string) => readonly VersionEntry[]])[] = [\n [/(?:^|\\/)package\\.json$/u, manifestEntries],\n [/^pnpm-workspace\\.yaml$/u, workspaceEntries],\n [/(?:^|\\/)Cargo\\.toml$/u, cargoEntries],\n [/(?:^|\\/)rust-toolchain\\.toml$/u, toolchainEntries],\n];\n\nconst lowestOf = (spec: string): Option.Option<semver.SemVer> =>\n pipe(\n Option.liftThrowable(() => semver.minVersion(spec))(),\n Option.flatMap(Option.fromNullishOr),\n Option.orElse(() => Option.fromNullishOr(semver.coerce(spec))),\n );\n\nconst isLower = (before: string, after: string): boolean =>\n pipe(\n Option.all([lowestOf(before), lowestOf(after)]),\n Option.match({\n onNone: () => false,\n onSome: ([old, current]) => semver.lt(current, old),\n }),\n );\n\nconst FIRST_LINE = 1;\n\nconst lineOf = (text: string, { name, spec }: VersionEntry): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes(name)(line) && Str.includes(spec)(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst message = (before: VersionEntry, after: VersionEntry): string =>\n `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;\n\ninterface Compared {\n readonly file: string;\n readonly text: string;\n readonly before: readonly VersionEntry[];\n readonly after: readonly VersionEntry[];\n}\n\nconst downgradesIn = ({ file, text, before, after }: Compared): readonly Problem[] => {\n const previous = Rec.fromEntries(\n pipe(\n before,\n Arr.map((entry) => [entry.key, entry] as const),\n ),\n );\n return pipe(\n after,\n Arr.flatMap((entry) =>\n pipe(\n Rec.get(previous, entry.key),\n Option.filter((old) => isLower(old.spec, entry.spec)),\n Option.map((old): Problem => ({\n file,\n line: lineOf(text, entry),\n column: FIRST_LINE,\n rule: RULE,\n message: message(old, entry),\n })),\n Option.toArray,\n ),\n ),\n );\n};\n\n/** @internal */\nexport const checkDowngrades = Effect.fn(\"checkDowngrades\")(function* checkDowngrades(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const base = yield* baseRevision(root);\n if (Option.isNone(base)) {\n return [];\n }\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.flatMap((name) =>\n pipe(\n READERS,\n Arr.findFirst(([pattern]) => pattern.test(name)),\n Option.map(([, read]) => [name, read] as const),\n Option.toArray,\n ),\n ),\n ),\n ([name, read]) =>\n Effect.gen(function* compare() {\n const file = files.join(root, name);\n const current = yield* files.readFile(file);\n const previous = yield* files.readAtRevision(root, base.value, name);\n return pipe(\n Option.all([previous, current]),\n Option.map(([before, after]) =>\n downgradesIn({ file, text: after, before: read(before), after: read(after) }),\n ),\n Option.getOrElse((): readonly Problem[] => []),\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RENOVATE_FILE = /^(?:\\.github\\/|\\.gitlab\\/)?(?:renovate\\.json5?|\\.renovaterc(?:\\.json5?)?)$/u;\nconst AUTOMERGE_OFF = /[\"']?platformAutomerge[\"']?\\s*:\\s*false/gu;\nconst VERSION_CAP = /[\"']?allowedVersions[\"']?\\s*:\\s*[\"'](?<range>[^\"']*<[^\"']*)[\"']/gu;\nconst AUTOMERGE_RULE: RuleName = \"renovate-platform-automerge\";\nconst CAP_RULE: RuleName = \"renovate-version-cap\";\nconst PRESET_RULE: RuleName = \"renovate-msch-preset\";\nconst PRESET = \"github>masseater/ecosystems//libs/msch/renovate\";\nconst START = 0;\nconst READ_CONCURRENCY = 16;\nconst AUTOMERGE_MESSAGE =\n \"sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.\";\nconst CAP_MESSAGE =\n \"caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.\";\n\nconst PRESET_MESSAGE = `does not extend \\`${PRESET}\\`, so Renovate writes ranges that the \\`version-range\\` check rejects. Add it to \\`extends\\`.`;\n\nconst offsetsOf = (pattern: RegExp, source: string): readonly number[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))),\n );\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n const at = positionOf(source);\n const found = (pattern: RegExp, rule: RuleName, message: string): readonly Problem[] =>\n pipe(\n offsetsOf(pattern, source),\n Arr.map((offset): Problem => ({ file, ...at(offset), rule, message })),\n );\n return [\n ...found(AUTOMERGE_OFF, AUTOMERGE_RULE, AUTOMERGE_MESSAGE),\n ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),\n ...pipe(\n [{ file, ...at(START), rule: PRESET_RULE, message: PRESET_MESSAGE }],\n Arr.filter(() => !Str.includes(`\"${PRESET}\"`)(source)),\n ),\n ];\n};\n\n/** @internal */\nexport const checkRenovateSettings = Effect.fn(\"checkRenovateSettings\")(\n function* checkRenovateSettings(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n pipe(\n listed,\n Arr.filter((name) => RENOVATE_FILE.test(name)),\n ),\n (name) => {\n const file = files.join(root, name);\n return files\n .readFile(file)\n .pipe(\n Effect.map(\n Option.match({ onNone: () => [], onSome: (source) => problemsIn(file, source) }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { baseName, baseRevision } from \"#/shared/lib/base-revision.ts\";\nimport { manifestTexts } from \"#/shared/lib/manifest-texts.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unbumped-package\";\nconst UNSHIPPED =\n /(?:\\.test\\.[\\w.]+$|(?:^|\\/)(?:fixtures|__tests__|tests?)\\/|(?:^|\\/)(?:AGENTS|CLAUDE|CHANGELOG)\\.md$)/u;\nconst UNVERSIONED = \"0.0.0\";\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst READ_CONCURRENCY = 16;\n\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n version: Schema.String,\n private: Schema.optional(Schema.Boolean),\n }),\n);\n\ninterface Package {\n readonly file: string;\n readonly directory: string;\n readonly name: string;\n readonly version: string;\n readonly text: string;\n}\n\nconst LAST_SEGMENT = /[^/]*$/u;\n\nconst directoryOf = (file: string): string => Str.replace(LAST_SEGMENT, \"\")(file);\n\nconst decodeManifest = Schema.decodeUnknownOption(Manifest);\n\nconst packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodeManifest(text),\n Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED),\n Option.map(({ name, version }): Package => ({\n file,\n directory: directoryOf(file),\n name,\n version,\n text,\n })),\n );\n\nconst versionAt = (name: string, text: Option.Option<string>): Option.Option<string> =>\n pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.filter((manifest) => manifest.name === name),\n Option.map(({ version }) => version),\n Option.filter((version) => semver.valid(version) !== null),\n );\n\nconst versionLine = (text: string): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes('\"version\"')(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst shippedChange = (directory: string, changed: readonly string[]): boolean =>\n pipe(\n changed,\n Arr.some((name) => Str.startsWith(directory)(name) && !UNSHIPPED.test(name)),\n );\n\nconst higher = (left: string, right: string): string => {\n if (semver.gt(right, left)) {\n return right;\n }\n return left;\n};\n\nconst floorOf = (versions: readonly Option.Option<string>[]): Option.Option<string> => {\n let floor = Option.none<string>();\n for (const version of Arr.getSomes(versions)) {\n floor = Option.match(floor, {\n onNone: () => Option.some(version),\n onSome: (lowest) => Option.some(higher(version, lowest)),\n });\n }\n return floor;\n};\n\nconst message = ({ name, version }: Package, floor: string): string =>\n `${name} changed, but its version ${version} is not above ${floor}, the version of the base or of main. Another change may already publish ${floor}. Bump the version above ${floor}.`;\n\n/** @internal */\nexport const checkPackageVersions = Effect.fn(\"checkPackageVersions\")(\n function* checkPackageVersions(root: string) {\n const files = yield* RepositoryFiles;\n const base = yield* baseRevision(root);\n if (Option.isNone(base)) {\n return [];\n }\n const tip = yield* baseName;\n const changed = yield* files.changedFiles(root, base.value);\n const manifests = yield* manifestTexts(root);\n const packages = pipe(\n manifests,\n Arr.map(({ file, text }) => packageAt(file, text)),\n );\n const found = yield* Effect.forEach(\n pipe(\n Arr.getSomes(packages),\n Arr.filter(({ directory }) => shippedChange(directory, changed)),\n ),\n (pack) =>\n Effect.gen(function* compare() {\n const before = yield* files.readAtRevision(root, base.value, pack.file);\n const claimed = yield* files.readAtRevision(root, tip, pack.file);\n const floor = floorOf([versionAt(pack.name, before), versionAt(pack.name, claimed)]);\n return pipe(\n floor,\n Option.filter((lowest) => !semver.gt(pack.version, lowest)),\n Option.map((lowest): Problem => ({\n file: files.join(root, pack.file),\n line: versionLine(pack.text),\n column: FIRST_COLUMN,\n rule: RULE,\n message: message(pack, lowest),\n })),\n Option.toArray,\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n","import { fileURLToPath } from \"node:url\";\n\nimport {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { MANIFEST_FILE, readManifest } from \"#/entities/package/index.ts\";\nimport type { Manifest } from \"#/entities/package/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { isScannedText, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nexport interface AppliedPackage {\n readonly name: string;\n readonly bins: readonly string[];\n}\n\nconst MSCH = \"@r_masseater/msch\";\nconst SCOPE = \"@r_masseater/\";\nconst RULE: RuleName = \"applied-package\";\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst NOT_FOUND = -1;\nconst SEPARATOR = \"/\";\n\nconst BY_LENGTH = Order.mapInput(Order.Number, (text: string) => text.length);\n\nconst BinMap = Schema.Record(Schema.String, Schema.String);\nconst BinField = Schema.Struct({\n bin: Schema.optional(Schema.Union([Schema.String, BinMap])),\n});\nconst decodeBinField = Schema.decodeUnknownOption(Schema.fromJsonString(BinField));\n\nconst escaped = (text: string): string =>\n Str.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, String.raw`\\$&`)(text);\n\nconst declaredNames = (manifest: Manifest): readonly string[] =>\n pipe(\n [manifest.dependencies, manifest.devDependencies, manifest.peerDependencies],\n Arr.flatMap((field) => Rec.keys(field ?? {})),\n );\n\nconst binsIn = (name: string, text: string): readonly string[] =>\n pipe(\n decodeBinField(text),\n Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)),\n Option.match({\n onNone: (): readonly string[] => [],\n onSome: (bin) => {\n if (Predicate.isString(bin)) {\n return [pipe(name, Str.split(SEPARATOR), Arr.lastNonEmpty)];\n }\n return Rec.keys(bin);\n },\n }),\n );\n\nconst manifestOf = Option.liftThrowable((name: string): string =>\n fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE}`)),\n);\n\nconst installedPackage = Effect.fn(\"installedPackage\")(function* installedPackage(name: string) {\n const files = yield* RepositoryFiles;\n const text = yield* pipe(\n manifestOf(name),\n Option.match({\n onNone: () => Effect.succeed(Option.none<string>()),\n onSome: (file) => files.readFile(file),\n }),\n );\n return {\n name,\n bins: pipe(\n text,\n Option.map((source) => binsIn(name, source)),\n Option.getOrElse((): readonly string[] => []),\n ),\n };\n});\n\nconst appliedByMsch = Effect.fn(\"appliedByMsch\")(function* appliedByMsch() {\n const files = yield* RepositoryFiles;\n const manifest = yield* pipe(\n manifestOf(MSCH),\n Option.match({\n onNone: () => Effect.succeed(Option.none<Manifest>()),\n onSome: (file) => readManifest(files.dirname(file)),\n }),\n );\n const names = pipe(\n manifest,\n Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)),\n Option.map(Rec.keys),\n Option.getOrElse((): readonly string[] => []),\n Arr.filter(Str.startsWith(SCOPE)),\n );\n return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });\n});\n\nconst problemAt =\n (file: string, source: string) =>\n (index: number, name: string): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message: `msch applies ${name}. Remove this use and let msch apply it.`,\n });\n\nconst specifierPattern = ({ name }: AppliedPackage): RegExp =>\n new RegExp(`[\"'\\`]${escaped(name)}(?=[\"'\\`/])`, \"gu\");\n\nconst binPattern = (bin: string): RegExp =>\n new RegExp(`(?<![\\\\w./@:-])${escaped(bin)}(?=[ \\\\t\"'\\`]|$)`, \"gmu\");\n\nconst usesIn =\n (applied: readonly AppliedPackage[]) =>\n ({ file }: Listed, source: string): readonly Problem[] =>\n pipe(\n applied,\n Arr.flatMap((entry) =>\n pipe(\n [specifierPattern(entry), ...pipe(entry.bins, Arr.map(binPattern))],\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n Arr.map((found) => problemAt(file, source)(found.index ?? NOT_FOUND, entry.name)),\n ),\n ),\n );\n\nconst ownerOf =\n (directories: readonly string[]) =>\n (name: string): string =>\n pipe(\n directories,\n Arr.filter(\n (directory) => directory === \"\" || Str.startsWith(`${directory}${SEPARATOR}`)(name),\n ),\n Arr.match({ onEmpty: () => \"\", onNonEmpty: Arr.max(BY_LENGTH) }),\n );\n\nconst isScannedSource = (entry: Listed): boolean =>\n isScannedText(entry) && !Str.endsWith(MANIFEST_FILE)(entry.name) && entry.name !== WORKSPACE_FILE;\n\nconst consumersIn = Effect.fn(\"consumersIn\")(function* consumersIn(\n root: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n directories,\n Effect.filter((directory) =>\n readManifest(files.join(root, directory)).pipe(\n Effect.map(\n Option.exists(\n (manifest) => manifest.name !== MSCH && Arr.contains(declaredNames(manifest), MSCH),\n ),\n ),\n ),\n ),\n );\n});\n\nconst manifestUses = Effect.fn(\"manifestUses\")(function* manifestUses(\n root: string,\n appliedNames: readonly string[],\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, MANIFEST_FILE);\n const text = yield* files.readFile(file);\n const manifest = yield* readManifest(files.join(root, directory));\n return pipe(\n Option.all({ source: text, declared: manifest }),\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: ({ source, declared }) =>\n pipe(\n declaredNames(declared),\n Arr.filter((name) => Arr.contains(appliedNames, name)),\n Arr.flatMap((name) =>\n pipe(\n Str.indexOf(`\"${name}\"`)(source),\n Option.map((index) => problemAt(file, source)(index, name)),\n Option.toArray,\n ),\n ),\n ),\n }),\n );\n});\n\ninterface Scope {\n readonly root: string;\n readonly applied: readonly AppliedPackage[];\n readonly directories: readonly string[];\n readonly consumers: readonly string[];\n}\n\nconst sourceUses = Effect.fn(\"sourceUses\")(function* sourceUses({\n root,\n applied,\n directories,\n consumers,\n}: Scope) {\n const owner = ownerOf(directories);\n const listed = yield* listedFiles(root);\n const sources = pipe(\n listed,\n Arr.filter((entry) => isScannedSource(entry) && Arr.contains(consumers, owner(entry.name))),\n );\n return yield* scanText(sources, usesIn(applied));\n});\n\n/** @internal */\nexport const appliedPackageProblems = Effect.fn(\"appliedPackageProblems\")(\n function* appliedPackageProblems(root: string, applied: readonly AppliedPackage[]) {\n if (!Arr.isReadonlyArrayNonEmpty(applied)) {\n return [];\n }\n const workspaces = yield* workspaceDirectories(root);\n const directories = [\"\", ...workspaces];\n const consumers = yield* consumersIn(root, directories);\n const appliedNames = pipe(\n applied,\n Arr.map(({ name }) => name),\n );\n const manifestProblems = yield* Effect.forEach(\n consumers,\n (directory) => manifestUses(root, appliedNames, directory),\n {\n concurrency: 1,\n },\n );\n const sourceProblems = yield* sourceUses({ root, applied, directories, consumers });\n return [...Arr.flatten(manifestProblems), ...sourceProblems];\n },\n);\n\n/** @internal */\nexport const checkAppliedPackages = Effect.fn(\"checkAppliedPackages\")(\n function* checkAppliedPackages(root: string) {\n const applied = yield* appliedByMsch();\n return yield* appliedPackageProblems(root, applied);\n },\n);\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, presentFiles } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nconst RULE: RuleName = \"replaced-tool\";\nconst FIRST = 1;\nconst TASKS = \"Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`\";\nconst HOOKS = \"the hooks in .vite-hooks/ that `vp config` installs\";\nconst ALCHEMY = \"the Alchemy stack in alchemy.run.ts\";\n\ninterface ReplacedTool {\n readonly pattern: RegExp;\n readonly tool: string;\n readonly replacement: string;\n}\n\nconst REPLACED: readonly ReplacedTool[] = [\n { pattern: /(?:^|\\/)turbo\\.jsonc?$/u, tool: \"Turborepo\", replacement: TASKS },\n { pattern: /(?:^|\\/)nx\\.json$/u, tool: \"Nx\", replacement: TASKS },\n { pattern: /(?:^|\\/)\\.husky\\//u, tool: \"husky\", replacement: HOOKS },\n {\n pattern: /(?:^|\\/)(?:\\.?lefthook(?:-local)?\\.(?:ya?ml|toml|json)|\\.lefthook\\/)/u,\n tool: \"lefthook\",\n replacement: HOOKS,\n },\n {\n pattern: /(?:^|\\/)\\.?knip\\.(?:jsonc?|[cm]?[jt]s)$/u,\n tool: \"knip\",\n replacement: \"fallow\",\n },\n { pattern: /(?:^|\\/)\\.jscpd\\.json$/u, tool: \"jscpd\", replacement: \"fallow\" },\n {\n pattern: /(?:^|\\/)(?:\\.eslintrc(?:\\.\\w+)?|\\.eslintignore|eslint\\.config\\.[cm]?[jt]s)$/u,\n tool: \"ESLint\",\n replacement: \"`lint` in vite.config.ts, run with `vp check`\",\n },\n {\n pattern: /(?:^|\\/)(?:\\.prettierrc(?:\\.\\w+)?|\\.prettierignore|prettier\\.config\\.[cm]?[jt]s)$/u,\n tool: \"Prettier\",\n replacement: \"`fmt` in vite.config.ts, run with `vp check`\",\n },\n {\n pattern: /(?:^|\\/)jest\\.config\\.(?:json|[cm]?[jt]s)$/u,\n tool: \"Jest\",\n replacement: \"`test` in vite.config.ts, run with `vp test`\",\n },\n { pattern: /(?:^|\\/)wrangler\\.(?:toml|jsonc?)$/u, tool: \"wrangler\", replacement: ALCHEMY },\n { pattern: /(?:^|\\/)Pulumi(?:\\.[\\w-]+)?\\.ya?ml$/u, tool: \"Pulumi\", replacement: ALCHEMY },\n { pattern: /\\.tf(?:vars)?$/u, tool: \"Terraform\", replacement: ALCHEMY },\n {\n pattern: /(?:^|\\/)skills-lock\\.json$/u,\n tool: \"the skills CLI\",\n replacement: \"the `skills` section of vite.config.ts, installed by `msch --prepare`\",\n },\n {\n pattern: /(?:^|\\/)\\.claude\\/rules\\//u,\n tool: \".claude/rules\",\n replacement: \"the root AGENTS.md and the skills in masseater/skills\",\n },\n];\n\nconst problemFor = ({ name, file }: Listed): Option.Option<Problem> =>\n pipe(\n REPLACED,\n Arr.findFirst(({ pattern }) => pattern.test(name)),\n Option.map(({ tool, replacement }) => ({\n file,\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`,\n })),\n );\n\n/** @internal */\nexport const checkReplacedTools = Effect.fn(\"checkReplacedTools\")(function* checkReplacedTools(\n root: string,\n) {\n const listed = yield* listedFiles(root);\n const present = yield* presentFiles(\n pipe(\n listed,\n Arr.filter((entry) => Option.isSome(problemFor(entry))),\n ),\n );\n return pipe(\n present,\n Arr.flatMap((entry) => Option.toArray(problemFor(entry))),\n );\n});\n","import { join, parent } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\n\nconst FOREIGN_LOCKFILE =\n /(?:^|\\/)(?:package-lock\\.json|npm-shrinkwrap\\.json|yarn\\.lock|bun\\.lockb?)$/u;\nconst PLUGIN_LOCKFILE = /(?:^|\\/)bun\\.lock$/u;\nconst PLUGIN_MANIFEST = \".claude-plugin/plugin.json\";\n\nconst installedByClaudeCode =\n (present: readonly Listed[]) =>\n ({ name }: Listed): boolean =>\n PLUGIN_LOCKFILE.test(name) &&\n pipe(\n present,\n Arr.some((entry) => entry.name === join(parent(name))(PLUGIN_MANIFEST)),\n );\n\nexport const unneededLockfile =\n (present: readonly Listed[]) =>\n (entry: Listed): boolean =>\n FOREIGN_LOCKFILE.test(entry.name) && !installedByClaudeCode(present)(entry);\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport {\n isScannedText,\n isToolVersions,\n listedFiles,\n presentFiles,\n scanText,\n} from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { unneededLockfile } from \"./lockfiles.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst PNPM_DIRECTORY = \".pnpm/\";\nconst SEPARATOR = \"/\";\n\nconst CARGO_MANIFEST_FILE = /(?:^|\\/)Cargo\\.toml$/u;\nconst CARGO_LOCK_FILE = /(?:^|\\/)Cargo\\.lock$/u;\nconst PNPM_OUTPUT = /(?:^|\\/)\\.pnpm\\//u;\nconst CARGO_WORKSPACE = /^\\[workspace\\]/mu;\nconst LEGACY_CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config$/u;\nconst CARGO_CONFIG_FILE = /(?:^|\\/)\\.cargo\\/config\\.toml$/u;\nconst PNPM_CARGO_START = /# >>> pnpm-managed cargo sources >>>/u;\nconst PNPM_CARGO_BLOCK =\n /# >>> pnpm-managed cargo sources >>>[\\s\\S]*?# <<< pnpm-managed cargo sources <<<\\n?/gu;\n\nconst SETUP_PATTERNS: readonly RegExp[] = [\n /(?<![\\w./@-])rustup[ \\t]+(?:toolchain[ \\t]+install|install|update|default|override[ \\t]+set|target[ \\t]+add|component[ \\t]+add)\\b/gu,\n /(?<![\\w./@-])cargo[ \\t]+(?:vendor|fetch)\\b/gu,\n /\\buses:\\s*[\"']?(?:dtolnay\\/rust-toolchain|actions-rust-lang\\/setup-rust-toolchain|actions-rs\\/toolchain|moonrepo\\/setup-rust)\\b/gu,\n];\n\nconst INSTALL_PATTERNS: readonly RegExp[] = [/(?<![\\w./@-])cargo[ \\t]+b?install\\b/gu];\n\nconst TOOL_PATTERNS: readonly RegExp[] = [\n /^[ \\t]*[\"']?(?:rust|rustup)[\"']?[ \\t]*(?:=|[ \\t]+\\S)/gmu,\n];\n\nconst START = 0;\nconst LAST_SEGMENT = 1;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst WHOLE_MATCH = 0;\nconst FILE_RULE: RuleName = \"unneeded-file\";\nconst SETUP_RULE: RuleName = \"unneeded-setup\";\nconst CARGO_RULE: RuleName = \"cargo-outside-pnpm\";\n\nconst CargoSettings = Schema.Struct({ enabled: Schema.optionalKey(Schema.Boolean) });\nconst WorkspaceFile = Schema.Struct({ cargo: Schema.optionalKey(CargoSettings) });\nconst decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);\n\nconst cargoEnabled = (manifest: unknown): boolean =>\n pipe(\n decodeWorkspaceFile(manifest),\n Option.flatMap(({ cargo }) => Option.fromUndefinedOr(cargo)),\n Option.flatMap(({ enabled }) => Option.fromUndefinedOr(enabled)),\n Option.getOrElse(() => false),\n );\n\nconst problemAtStart =\n (rule: RuleName, message: string) =>\n ({ file }: Listed): Problem => ({\n file,\n line: FIRST_LINE,\n column: FIRST_COLUMN,\n rule,\n message,\n });\n\nconst foreignLockfile = problemAtStart(\n FILE_RULE,\n \"pnpm-lock.yaml is this repository's lockfile, and pnpm never reads this one. Delete it.\",\n);\n\nconst nestedCargoLock = problemAtStart(\n FILE_RULE,\n \"Cargo reads only the Cargo.lock beside the workspace's Cargo.toml, and pnpm install writes that one. Delete this one.\",\n);\n\nconst legacyCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .cargo/config.toml, and Cargo warns when .cargo/config sits beside it. Move its settings into .cargo/config.toml and delete it.\",\n);\n\nconst pnpmOutput = problemAtStart(\n FILE_RULE,\n \"pnpm install writes .pnpm/ from Cargo.lock and rust-toolchain.toml. Add this .pnpm directory to .gitignore and keep it out of the repository.\",\n);\n\nconst pnpmCargoConfig = problemAtStart(\n FILE_RULE,\n \"pnpm install writes this .cargo/config.toml, and it holds nothing else. Add /.cargo/config.toml to .gitignore and keep it out of the repository.\",\n);\n\nconst generatedCargoConfig = (entry: Listed, source: string): readonly Problem[] => {\n if (!CARGO_CONFIG_FILE.test(entry.name) || !PNPM_CARGO_START.test(source)) {\n return [];\n }\n if (Str.isNonEmpty(Str.trim(Str.replaceAll(PNPM_CARGO_BLOCK, \"\")(source)))) {\n return [];\n }\n return [pnpmCargoConfig(entry)];\n};\n\nconst cargoOutsidePnpm = problemAtStart(\n CARGO_RULE,\n `pnpm does not manage these crates. Set \\`cargo: { enabled: true }\\` in ${WORKSPACE_FILE} so pnpm install fetches the crates and the Rust toolchain.`,\n);\n\nconst setupProblem =\n ({ file }: Listed, source: string, advice: (command: string) => string) =>\n (found: RegExpMatchArray): Problem => ({\n file,\n ...positionOf(source)(found.index ?? WHOLE_MATCH),\n rule: SETUP_RULE,\n message: advice(Str.trim(found[WHOLE_MATCH])),\n });\n\nconst removeSetup = (command: string): string =>\n `pnpm install already installs the toolchain in rust-toolchain.toml and vendors the crates in Cargo.lock. Remove \\`${command}\\`.`;\n\nconst buildInstead = (command: string): string =>\n `\\`${command}\\` fetches crates that pnpm does not vendor. Add the tool as a dependency of a Cargo workspace that pnpm vendors, and build its binary there with \\`cargo build -p <crate> --bin <name>\\`.`;\n\nconst setupPatternsFor = (entry: Listed): readonly RegExp[] => {\n if (isToolVersions(entry)) {\n return [...SETUP_PATTERNS, ...TOOL_PATTERNS];\n }\n return SETUP_PATTERNS;\n};\n\nconst matchesOf =\n (source: string) =>\n (patterns: readonly RegExp[]): readonly RegExpMatchArray[] =>\n pipe(\n patterns,\n Arr.flatMap((pattern) => Arr.fromIterable(Str.matchAll(pattern)(source))),\n );\n\nconst setupProblems = (entry: Listed, source: string): readonly Problem[] => {\n const found = matchesOf(source);\n const installs = pipe(\n found(INSTALL_PATTERNS),\n Arr.map(setupProblem(entry, source, buildInstead)),\n );\n return pipe(\n found(setupPatternsFor(entry)),\n Arr.map(setupProblem(entry, source, removeSetup)),\n Arr.appendAll(installs),\n Arr.appendAll(generatedCargoConfig(entry, source)),\n );\n};\n\nconst matches =\n (pattern: RegExp) =>\n ({ name }: Listed): boolean =>\n pattern.test(name);\n\nconst isCargoManifest = matches(CARGO_MANIFEST_FILE);\nconst isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);\nconst isPnpmOutput = matches(PNPM_OUTPUT);\n\nconst directoryOf = (name: string): string =>\n pipe(Str.split(name, SEPARATOR), Arr.dropRight(LAST_SEGMENT), Arr.join(SEPARATOR));\n\nconst ancestorsOf = (directory: string): readonly string[] => {\n const parts = Str.split(directory, SEPARATOR);\n return pipe(\n Arr.makeBy(parts.length, (depth) => Arr.join(Arr.take(parts, depth), SEPARATOR)),\n Arr.filter((ancestor) => ancestor !== directory),\n );\n};\n\nconst readsCargoLock =\n (manifests: readonly string[], workspaces: readonly string[]) =>\n ({ name }: Listed): boolean => {\n const directory = directoryOf(name);\n const insideWorkspace = pipe(\n ancestorsOf(directory),\n Arr.some((ancestor) => Arr.contains(workspaces, ancestor)),\n );\n return (\n Arr.contains(manifests, directory) &&\n (Arr.contains(workspaces, directory) || !insideWorkspace)\n );\n };\n\nconst isWorkspaceManifest = (source: Option.Option<string>): boolean =>\n Option.exists(source, (text) => CARGO_WORKSPACE.test(text));\n\nconst directoriesOf = (entries: readonly Listed[]): readonly string[] =>\n pipe(\n entries,\n Arr.map(({ name }) => directoryOf(name)),\n );\n\nconst cargoWorkspaces = Effect.fn(\"cargoWorkspaces\")(function* cargoWorkspaces(\n manifests: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n const roots = yield* pipe(\n manifests,\n Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))),\n );\n return directoriesOf(roots);\n});\n\nconst pnpmDirectoryOf = ({ name }: Listed): string =>\n pipe(\n name,\n Str.indexOf(PNPM_DIRECTORY),\n Option.getOrElse(() => START),\n (end) => Str.slice(START, end)(name),\n );\n\nconst pnpmOutputs = (present: readonly Listed[]): readonly Problem[] =>\n pipe(\n present,\n Arr.filter(isPnpmOutput),\n Arr.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)),\n Arr.map(pnpmOutput),\n );\n\nconst byDepth: Order.Order<Listed> = Order.mapInput(\n Order.Number,\n ({ name }: Listed) => Str.split(name, \"/\").length,\n);\n\nconst cargoProblems = (\n present: readonly Listed[],\n enabled: boolean,\n): Effect.Effect<readonly Problem[], never, RepositoryFiles> => {\n if (!enabled) {\n return Effect.succeed(\n pipe(\n present,\n Arr.filter(isCargoManifest),\n Arr.match({\n onEmpty: (): readonly Problem[] => [],\n onNonEmpty: (manifests) => [cargoOutsidePnpm(Arr.min(manifests, byDepth))],\n }),\n ),\n );\n }\n return Effect.gen(function* enabledCargoProblems() {\n const manifests = pipe(present, Arr.filter(isCargoManifest));\n const workspaces = yield* cargoWorkspaces(manifests);\n const reads = readsCargoLock(directoriesOf(manifests), workspaces);\n const setup = yield* scanText(pipe(present, Arr.filter(isScannedText)), setupProblems);\n return [\n ...pipe(\n present,\n Arr.filter((entry) => CARGO_LOCK_FILE.test(entry.name) && !reads(entry)),\n Arr.map(nestedCargoLock),\n ),\n ...pipe(present, Arr.filter(isLegacyCargoConfig), Arr.map(legacyCargoConfig)),\n ...pnpmOutputs(present),\n ...setup,\n ];\n });\n};\n\nconst unneededIn = Effect.fn(\"unneededIn\")(function* unneededIn(root: string, enabled: boolean) {\n const listed = yield* listedFiles(root);\n const present = yield* presentFiles(listed);\n const lockfiles = pipe(present, Arr.filter(unneededLockfile(present)), Arr.map(foreignLockfile));\n if (!pipe(present, Arr.some(isCargoManifest))) {\n return lockfiles;\n }\n const cargo = yield* cargoProblems(present, enabled);\n return [...lockfiles, ...cargo];\n});\n\n/** @internal */\nexport const checkUnneededFiles = Effect.fn(\"checkUnneededFiles\")(function* checkUnneededFiles(\n root: string,\n) {\n const workspace = yield* workspaceManifest(root);\n if (Option.isNone(workspace)) {\n return [];\n }\n return yield* unneededIn(root, cargoEnabled(workspace.value));\n});\n","import { Array as Arr, Effect, Match, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf, problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"markdown-directive\";\nconst START = 0;\nconst SECOND = 1;\nconst ODD = 1;\nconst PAIR = 2;\nconst MARKDOWN = \".md\";\nconst SKIPPED_DIRECTORIES = [\".agents/skills/\", \"/fixtures/\", \"/upstream/\"];\nconst SKIPPED_FILES = [\"CHANGELOG.md\", \"CLAUDE.md\"];\n\nconst DISABLE =\n /<!--\\s*(?:y8|markdownlint|textlint)-disable(?:-next-line|-line|-file)?(?<rest>(?:\\s[\\s\\S]*?)?)-->/giu;\nconst FENCE = /^\\s{0,3}(?:`{3,}|~{3,})/u;\nconst BACKTICK = /`/gu;\nconst DESCRIPTION = / -- .*/u;\nconst SEPARATORS = /[\\s,]+/u;\n\nconst MESSAGE =\n \"Name the rules this comment disables, as in `<!-- y8-disable MD033 -->`. A comment with no rule name stops every rule, so it also hides violations that are added later.\";\n\nconst fenceStep = (inside: boolean, line: string): readonly [boolean, boolean] =>\n Match.value(FENCE.test(line)).pipe(\n Match.when(true, (): readonly [boolean, boolean] => [!inside, true]),\n Match.orElse((): readonly [boolean, boolean] => [inside, inside]),\n );\n\nconst insideCodeSpan = (before: string): boolean =>\n Arr.fromIterable(Str.matchAll(BACKTICK)(before)).length % PAIR === ODD;\n\nconst namedRules = (rest: string): readonly string[] =>\n pipe(rest, Str.replace(DESCRIPTION, \"\"), Str.split(SEPARATORS), Arr.filter(Str.isNonEmpty));\n\nconst restOf = (found: RegExpMatchArray): string =>\n pipe(\n Option.fromNullishOr(found.groups),\n Option.flatMap(Rec.get(\"rest\")),\n Option.getOrElse(() => \"\"),\n );\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n const lines = Str.split(\"\\n\")(source);\n const fenced = Arr.mapAccum(lines, false, fenceStep)[SECOND];\n const isCode = (index: number): boolean => {\n const { line, column } = positionOf(source)(index);\n return (\n pipe(\n Arr.get(fenced, line - SECOND),\n Option.getOrElse(() => false),\n ) ||\n pipe(\n Arr.get(lines, line - SECOND),\n Option.map(Str.slice(START, column - SECOND)),\n Option.exists(insideCodeSpan),\n )\n );\n };\n return pipe(\n Arr.fromIterable(Str.matchAll(DISABLE)(source)),\n Arr.filter((match) => Arr.isReadonlyArrayEmpty(namedRules(restOf(match)))),\n Arr.filter((match) => !isCode(match.index ?? START)),\n Arr.map((match) => problemAtIndex(RULE)(file, source)(match.index ?? START, MESSAGE)),\n );\n};\n\nconst isChecked = (name: string): boolean =>\n Str.endsWith(MARKDOWN)(name) &&\n !pipe(\n SKIPPED_DIRECTORIES,\n Arr.some((directory) => Str.includes(directory)(`/${name}`)),\n ) &&\n !pipe(\n SKIPPED_FILES,\n Arr.some((skipped) => name === skipped || Str.endsWith(`/${skipped}`)(name)),\n );\n\n/** @internal */\nexport const checkMarkdownDirectives = Effect.fn(\"checkMarkdownDirectives\")(\n function* checkMarkdownDirectives(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return yield* scanText(\n pipe(\n names,\n Arr.filter((name) => isChecked(name)),\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n ({ file }, source) => problemsIn(file, source),\n );\n },\n);\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst HIDDEN =\n /[\\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;\n\nconst NUL = \"\\0\";\nconst START = 0;\nconst HEX = 16;\nconst CODE_POINT_WIDTH = 4;\nconst READ_CONCURRENCY = 64;\nconst RULE: RuleName = \"hidden-unicode\";\n\nconst hexOf = (character: string): string =>\n pipe(\n Str.codePointAt(START)(character),\n Option.getOrElse(() => START),\n (code) => code.toString(HEX),\n Str.toUpperCase,\n Str.padStart(CODE_POINT_WIDTH, \"0\"),\n );\n\nconst problemOf =\n (file: string, source: string) =>\n (found: RegExpMatchArray): Problem => {\n const hex = hexOf(found[START]);\n return {\n file,\n ...positionOf(source)(found.index ?? START),\n rule: RULE,\n message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\\\u${hex}.`,\n };\n };\n\nconst problemsIn = (file: string, source: string): readonly Problem[] => {\n if (Str.includes(NUL)(source)) {\n return [];\n }\n return pipe(Arr.fromIterable(Str.matchAll(HIDDEN)(source)), Arr.map(problemOf(file, source)));\n};\n\n/** @internal */\nexport const checkHiddenUnicode = Effect.fn(\"checkHiddenUnicode\")(function* checkHiddenUnicode(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const found = yield* Effect.forEach(\n names,\n (name) => {\n const file = files.join(root, name);\n return files.readFile(file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(file, source),\n }),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkMarkdownDirectives } from \"#/features/check-markdown-directives/index.ts\";\nimport { checkHiddenUnicode } from \"#/features/find-invisible-characters/index.ts\";\n\n/** @internal */\nexport const checkDocuments = Effect.fn(\"checkDocuments\")(function* checkDocuments(root: string) {\n const found = yield* Effect.all([checkHiddenUnicode(root), checkMarkdownDirectives(root)], {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"effect-diagnostics-once\";\nconst PLUGIN = \"@effect/language-service\";\nconst CONFIG_PATHSPEC = \":(glob)**/tsconfig*.json\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst START = 0;\n\nconst Plugin = Schema.Struct({\n name: Schema.optional(Schema.String),\n diagnostics: Schema.optional(Schema.Unknown),\n});\nconst Plugins = Schema.Array(Plugin);\nconst CompilerOptions = Schema.Struct({ plugins: Schema.optional(Plugins) });\nconst Config = Schema.Struct({ compilerOptions: Schema.optional(CompilerOptions) });\nconst decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config));\n\nconst MESSAGE = `The \\`${PLUGIN}\\` plugin reports the Effect diagnostics during the type check, and the \\`effecttsgo\\` lint rules that msch enables report the same ones again. Set \\`\"diagnostics\": false\\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;\n\nconst reportsDiagnostics = (plugin: typeof Plugin.Type): boolean =>\n plugin.name === PLUGIN && plugin.diagnostics !== false;\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n decodeConfig(source),\n Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)),\n Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)),\n Option.filter(Arr.some(reportsDiagnostics)),\n Option.map((): Problem => ({\n file: entry.file,\n ...positionOf(source)(\n pipe(\n Str.indexOf(`\"${PLUGIN}\"`)(source),\n Option.getOrElse(() => START),\n ),\n ),\n rule: RULE,\n message: MESSAGE,\n })),\n Option.toArray,\n );\n\n/** @internal */\nexport const checkEffectDiagnostics = Effect.fn(\"checkEffectDiagnostics\")(\n function* checkEffectDiagnostics(root: string) {\n const files = yield* RepositoryFiles;\n const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED]);\n return yield* scanText(\n pipe(\n configs,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n problemsIn,\n );\n },\n);\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport {\n MANIFEST_FILE,\n manifestSpecifiers,\n fieldsOf,\n manifestPattern,\n offsetIn,\n quoted,\n specifiedIn,\n} from \"#/entities/package/index.ts\";\nimport type { Fields, Specified } from \"#/entities/package/index.ts\";\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"version-range\";\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst ALIAS = /^npm:(?:@[^/@]+\\/)?[^@]+@(?<version>.+)$/u;\nconst PROTOCOL = /^[a-z+]+:/u;\nconst PATH_LIKE = \"/\";\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\nconst MESSAGE =\n \"is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.\";\n\nconst versionOf = (specifier: string): string =>\n Option.getOrElse(groupOf(\"version\")(ALIAS.exec(specifier)), () => specifier);\n\n/** @internal */\nexport const isRange = (specifier: string): boolean => {\n const version = versionOf(specifier);\n return (\n !PROTOCOL.test(version) && !Str.includes(PATH_LIKE)(version) && semver.valid(version) === null\n );\n};\n\nconst problemsFor =\n (file: string, source: string, pattern: (found: Specified) => RegExp) =>\n (found: readonly Specified[]): readonly Problem[] =>\n pipe(\n found,\n Arr.filter(({ specifier }) => isRange(specifier)),\n Arr.map((range): Problem => ({\n file,\n ...positionOf(source)(offsetIn(source)(pattern(range))),\n rule: RULE,\n message: `\\`${range.name}\\` \\`${range.specifier}\\` ${MESSAGE}`,\n })),\n );\n\nconst catalogPattern = ({ name }: Specified): RegExp =>\n new RegExp(`^\\\\s+[\"']?${quoted(name)}[\"']?:`, \"mu\");\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] =>\n problemsFor(entry.file, source, manifestPattern)(manifestSpecifiers(source));\n\nconst catalogSpecifiers = (settings: Fields): readonly Specified[] => [\n ...specifiedIn(settings[\"catalog\"]),\n ...pipe(fieldsOf(settings[\"catalogs\"]), Rec.values, Arr.flatMap(specifiedIn)),\n];\n\nconst catalogProblems = Effect.fn(\"catalogProblems\")(function* catalogProblems(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, WORKSPACE_FILE);\n const settings = yield* workspaceManifest(root);\n const source = yield* files.readFile(file);\n return pipe(\n Option.all({ settings, source }),\n Option.map(({ settings: held, source: text }) =>\n problemsFor(file, text, catalogPattern)(catalogSpecifiers(fieldsOf(held))),\n ),\n Option.getOrElse((): readonly Problem[] => []),\n );\n});\n\n/** @internal */\nexport const checkExactVersions = Effect.fn(\"checkExactVersions\")(function* checkExactVersions(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n const listed = pipe(\n manifests,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n const fromManifests = yield* scanText(listed, manifestProblems);\n const fromCatalogs = yield* catalogProblems(root);\n return [...fromManifests, ...fromCatalogs];\n});\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { MANIFEST_FILE, publishedManifestOf } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"pack-publint\";\nconst CONFIG_FILE = \"vite.config.ts\";\nconst PACK_KEY = \"pack:\";\nconst START = 0;\nconst READ_CONCURRENCY = 16;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });\nconst isStrict = Schema.is(StrictPack);\nconst PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });\nconst decodePackConfig = Schema.decodeUnknownOption(PackConfig);\n\nconst taggedError = Schema.TaggedError;\n\nclass PackConfigUnreadable extends taggedError<\n PackConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"PackConfigUnreadable\", { file: Schema.String }) {}\n\nconst runsStrictPublint = (config: unknown): boolean =>\n pipe(\n decodePackConfig(config),\n Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)),\n Option.map((pack): readonly unknown[] => Arr.ensure(pack)),\n Option.exists(Arr.some(isStrict)),\n );\n\nconst problemFor = (file: string, source: string): Problem => ({\n file,\n ...positionOf(source)(Option.getOrElse(Str.indexOf(PACK_KEY)(source), () => START)),\n rule: RULE,\n message:\n \"This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import.\",\n});\n\nconst strictPublintIn = Effect.fn(\"strictPublintIn\")(function* strictPublintIn(configFile: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(configFile),\n catch: () => PackConfigUnreadable.make({ file: configFile }),\n }).pipe(Effect.option);\n return Option.exists(config, runsStrictPublint);\n});\n\nconst configProblems = Effect.fn(\"configProblems\")(function* configProblems(configFile: string) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(configFile);\n if (Option.isNone(source)) {\n return [];\n }\n const strict = yield* strictPublintIn(configFile);\n if (strict) {\n return [];\n }\n return [problemFor(configFile, source.value)];\n});\n\nconst problemsIn = Effect.fn(\"problemsIn\")(function* problemsIn(\n root: string,\n manifestName: string,\n) {\n const files = yield* RepositoryFiles;\n const source = yield* files.readFile(files.join(root, manifestName));\n const manifest = publishedManifestOf(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));\n});\n\n/** @internal */\nexport const checkPackSettings = Effect.fn(\"checkPackSettings\")(function* checkPackSettings(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n const found = yield* Effect.forEach(manifests, (name) => problemsIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { workspaceProjects } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceProject } from \"#/entities/workspace/index.ts\";\nimport { problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"plugin-marketplace\";\nconst PLUGIN_DIRECTORY = \".claude-plugin\";\nconst PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;\nconst MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;\nconst INDENT = 2;\n\nconst OwnerSchema = Schema.Struct({ name: Schema.String, url: Schema.optionalKey(Schema.String) });\nconst Person = Schema.Union([Schema.String, OwnerSchema]);\nconst RootManifest = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n description: Schema.optionalKey(Schema.String),\n author: Schema.optionalKey(Person),\n }),\n);\nconst PluginManifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));\nconst NpmSource = Schema.Struct({ source: Schema.Literal(\"npm\"), package: Schema.String });\nconst PluginSchema = Schema.Struct({\n name: Schema.String,\n source: Schema.Union([Schema.String, NpmSource]),\n description: Schema.String,\n});\nconst MetadataSchema = Schema.Struct({ description: Schema.String });\nconst Marketplace = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n owner: OwnerSchema,\n metadata: Schema.optionalKey(MetadataSchema),\n plugins: Schema.Array(PluginSchema),\n }),\n { space: INDENT },\n);\n\nconst decodeRoot = Schema.decodeUnknownOption(RootManifest);\nconst decodePlugin = Schema.decodeUnknownOption(PluginManifest);\nconst encodeMarketplace = Schema.encodeEffect(Marketplace);\n\ntype Plugin = typeof PluginSchema.Type;\ntype Owner = typeof OwnerSchema.Type;\n\nconst marketplaceName = (packageName: string): string =>\n pipe(\n Str.toLowerCase(packageName),\n Str.replace(/^@/u, \"\"),\n Str.replaceAll(/[^a-z0-9]+/gu, \"-\"),\n Str.replaceAll(/^-+|-+$/gu, \"\"),\n );\n\nconst ownerOf = (author: typeof Person.Type): Owner => {\n if (Predicate.isString(author)) {\n return { name: author };\n }\n return author;\n};\n\nconst sourceOf = (project: WorkspaceProject): Plugin[\"source\"] =>\n pipe(\n project.packageName,\n Option.filter(() => project.published),\n Option.match({\n onNone: (): Plugin[\"source\"] => `./${project.directory}`,\n onSome: (name): Plugin[\"source\"] => ({ source: \"npm\", package: name }),\n }),\n );\n\nconst pluginIn = Effect.fn(\"pluginIn\")(function* pluginIn(root: string, project: WorkspaceProject) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, project.directory, PLUGIN_FILE));\n return pipe(\n text,\n Option.flatMap(decodePlugin),\n Option.map(({ name }): Plugin => ({\n name,\n source: sourceOf(project),\n description: Option.getOrElse(project.description, () => \"\"),\n })),\n );\n});\n\nconst problem = problemInFile(RULE);\n\nconst pluginsIn = Effect.fn(\"pluginsIn\")(function* pluginsIn(root: string) {\n const projects = yield* workspaceProjects(root);\n const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), {\n concurrency: \"unbounded\",\n });\n return Arr.getSomes(found);\n});\n\nconst described = (\n description: string | undefined,\n): { readonly metadata?: { readonly description: string } } =>\n pipe(\n Option.fromUndefinedOr(description),\n Option.match({\n onNone: () => ({}),\n onSome: (text) => ({ metadata: { description: text } }),\n }),\n );\n\nconst ownerIn = Effect.fn(\"ownerIn\")(function* ownerIn(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeRoot),\n Option.flatMap(({ name, description, author }) =>\n pipe(\n Option.fromUndefinedOr(author),\n Option.map((found) => ({\n name: marketplaceName(name),\n owner: ownerOf(found),\n ...described(description),\n })),\n ),\n ),\n );\n});\n\nconst rewrite = Effect.fn(\"rewrite\")(function* rewrite(file: string, expected: string) {\n const files = yield* RepositoryFiles;\n const written = yield* files.readFile(file);\n if (Option.exists(written, (text) => text === expected)) {\n return [];\n }\n yield* files.writeFile(file, expected);\n return [\n problem(\n file,\n `${MARKETPLACE_FILE} is generated from the workspaces that have ${PLUGIN_FILE}. msch rewrote it; commit the result.`,\n ),\n ];\n});\n\nconst withoutPlugins = Effect.fn(\"withoutPlugins\")(function* withoutPlugins(file: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.exists(file);\n if (!present) {\n return [];\n }\n return [problem(file, `No workspace has ${PLUGIN_FILE}. Delete ${MARKETPLACE_FILE}.`)];\n});\n\n/** @internal */\nexport const checkPluginMarketplace = Effect.fn(\"checkPluginMarketplace\")(\n function* checkPluginMarketplace(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, MARKETPLACE_FILE);\n const plugins = yield* pluginsIn(root);\n if (!Arr.isReadonlyArrayNonEmpty(plugins)) {\n return yield* withoutPlugins(file);\n }\n const header = yield* ownerIn(root);\n if (Option.isNone(header)) {\n return [\n problem(\n files.join(root, MANIFEST_FILE),\n `Workspaces ship Claude Code plugins, so ${MARKETPLACE_FILE} lists them. Add \"author\" to the root ${MANIFEST_FILE}; it becomes the marketplace owner.`,\n ),\n ];\n }\n const text = yield* encodeMarketplace({ ...header.value, plugins });\n return yield* rewrite(file, `${text}\\n`);\n },\n);\n","import { Array as Arr, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport type { PublishedFile, PublishedManifest } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"package-homepage\";\nconst BRANCH = \"main\";\nconst ROOT_DIRECTORY = \".\";\nconst START = 0;\nconst KEYS = ['\"homepage\"', '\"repository\"', '\"name\"'] as const;\n\nconst RepositoryObject = Schema.Struct({\n url: Schema.String,\n directory: Schema.optional(Schema.String),\n});\nconst decodeRepository = Schema.decodeUnknownOption(RepositoryObject);\n\nconst repositoryMissing = (directory: string): string =>\n `Published packages declare \\`repository\\` as \\`{ \"type\": \"git\", \"url\": \"git+https://github.com/<owner>/<repository>.git\", \"directory\": \"${directory}\" }\\` so that npm and \\`npm repo\\` link to the source.`;\n\nconst directoryWrong = (directory: string): string =>\n `In a monorepo \\`repository.directory\\` names the package directory, so npm links to the package and not to the repository root. Set it to \"${directory}\".`;\n\nconst homepageWrong = (homepage: string): string =>\n `\\`homepage\\` is the link npm shows as the package's home, and the repository root is not the package. Set it to \"${homepage}\".`;\n\nconst repositoryUrlOf = (url: string): string =>\n pipe(url, Str.replace(/^git\\+/u, \"\"), Str.replace(/\\.git$/u, \"\"));\n\nconst homepageOf = (url: string, directory: string): string =>\n `${repositoryUrlOf(url)}/tree/${BRANCH}/${directory}#readme`;\n\nconst repositoryMessages =\n (manifest: PublishedManifest, directory: string) =>\n (repository: typeof RepositoryObject.Type): readonly string[] => {\n const expected = homepageOf(repository.url, directory);\n const wrongDirectory = directoryWrong(directory);\n const wrongHomepage = homepageWrong(expected);\n return Arr.getSomes([\n Option.liftPredicate(wrongDirectory, () => repository.directory !== directory),\n Option.liftPredicate(wrongHomepage, () => manifest.homepage !== expected),\n ]);\n };\n\nconst messagesOf = (manifest: PublishedManifest, directory: string): readonly string[] =>\n pipe(\n decodeRepository(manifest.repository),\n Option.match({\n onNone: () => [repositoryMissing(directory)],\n onSome: repositoryMessages(manifest, directory),\n }),\n );\n\nconst firstKeyIndex = (source: string): number =>\n pipe(\n KEYS,\n Arr.findFirst((key) => Str.includes(key)(source)),\n Option.flatMap((key) => Str.indexOf(key)(source)),\n Option.getOrElse(() => START),\n );\n\n/** @internal */\nexport const homepageProblems =\n (dirname: (name: string) => string) =>\n ({ entry, source, manifest }: PublishedFile): readonly Problem[] =>\n pipe(\n Option.some(dirname(entry.name)),\n Option.filter((directory) => directory !== ROOT_DIRECTORY),\n Option.map((directory) => messagesOf(manifest, directory)),\n Option.getOrElse((): readonly string[] => []),\n Arr.map((message) =>\n problemAtIndex(RULE)(entry.file, source)(firstKeyIndex(source), message),\n ),\n );\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport type { PublishedFile } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"package-scope\";\nconst SCOPE = \"@r_masseater/\";\nconst NAME_KEY = '\"name\"';\nconst START = 0;\n\nconst unscopedName = ({ manifest }: PublishedFile): Option.Option<string> =>\n pipe(\n Option.fromUndefinedOr(manifest.name),\n Option.filter((name) => !Str.startsWith(SCOPE)(name)),\n );\n\nconst nameIndex = (source: string): number =>\n pipe(\n Str.indexOf(NAME_KEY)(source),\n Option.getOrElse(() => START),\n );\n\nconst messageFor = (name: string): string =>\n `Packages are published only under the ${SCOPE} scope. Rename \"${name}\" to \"${SCOPE}${Str.replace(/^@[^/]+\\//u, \"\")(name)}\".`;\n\n/** @internal */\nexport const scopeProblems = (found: PublishedFile): readonly Problem[] =>\n pipe(\n unscopedName(found),\n Option.map((name) =>\n problemAtIndex(RULE)(found.entry.file, found.source)(\n nameIndex(found.source),\n messageFor(name),\n ),\n ),\n Option.toArray,\n );\n","import { Effect } from \"effect\";\n\nimport { scanPublishedManifests } from \"#/entities/package/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { homepageProblems } from \"./package-homepage.ts\";\nimport { scopeProblems } from \"./package-scope.ts\";\n\n/** @internal */\nexport const checkPublishedManifests = Effect.fn(\"checkPublishedManifests\")(\n function* checkPublishedManifests(root: string) {\n const files = yield* RepositoryFiles;\n const homepage = homepageProblems(files.dirname);\n return yield* scanPublishedManifests(root, (found) => [\n ...scopeProblems(found),\n ...homepage(found),\n ]);\n },\n);\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { isToolVersions, listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nconst RULE: RuleName = \"node-version\";\nconst MINIMUM = 26;\nconst SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;\nconst MANIFEST = /(?:^|\\/)package\\.json$/u;\nconst VERSION_FILE = /(?:^|\\/)(?:\\.node-version|\\.nvmrc)$/u;\nconst DOCKERFILE = /(?:^|\\/)(?:Dockerfile|Containerfile)[^/]*$/u;\nconst STEP_FILE = /^\\.github\\/.*\\.ya?ml$|(?:^|\\/)action\\.ya?ml$/u;\nconst PINNED_VERSION = /^\\s*v?(?<major>\\d+)/u;\nconst BASE_IMAGE = /^FROM[ \\t]+(?:--\\S+[ \\t]+)*(?:[\\w.-]+(?::\\d+)?\\/)*node:(?<major>\\d+)/gimu;\nconst SETUP_INPUT = /\\bnode-version:[ \\t]*[\"']?v?(?<major>\\d+)/gu;\nconst TOOL_VERSION =\n /^[ \\t]*[\"']?(?:node|nodejs)[\"']?[ \\t]*(?:=[ \\t]*[\"']?|[ \\t]+)v?(?<major>\\d+)/gmu;\nconst RANGE_FLOOR = /^(?:>=|\\^|~|=)?[ \\t]*v?(?<major>\\d+)/u;\nconst ALTERNATIVE = \"||\";\nconst ENGINES_KEY = '\"engines\"';\nconst START = 0;\nconst EXCLUDED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n];\n\nconst Engines = Schema.Struct({ node: Schema.optional(Schema.String) });\nconst Manifest = Schema.Struct({\n private: Schema.optional(Schema.Boolean),\n publishConfig: Schema.optional(Schema.Unknown),\n engines: Schema.optional(Engines),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\nconst majorOf = (found: RegExpMatchArray | null): Option.Option<number> =>\n pipe(groupOf(\"major\")(found), Option.map(Number));\n\nconst isOld = (major: number): boolean => major < MINIMUM;\n\nconst floorOf = (alternative: string): Option.Option<number> =>\n majorOf(RANGE_FLOOR.exec(Str.trim(alternative)));\n\nconst floorIsOld = (alternative: string): boolean =>\n pipe(floorOf(alternative), Option.match({ onNone: () => true, onSome: isOld }));\n\nconst admitsOld = (range: string): boolean =>\n pipe(Str.split(range, ALTERNATIVE), Arr.some(floorIsOld));\n\ninterface Found {\n readonly entry: Listed;\n readonly source: string;\n readonly index: number;\n}\n\nconst problemAt = ({ entry, source, index }: Found, message: string): Problem =>\n problemAtIndex(RULE)(entry.file, source)(index, message);\n\nconst offsetOf = (source: string, text: string): number =>\n pipe(\n Str.indexOf(text)(source),\n Option.getOrElse(() => START),\n );\n\nconst unstatedProblem = (entry: Listed, source: string): Problem =>\n problemAt(\n { entry, source, index: START },\n `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to \">=${String(MINIMUM)}\".`,\n );\n\nconst rangeProblem =\n (entry: Listed, source: string) =>\n (range: string): Problem =>\n problemAt(\n { entry, source, index: offsetOf(source, ENGINES_KEY) },\n `${SUPPORTED} engines.node is \"${range}\", which admits an older one. Set it to \">=${String(MINIMUM)}\".`,\n );\n\nconst isPublished = (manifest: typeof Manifest.Type): boolean =>\n manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);\n\nconst rangeOf = (manifest: typeof Manifest.Type): Option.Option<string> =>\n pipe(\n Option.fromUndefinedOr(manifest.engines),\n Option.flatMap(({ node }) => Option.fromUndefinedOr(node)),\n );\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] => {\n const manifest = decodeManifest(source);\n if (Option.isNone(manifest)) {\n return [];\n }\n const range = rangeOf(manifest.value);\n if (Option.isNone(range) && isPublished(manifest.value)) {\n return [unstatedProblem(entry, source)];\n }\n return pipe(\n range,\n Option.filter(admitsOld),\n Option.map(rangeProblem(entry, source)),\n Option.toArray,\n );\n};\n\nconst pinnedProblems =\n (pattern: RegExp) =>\n (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(source)),\n Arr.filter((found) => Option.exists(majorOf(found), isOld)),\n Arr.map((found) =>\n problemAt(\n { entry, source, index: found.index ?? START },\n `${SUPPORTED} \\`${Str.trim(found[START])}\\` pins an older one. Raise it to ${String(MINIMUM)} or later.`,\n ),\n ),\n );\n\nconst versionFileProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n majorOf(PINNED_VERSION.exec(source)),\n Option.filter(isOld),\n Option.map((major) =>\n problemAt(\n { entry, source, index: START },\n `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`,\n ),\n ),\n Option.toArray,\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] => {\n if (MANIFEST.test(entry.name)) {\n return manifestProblems(entry, source);\n }\n if (VERSION_FILE.test(entry.name)) {\n return versionFileProblems(entry, source);\n }\n if (DOCKERFILE.test(entry.name)) {\n return pinnedProblems(BASE_IMAGE)(entry, source);\n }\n if (isToolVersions(entry)) {\n return pinnedProblems(TOOL_VERSION)(entry, source);\n }\n return pinnedProblems(SETUP_INPUT)(entry, source);\n};\n\nconst isVersionSource = (entry: Listed): boolean =>\n VERSION_FILE.test(entry.name) ||\n DOCKERFILE.test(entry.name) ||\n STEP_FILE.test(entry.name) ||\n isToolVersions(entry);\n\n/** @internal */\nexport const checkNodeVersion = Effect.fn(\"checkNodeVersion\")(function* checkNodeVersion(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* listedFiles(root);\n const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);\n const sources = [\n ...pipe(listed, Arr.filter(isVersionSource)),\n ...pipe(\n manifests,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n ),\n ];\n return yield* scanText(sources, problemsIn);\n});\n","import { isInside } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport {\n cratesIn,\n deployEntries,\n nestedValues,\n owningWorkspace,\n RUN_TASKS,\n stringsIn,\n workspaceConfigOf,\n workspaceDirectories,\n workspaceLinks,\n} from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceLink } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unused-workspace\";\nconst CARGO_FILE = \"Cargo.toml\";\nconst ROOT_DIRECTORY = \"\";\nconst TASK_SEPARATOR = \"#\";\nconst START = 0;\nconst FIRST = 1;\nconst READ_CONCURRENCY = 8;\nconst LIBRARY_KINDS: readonly string[] = [\"lib\", \"rlib\", \"proc-macro\"];\nconst PROGRAM_KINDS: readonly string[] = [\"bin\", \"cdylib\", \"staticlib\", \"dylib\"];\n\nconst Manifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n private: Schema.optional(Schema.Boolean),\n exports: Schema.optional(Schema.Unknown),\n main: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\nconst decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));\n\ninterface Member {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly library: boolean;\n readonly entry: boolean;\n}\n\nconst isDependedOn =\n (links: readonly WorkspaceLink[]) =>\n ({ directory }: Member): boolean =>\n pipe(\n links,\n Arr.some(({ from, to }) => to === directory && from !== directory),\n );\n\nconst isKind =\n (kinds: readonly string[]) =>\n (kind: string): boolean =>\n Arr.contains(kinds, kind);\n\nconst isLibraryCrate = ({ kinds }: { readonly kinds: readonly string[] }): boolean =>\n pipe(kinds, Arr.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Arr.some(isKind(PROGRAM_KINDS)));\n\ninterface CargoFacts {\n readonly libraries: readonly string[];\n readonly links: readonly WorkspaceLink[];\n}\n\nconst NO_CARGO: CargoFacts = { libraries: [], links: [] };\n\nconst cargoFacts = Effect.fn(\"cargoFacts\")(function* cargoFacts(\n root: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const cargo = yield* files.exists(files.join(root, CARGO_FILE));\n if (!cargo) {\n return NO_CARGO;\n }\n const crates = yield* cratesIn(root);\n const ownerOf = (path: string): Option.Option<string> =>\n owningWorkspace(directories)(files.relative(root, path));\n const linksOf = (manifest: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const owner = ownerOf(files.dirname(manifest));\n const linkTo = (path: string): Option.Option<WorkspaceLink> =>\n Option.zipWith(owner, ownerOf(path), (from, to) => ({ from, to }));\n return pipe(\n paths,\n Arr.flatMap((path) => Option.toArray(linkTo(path))),\n );\n };\n return {\n libraries: pipe(\n crates,\n Arr.filter(isLibraryCrate),\n Arr.flatMap(({ manifest }) => Option.toArray(ownerOf(files.dirname(manifest)))),\n ),\n links: pipe(\n crates,\n Arr.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)),\n ),\n };\n});\n\nconst workspaceOfTask = (text: string): Option.Option<string> =>\n pipe(\n Str.indexOf(TASK_SEPARATOR)(text),\n Option.map((at) => Str.slice(START, at)(text)),\n Option.filter(Str.isNonEmpty),\n );\n\nconst taskTargets = Effect.fn(\"taskTargets\")(function* taskTargets(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n return pipe(\n config,\n Option.map(({ program }) =>\n pipe(\n nestedValues(RUN_TASKS)(program),\n Arr.flatMap(stringsIn),\n Arr.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\ninterface MemberRequest {\n readonly root: string;\n readonly directory: string;\n readonly crateLibraries: readonly string[];\n readonly deployed: readonly string[];\n}\n\nconst memberOf = Effect.fn(\"memberOf\")(function* memberOf(request: MemberRequest) {\n const { root, directory, crateLibraries, deployed } = request;\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(decodeManifest),\n Option.map((manifest): Member => ({\n directory,\n name: Option.fromUndefinedOr(manifest.name),\n library:\n Predicate.isNotUndefined(manifest.exports) ||\n Predicate.isNotUndefined(manifest.main) ||\n Arr.contains(crateLibraries, directory),\n entry:\n manifest.private !== true ||\n Predicate.isNotUndefined(manifest.bin) ||\n pipe(deployed, Arr.some(isInside(directory))),\n })),\n );\n});\n\nconst linksTo =\n (members: readonly Member[], from: string) =>\n (name: string): readonly WorkspaceLink[] =>\n pipe(\n members,\n Arr.filter((member) => Option.contains(member.name, name)),\n Arr.map(({ directory }): WorkspaceLink => ({ from, to: directory })),\n );\n\nconst taskLinks = Effect.fn(\"taskLinks\")(function* taskLinks(\n root: string,\n members: readonly Member[],\n) {\n const sources = [\n ROOT_DIRECTORY,\n ...pipe(\n members,\n Arr.map(({ directory }) => directory),\n ),\n ];\n const found = yield* Effect.forEach(\n sources,\n (from) => {\n const toLinks = Arr.flatMap(linksTo(members, from));\n return taskTargets(root, from).pipe(Effect.map(toLinks));\n },\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n\n/** @internal */\nexport const checkUnusedWorkspaces = Effect.fn(\"checkUnusedWorkspaces\")(\n function* checkUnusedWorkspaces(root: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(root);\n const [cargo, deployed, lockedLinks] = yield* Effect.all(\n [cargoFacts(root, directories), deployEntries(root), workspaceLinks(root)],\n { concurrency: \"unbounded\" },\n );\n const found = yield* Effect.forEach(\n directories,\n (directory) => memberOf({ root, directory, crateLibraries: cargo.libraries, deployed }),\n { concurrency: READ_CONCURRENCY },\n );\n const members = Arr.getSomes(found);\n const tasks = yield* taskLinks(root, members);\n const links = [...lockedLinks, ...cargo.links, ...tasks];\n return pipe(\n members,\n Arr.filter(({ library, entry }) => library && !entry),\n Arr.filter((member) => !isDependedOn(links)(member)),\n Arr.map(({ directory }): Problem => ({\n file: files.join(root, directory, MANIFEST_FILE),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message: `${directory} is a private library, and no other workspace depends on it through package.json, a Cargo path dependency or a task. Delete it, or depend on it from the code that uses it.`,\n })),\n );\n },\n);\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nimport { WORKSPACE_SECTIONS, cargoDeviations, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { Deviations } from \"./deviation-entries.ts\";\n\nconst RULE: RuleName = \"upstream-deviation-place\";\nconst MANIFEST = \"package.json\";\nconst NESTED_WORKSPACE = \"/pnpm-workspace.yaml\";\nconst NESTED_CARGO = \"/Cargo.toml\";\nconst CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config(?:\\.toml)?$/u;\nconst MANAGER_FIELDS = [\"overrides\", \"resolutions\"] as const;\nconst START = 0;\nconst PLACE =\n \"Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.\";\n\nconst Fields = Schema.Record(Schema.String, Schema.Unknown);\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({\n pnpm: Schema.optional(Fields),\n overrides: Schema.optional(Schema.Unknown),\n resolutions: Schema.optional(Schema.Unknown),\n }),\n);\nconst decodeManifest = Schema.decodeUnknownOption(Manifest);\n\ninterface Field {\n readonly name: string;\n readonly key: string;\n}\n\nconst isManifest = (name: string): boolean =>\n name === MANIFEST || Str.endsWith(`/${MANIFEST}`)(name);\n\nconst keyIndex = (source: string, key: string): number =>\n Option.getOrElse(Str.indexOf(`\"${key}\"`)(source), () => START);\n\nconst fieldsIn = (source: string): readonly Field[] =>\n pipe(\n decodeManifest(source),\n Option.match({\n onNone: (): readonly Field[] => [],\n onSome: (manifest) => {\n const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));\n const pnpmFields = pipe(\n WORKSPACE_SECTIONS,\n Arr.filter((key) => Rec.has(pnpm, key)),\n Arr.map((key) => ({ name: `pnpm.${key}`, key })),\n );\n const managerFields = pipe(\n MANAGER_FIELDS,\n Arr.filter((key) => Option.isSome(Option.fromUndefinedOr(manifest[key]))),\n Arr.map((key) => ({ name: key, key })),\n );\n return [...pnpmFields, ...managerFields];\n },\n }),\n );\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n fieldsIn(source),\n Arr.map(({ name, key }) =>\n problemAtIndex(RULE)(entry.file, source)(\n keyIndex(source, key),\n `${name} in package.json is not allowed. ${PLACE} Move it there.`,\n ),\n ),\n );\n\nconst firstEntryProblem = (\n entry: Listed,\n source: string,\n deviations: Deviations,\n): readonly Problem[] =>\n pipe(\n Arr.head(deviations.entries),\n Option.map(({ index }) =>\n problemAtIndex(RULE)(entry.file, source)(\n index,\n `This file is not read for upstream deviations. ${PLACE}`,\n ),\n ),\n Option.toArray,\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] => {\n if (isManifest(entry.name)) {\n return manifestProblems(entry, source);\n }\n if (Str.endsWith(NESTED_WORKSPACE)(entry.name)) {\n return firstEntryProblem(entry, source, workspaceDeviations(source));\n }\n return firstEntryProblem(entry, source, cargoDeviations(source));\n};\n\nconst isScanned = ({ name }: Listed): boolean =>\n isManifest(name) ||\n Str.endsWith(NESTED_WORKSPACE)(name) ||\n Str.endsWith(NESTED_CARGO)(name) ||\n CARGO_CONFIG.test(name);\n\n/** @internal */\nexport const checkScatteredDeviations = Effect.fn(\"checkScatteredDeviations\")(\n function* checkScatteredDeviations(root: string) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScanned)), problemsIn);\n },\n);\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { MANIFEST_FILE } from \"#/entities/package/index.ts\";\nimport { workspaceProjects } from \"#/entities/workspace/index.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"workspace-description\";\nconst FIRST = 1;\n\n/** @internal */\nexport const checkWorkspaceDescriptions = Effect.fn(\"checkWorkspaceDescriptions\")(\n function* checkWorkspaceDescriptions(root: string) {\n const files = yield* RepositoryFiles;\n const projects = yield* workspaceProjects(root);\n return pipe(\n projects,\n Arr.filter(({ description }) => Option.isNone(description)),\n Arr.map(({ directory }): Problem => ({\n file: files.join(root, directory, MANIFEST_FILE),\n line: FIRST,\n column: FIRST,\n rule: RULE,\n message:\n 'Add a one-line \"description\" that says what this workspace is for. Agents find existing tools by these descriptions, so a workspace without one is invisible to them.',\n })),\n );\n },\n);\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkEffectDiagnostics } from \"#/features/check-effect-diagnostics/index.ts\";\nimport { checkExactVersions } from \"#/features/check-exact-versions/index.ts\";\nimport { checkPackSettings } from \"#/features/check-pack-settings/index.ts\";\nimport { checkPluginMarketplace } from \"#/features/check-plugin-marketplace/index.ts\";\nimport { checkPublishedManifests } from \"#/features/check-published-manifest/index.ts\";\nimport { checkNodeVersion } from \"#/features/check-runtime-version/index.ts\";\nimport { checkUnusedWorkspaces } from \"#/features/check-unused-workspaces/index.ts\";\nimport {\n checkScatteredDeviations,\n checkUpstreamExits,\n} from \"#/features/check-upstream-exits/index.ts\";\nimport { checkWorkspaceDescriptions } from \"#/features/check-workspace-descriptions/index.ts\";\n\n/** @internal */\nexport const checkManifests = Effect.fn(\"checkManifests\")(function* checkManifests(root: string) {\n const found = yield* Effect.all(\n [\n checkNodeVersion(root),\n checkPublishedManifests(root),\n checkPackSettings(root),\n checkUnusedWorkspaces(root),\n checkExactVersions(root),\n checkUpstreamExits(root),\n checkScatteredDeviations(root),\n checkEffectDiagnostics(root),\n checkWorkspaceDescriptions(root),\n checkPluginMarketplace(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkComments } from \"#/features/ban-comments/index.ts\";\nimport { checkDocker, checkPython } from \"#/features/ban-tools/index.ts\";\nimport { checkCatalogEntries } from \"#/features/check-catalog-entries/index.ts\";\nimport { checkGitSubpath, checkPackageRegistry } from \"#/features/check-overrides/index.ts\";\nimport {\n checkPublishedSkills,\n checkSkillEntry,\n checkSkillFiles,\n} from \"#/features/check-skills/index.ts\";\nimport {\n checkDowngrades,\n checkPackageVersions,\n checkRenovateSettings,\n} from \"#/features/check-version-downgrades/index.ts\";\nimport {\n checkAppliedPackages,\n checkReplacedTools,\n checkUnneededFiles,\n} from \"#/features/find-unneeded-files/index.ts\";\n\nimport { checkDocuments } from \"./document-checks.ts\";\nimport { checkManifests } from \"./manifest-checks.ts\";\n\n/** @internal */\nexport const checkTrackedText = Effect.fn(\"checkTrackedText\")(function* checkTrackedText(\n root: string,\n) {\n const found = yield* Effect.all(\n [\n checkDocuments(root),\n checkPython(root),\n checkDocker(root),\n checkUnneededFiles(root),\n checkReplacedTools(root),\n checkManifests(root),\n checkSkillFiles(root),\n checkSkillEntry(root),\n checkPublishedSkills(root),\n checkComments(root),\n checkAppliedPackages(root),\n checkGitSubpath(root),\n checkDowngrades(root),\n checkPackageVersions(root),\n checkRenovateSettings(root),\n checkCatalogEntries(root),\n checkPackageRegistry(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Effect } from \"effect\";\n\nimport { checkOverrides } from \"#/features/check-overrides/index.ts\";\nimport { checkPlacement } from \"#/features/check-placement/index.ts\";\nimport { checkWorkspaces } from \"#/features/check-repository-layout/index.ts\";\nimport { checkPublishedPackages } from \"#/features/measure-install-size/index.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nimport { checkBuilds } from \"./build-checks.ts\";\nimport { checkSources } from \"./source-checks.ts\";\nimport { checkToolUse } from \"./tool-use.ts\";\nimport { checkTrackedText } from \"./tracked-text.ts\";\n\n/** @internal */\nexport const checkAll: (\n root: string,\n) => Effect.Effect<\n readonly Problem[],\n Effect.Error<\n | ReturnType<typeof checkSources>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n | ReturnType<typeof checkWorkspaces>\n | ReturnType<typeof checkToolUse>\n >,\n Effect.Services<\n | ReturnType<typeof checkSources>\n | ReturnType<typeof checkOverrides>\n | ReturnType<typeof checkTrackedText>\n >\n> = Effect.fn(\"checkAll\")(function* checkAll(root: string) {\n const found = yield* Effect.all(\n [\n checkSources(root),\n checkOverrides(root),\n checkTrackedText(root),\n checkPlacement(root),\n checkPublishedPackages(root),\n checkWorkspaces(root),\n checkToolUse(root),\n checkBuilds(root),\n ],\n { concurrency: \"unbounded\" },\n );\n return Arr.flatten(found);\n});\n","#!/usr/bin/env node\nimport { VpToolsError, runVpa } from \"@r_masseater/vite-plus-adopt\";\nimport { Array as Arr, Effect, Schema, Stdio, Stream, pipe } from \"effect\";\n\nimport { checkAll } from \"#/app/all-checks.ts\";\nimport { ProblemsFound, writeStdout } from \"#/app/output.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { ProblemList, formatProblem, sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst NO_PROBLEMS = 0;\nconst ONE_FAILURE = 1;\nconst NO_CONFIG = \"config-missing\";\n\nconst writeProblems = (\n root: string,\n problems: readonly Problem[],\n): Effect.Effect<void, never, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n });\n\nconst writeStderr = Effect.fn(\"writeStderr\")(function* writeStderr(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n});\n\nconst failuresOf = (\n args: readonly string[],\n kind: string,\n message: string,\n): Effect.Effect<number, never, Stdio.Stdio> => {\n if (Arr.isReadonlyArrayEmpty(args) && kind === NO_CONFIG) {\n return Effect.succeed(NO_PROBLEMS);\n }\n return writeStderr(`${message}\\n`).pipe(Effect.as(ONE_FAILURE));\n};\n\ntype VpaRun = ReturnType<typeof runVpa>;\n\nconst toolChecks = (\n root: string,\n args: readonly string[],\n): Effect.Effect<\n number,\n Exclude<Effect.Error<VpaRun>, VpToolsError>,\n Effect.Services<VpaRun> | Stdio.Stdio\n> =>\n runVpa(root, args).pipe(\n Effect.as(NO_PROBLEMS),\n Effect.catchIf(Schema.is(VpToolsError), (failure) =>\n failuresOf(args, failure.kind, failure.message),\n ),\n );\n\nconst failWhenAny = (count: number): Effect.Effect<void, ProblemsFound> => {\n if (count > NO_PROBLEMS) {\n return Effect.fail(ProblemsFound.make({ count }));\n }\n return Effect.void;\n};\n\nconst writeJson = Effect.fn(\"writeJson\")(function* writeJson(root: string) {\n const found = yield* checkAll(root);\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(sortProblems(found));\n return yield* writeStdout(text);\n});\n\nconst checkEverything = Effect.fn(\"checkEverything\")(function* checkEverything(root: string) {\n const found = yield* checkAll(root);\n const problems = sortProblems(found);\n yield* writeProblems(root, problems);\n const toolFailures = yield* toolChecks(root, []);\n return yield* failWhenAny(problems.length + toolFailures);\n});\n\nconst msch = Effect.gen(function* msch() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const root = files.resolve(\".\");\n if (args.includes(JSON_FLAG)) {\n return yield* writeJson(root);\n }\n if (Arr.isReadonlyArrayNonEmpty(args)) {\n return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));\n }\n return yield* checkEverything(root);\n});\n\nrunCli(msch);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,eAAe,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU,OAAO,QAAQ,KAAK;CAC9B,KAAK;CACL,OAAO,OAAO;CACd,OAAO,OAAO;AAChB,CAAC;AACD,MAAM,aAAa,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,kBAAkB;CACvC,YAAY,OAAO,MAAM,OAAO,OAAO;AACzC,CAAC;AAED,MAAM,qBAAqB,OAAO,oBAAoB,YAAY;AAClE,MAAM,mBAAmB,OAAO,oBAAoB,UAAU;AAU9D,MAAM,WAAW,YACf,KACE,aAAa,SAAS,CAAC,CAAC,OAAO,GAC/BA,MAAI,SAAS,UACX,KACE,iBAAiB,KAAK,GACtB,OAAO,KAAK,EAAE,iBAAiB,UAAU,GACzC,OAAO,gBAAoC,CAAC,CAAC,CAC/C,CACF,GACAA,MAAI,SAAS,aAAa,OAAO,QAAQ,mBAAmB,QAAQ,CAAC,CAAC,CACxE;AAEF,MAAa,aAAa,OAAO,GAAG,YAAY,CAAC,CAAC,UAAU,WAC1D,MACA,WACA;CACA,MAAM,SAAS,OAAO,kBAAkB,MAAM,SAAS;CACvD,OAAO,KACL,QACA,OAAO,KAAK,EAAE,MAAM,QAAQ,eAAyB;EACnD;EACA;EACA,OAAO,QAAQ,OAAO;CACxB,EAAE,CACJ;AACF,CAAC;;AChDD,MAAMC,gBAAc;AACpB,MAAMC,UAAQ;AACd,MAAMC,YAAU;;AAShB,MAAaC,eAAa,UAAqC;CAC7D,MAAM,eAAe,KAAK,OAAOC,MAAI,IAAIC,SAAI,WAAWH,WAAS,OAAO,GAAG,KAAK,CAAC,CAAC;C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