@r_masseater/vite-plus-adopt 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vpa-WxGKHnY6.mjs","names":["Arr","DATA_FIRST_ARITY","Fn","Arr","SKILL_FILE","SINGLE","Rec","Str","Arr","Arr","Str","Arr","Str","Arr","Arr","Str","SINGLE","Arr","Rec","Str","DATA_FIRST_ARITY_3","Fn","Arr","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","Fn","Str","Arr","DATA_FIRST_ARITY_3","Arr","Fn","lint","Rec","Rec","Arr","DATA_FIRST_ARITY_3","Fn","Arr","Arr","Str","Arr","DATA_FIRST_ARITY","Str","Fn","Str","Arr","Rec","DATA_FIRST_ARITY","Arr","Rec","describe","Str","Fn","Arr","Fn","Arr","Str","Arr","Arr","Arr","Fn","Rec"],"sources":["../src/entities/vite-config/model/config.ts","../src/shared/config/skills.ts","../src/features/install-skills/model/cache.ts","../src/features/install-skills/model/link.ts","../src/features/install-skills/model/archive.ts","../src/features/install-skills/model/select.ts","../src/features/install-skills/model/local.ts","../src/features/install-skills/model/extract.ts","../src/features/install-skills/model/source.ts","../src/features/install-skills/model/install-skills.ts","../src/features/lint-text/model/commitlint.ts","../src/entities/check/model/section-check.ts","../src/shared/lib/git.ts","../src/features/lint-text/model/markdownlint.ts","../src/features/lint-text/model/textlint-presets.ts","../src/features/lint-text/model/textlint.ts","../src/features/lint-text/model/text-checks.ts","../src/features/scan-secrets/model/betterleaks.ts","../src/features/scan-secrets/model/secret-checks.ts","../src/shared/lib/workspace.ts","../src/features/check-repository/model/dependency-rules.ts","../src/features/check-repository/model/steiger.ts","../src/features/check-repository/model/repository-checks.ts","../src/features/check-workflows/model/workflow-checks.ts","../src/features/run-fallow/model/fallow-check.ts","../src/app/checks.ts","../src/app/run-checks.ts","../src/app/vpa.ts"],"sourcesContent":["import { Effect, FileSystem, Function as Fn, Option, Path, Array as Arr, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { ToolSection, ToolSections } from \"#/shared/config/index.ts\";\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport { configMissing } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\n\n/** @internal */\nexport type FileServices = FileSystem.FileSystem | Path.Path;\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\n\nconst findConfigFile = (root: string): Effect.Effect<string, VpToolsError, FileServices> =>\n Effect.gen(function* find() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const existing = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n return yield* Effect.fromOption(Arr.head(existing)).pipe(\n Effect.mapError(() => configMissing(`No vite.config file in ${root}`)),\n );\n });\n\n/** @internal */\nexport const loadViteConfig = (\n root: string,\n): Effect.Effect<ToolSections, VpToolsError, FileServices> =>\n findConfigFile(root).pipe(\n Effect.flatMap((file) => attempt(\"vite.config\")(() => resolveConfigFromFile(file))),\n );\n\nconst requireSection =\n <Key extends ToolSection>(key: Key) =>\n (config: ToolSections): Effect.Effect<NonNullable<ToolSections[Key]>, VpToolsError> =>\n Effect.fromOption(Option.fromNullishOr(config[key])).pipe(\n Effect.mapError(() => configMissing(`vite.config has no \"${key}\" section`)),\n );\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport const loadSection: {\n <Key extends ToolSection>(\n key: Key,\n ): (root: string) => Effect.Effect<NonNullable<ToolSections[Key]>, VpToolsError, FileServices>;\n <Key extends ToolSection>(\n root: string,\n key: Key,\n ): Effect.Effect<NonNullable<ToolSections[Key]>, VpToolsError, FileServices>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Key extends ToolSection>(\n root: string,\n key: Key,\n ): Effect.Effect<NonNullable<ToolSections[Key]>, VpToolsError, FileServices> =>\n loadViteConfig(root).pipe(Effect.flatMap(requireSection(key))),\n);\n","import { Schema } from \"effect\";\n\nconst Repository = Schema.String.check(Schema.isPattern(/^[\\w-][\\w.-]*\\/[\\w.-]+$/u));\nconst LocalDirectory = Schema.String.check(Schema.isPattern(/^\\.\\/[\\w.-]+(?:\\/[\\w.-]+)*$/u));\nconst Commit = Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/u));\nconst SkillName = Schema.String.check(Schema.isPattern(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u));\nconst Selection = Schema.Union([Schema.Literal(\"all\"), Schema.NonEmptyArray(SkillName)]);\n\nexport const RemoteSkillSourceSchema = Schema.Struct({\n commit: Commit,\n root: Schema.optional(Schema.String),\n skills: Selection,\n});\n\nexport const LocalSkillSourceSchema = Schema.Struct({ skills: Selection });\n\nexport type RemoteSkillSource = typeof RemoteSkillSourceSchema.Type;\n\nexport type SkillSelection = typeof Selection.Type;\n\nexport const SkillsSectionSchema = Schema.Record(\n Schema.Union([Repository, LocalDirectory]),\n Schema.Union([RemoteSkillSourceSchema, LocalSkillSourceSchema]),\n);\n\nexport type SkillsSection = typeof SkillsSectionSchema.Encoded;\n","import { Config, Context, Effect, Option, Path, pipe } from \"effect\";\n\nimport { configMissing } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\n\nexport const SkillCacheDirectory = Context.Reference<Option.Option<string>>(\n \"vite-plus-adopt/SkillCacheDirectory\",\n { defaultValue: Option.none },\n);\n\nconst SUBDIRECTORY = [\"vpa\", \"skills\"];\n\nconst variable = (name: string): Effect.Effect<Option.Option<string>> =>\n Config.option(Config.NonEmptyString(name)).pipe(Effect.orElseSucceed(Option.none));\n\nconst platformCache: Effect.Effect<Option.Option<string>, never, Path.Path> = Effect.gen(\n function* platformCache() {\n const path = yield* Path.Path;\n if (process.platform === \"win32\") {\n return yield* variable(\"LOCALAPPDATA\");\n }\n const home = yield* variable(\"HOME\");\n return pipe(\n home,\n Option.map((directory) => path.join(directory, \".cache\")),\n );\n },\n);\n\nconst baseDirectory: Effect.Effect<string, VpToolsError, Path.Path> = variable(\n \"XDG_CACHE_HOME\",\n).pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => platformCache,\n onSome: Effect.succeedSome,\n }),\n ),\n Effect.flatMap(Effect.fromOption),\n Effect.mapError(() => configMissing(\"No cache directory: set XDG_CACHE_HOME or HOME\")),\n);\n\n/** @internal */\nexport const skillCacheDirectory: Effect.Effect<string, VpToolsError, Path.Path> = Effect.gen(\n function* skillCache() {\n const path = yield* Path.Path;\n const configured = yield* SkillCacheDirectory;\n if (Option.isSome(configured)) {\n return configured.value;\n }\n const base = yield* baseDirectory;\n return path.join(base, ...SUBDIRECTORY);\n },\n);\n","import { Array as Arr, Effect, FileSystem, Path, pipe } from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { toolFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { runCaptured } from \"#/shared/lib/process.ts\";\n\n/** @internal */\nexport interface Link {\n readonly name: string;\n readonly target: string;\n}\n\n/** @internal */\nexport type LinkServices =\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner;\n\n/** @internal */\nexport type LinkError = VpToolsError | PlatformError.PlatformError;\n\nconst KEEP = \".gitkeep\";\n\nconst junction = (\n target: string,\n link: string,\n): Effect.Effect<void, LinkError, ChildProcessSpawner.ChildProcessSpawner> =>\n runCaptured({\n root: \".\",\n file: \"cmd.exe\",\n args: [\"/d\", \"/c\", \"mklink\", \"/J\", link, target],\n }).pipe(\n Effect.filterOrFail(\n ({ valid }) => valid,\n ({ output }) => toolFailed(\"mklink\")(output),\n ),\n Effect.asVoid,\n );\n\nconst linkTo =\n (directory: string) =>\n ({ name, target }: Link): Effect.Effect<void, LinkError, LinkServices> =>\n Effect.gen(function* linkOne() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const link = path.join(directory, name);\n if (process.platform === \"win32\") {\n return yield* junction(target, link);\n }\n return yield* fs.symlink(target, link);\n });\n\nconst pointsAt =\n (directory: string) =>\n ({\n name,\n target,\n }: Link): Effect.Effect<\n boolean,\n PlatformError.PlatformError,\n FileSystem.FileSystem | Path.Path\n > =>\n Effect.gen(function* readTarget() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* fs.readLink(path.join(directory, name));\n return path.resolve(directory, found) === path.resolve(target);\n });\n\nconst isCurrent = (\n directory: string,\n links: readonly Link[],\n): Effect.Effect<boolean, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* matches() {\n const fs = yield* FileSystem.FileSystem;\n const entries = yield* fs.readDirectory(directory);\n const expected = pipe(\n links,\n Arr.map(({ name }) => name),\n Arr.append(KEEP),\n );\n const linked = yield* Effect.forEach(links, pointsAt(directory), { concurrency: 1 });\n const onlyExpected = pipe(\n entries,\n Arr.every((entry) => Arr.contains(expected, entry)),\n );\n return onlyExpected && pipe(linked, Arr.every(Boolean));\n }).pipe(Effect.orElseSucceed(() => false));\n\nconst buildNext = (\n agents: string,\n skills: string,\n links: readonly Link[],\n): Effect.Effect<string, LinkError, LinkServices> =>\n Effect.gen(function* stageLinks() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const next = yield* fs.makeTempDirectory({ directory: agents, prefix: \".skills-next-\" });\n yield* Effect.forEach(links, linkTo(next), { concurrency: 1, discard: true });\n if (yield* fs.exists(path.join(skills, KEEP))) {\n yield* fs.writeFileString(path.join(next, KEEP), \"\");\n }\n return next;\n });\n\nconst swapIn = (\n agents: string,\n skills: string,\n next: string,\n): Effect.Effect<void, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* replaceDirectory() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n if (!(yield* fs.exists(skills))) {\n return yield* fs.rename(next, skills);\n }\n const previous = yield* fs.makeTempDirectory({ directory: agents, prefix: \".skills-old-\" });\n yield* fs.rename(skills, path.join(previous, \"skills\"));\n yield* fs.rename(next, skills);\n return yield* fs.remove(previous, { recursive: true });\n });\n\n/** @internal */\nexport const linkSkills =\n (root: string) =>\n (links: readonly Link[]): Effect.Effect<void, LinkError, LinkServices> =>\n Effect.gen(function* link() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const agents = path.join(root, \".agents\");\n const skills = path.join(agents, \"skills\");\n if (yield* isCurrent(skills, links)) {\n return;\n }\n yield* fs.makeDirectory(agents, { recursive: true });\n const next = yield* buildNext(agents, skills, links);\n yield* swapIn(agents, skills, next);\n });\n","import {\n Array as Arr,\n Config,\n Effect,\n Exit,\n Option,\n Record as Rec,\n Redacted,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/http\";\nimport type { HttpClientError } from \"effect/http\";\nimport { parse } from \"yaml\";\n\nimport type { RemoteSkillSource } from \"#/shared/config/index.ts\";\nimport { checksFailed, toolFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { readTarGz } from \"#/shared/lib/tar-gz.ts\";\nimport type { TarEntry } from \"#/shared/lib/tar-gz.ts\";\n\n/** @internal */\nexport interface Declared {\n readonly repository: string;\n readonly source: RemoteSkillSource;\n}\n\n/** @internal */\nexport interface FoundSkill {\n readonly name: string;\n readonly directory: string;\n}\n\n/** @internal */\nexport const SEPARATOR = \"/\";\n\nconst SKILL_FILE = \"SKILL.md\";\nconst FRONTMATTER = /^---\\r?\\n(?<yaml>[\\s\\S]*?)\\r?\\n---/u;\nconst NEXT = 1;\nconst START = 0;\nconst SINGLE = 1;\nconst SHORT_COMMIT = 7;\n\nconst Frontmatter = Schema.Struct({ name: Schema.String });\nconst decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);\nconst parseYaml = Option.liftThrowable((yaml: string): unknown => parse(yaml));\n\nconst nameOf = (markdown: string): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(FRONTMATTER.exec(markdown)),\n Option.flatMap((found) => Option.fromNullishOr(found.groups)),\n Option.flatMap((groups) => Rec.get(groups, \"yaml\")),\n Option.flatMap(parseYaml),\n Option.flatMap(decodeFrontmatter),\n Option.map(({ name }) => name),\n );\n\nconst afterFirstSegment = (path: string): string =>\n pipe(\n path,\n Str.indexOf(SEPARATOR),\n Option.match({ onNone: () => path, onSome: (at) => Str.slice(at + NEXT)(path) }),\n );\n\nconst withoutTopDirectory = ({ header, bytes }: TarEntry): TarEntry => ({\n header: { ...header, path: afterFirstSegment(header.path) },\n bytes,\n});\n\n/** @internal */\nexport const isUnder =\n (directory: string) =>\n (path: string): boolean =>\n directory === \"\" || Str.startsWith(`${directory}${SEPARATOR}`)(path);\n\n/** @internal */\nexport const relativeTo =\n (directory: string) =>\n (path: string): string => {\n if (directory === \"\") {\n return path;\n }\n return Str.slice(directory.length + NEXT)(path);\n };\n\nconst parentOf = (path: string): string =>\n pipe(\n path,\n Str.lastIndexOf(SEPARATOR),\n Option.match({ onNone: () => \"\", onSome: (at) => Str.slice(START, at)(path) }),\n );\n\nconst isSkillFile =\n (root: string) =>\n (entry: TarEntry): boolean =>\n entry.header.type === \"File\" &&\n (entry.header.path === SKILL_FILE ||\n Str.endsWith(`${SEPARATOR}${SKILL_FILE}`)(entry.header.path)) &&\n isUnder(root)(entry.header.path);\n\ninterface Candidate {\n readonly directory: string;\n readonly name: Option.Option<string>;\n}\n\nconst isOutermost =\n (candidates: readonly Candidate[]) =>\n ({ directory }: Candidate): boolean =>\n !pipe(\n candidates,\n Arr.some((other) => other.directory !== directory && isUnder(other.directory)(directory)),\n );\n\nconst toFound = ({ directory, name }: Candidate): readonly FoundSkill[] =>\n pipe(\n name,\n Option.map((found): FoundSkill => ({ name: found, directory })),\n Option.toArray,\n );\n\nconst duplicatesOf = (found: readonly FoundSkill[]): readonly string[] =>\n pipe(\n found,\n Arr.groupBy(({ name }) => name),\n Rec.filter((group) => group.length > SINGLE),\n Rec.keys,\n );\n\n/** @internal */\nexport const skillsIn =\n ({ repository, source }: Declared) =>\n (entries: readonly TarEntry[]): Effect.Effect<readonly FoundSkill[], VpToolsError> => {\n const decoder = new TextDecoder();\n const root = source.root ?? \"\";\n const candidates = pipe(\n entries,\n Arr.filter(isSkillFile(root)),\n Arr.map(({ header, bytes }): Candidate => ({\n directory: parentOf(header.path),\n name: nameOf(decoder.decode(bytes)),\n })),\n );\n const found = pipe(candidates, Arr.filter(isOutermost(candidates)), Arr.flatMap(toFound));\n const duplicated = duplicatesOf(found);\n if (Arr.isReadonlyArrayNonEmpty(duplicated)) {\n return Effect.fail(\n checksFailed(\n `${repository} declares ${Arr.join(duplicated, \", \")} in more than one folder`,\n ),\n );\n }\n return Effect.succeed(found);\n };\n\n/** @internal */\nexport const labelOf = ({ repository, source }: Declared): string =>\n `${repository}@${Str.slice(START, SHORT_COMMIT)(source.commit)}`;\n\nconst codeload = ({ repository, source }: Declared): HttpClientRequest.HttpClientRequest =>\n HttpClientRequest.get(`https://codeload.github.com/${repository}/tar.gz/${source.commit}`);\n\nconst api =\n ({ repository, source }: Declared) =>\n (token: Redacted.Redacted): HttpClientRequest.HttpClientRequest =>\n HttpClientRequest.get(\n `https://api.github.com/repos/${repository}/tarball/${source.commit}`,\n ).pipe(HttpClientRequest.bearerToken(Redacted.value(token)));\n\nconst fetchBytes = (\n request: HttpClientRequest.HttpClientRequest,\n): Effect.Effect<Uint8Array, HttpClientError.HttpClientError, HttpClient.HttpClient> =>\n Effect.gen(function* fetchArchive() {\n const httpClient = yield* HttpClient.HttpClient;\n const response = yield* HttpClient.filterStatusOk(httpClient).execute(request);\n const body = yield* response.arrayBuffer;\n return new Uint8Array(body);\n });\n\nconst githubToken: Effect.Effect<Option.Option<Redacted.Redacted>> = Config.option(\n Config.Redacted(\"GITHUB_TOKEN\"),\n).pipe(Effect.orElseSucceed(Option.none));\n\nconst download = (\n declared: Declared,\n): Effect.Effect<Uint8Array, VpToolsError, HttpClient.HttpClient> =>\n Effect.gen(function* downloadArchive() {\n const fromCodeload = yield* Effect.exit(fetchBytes(codeload(declared)));\n const token = yield* githubToken;\n if (Exit.isSuccess(fromCodeload) || Option.isNone(token)) {\n return yield* fromCodeload;\n }\n return yield* token.value.pipe(api(declared), fetchBytes);\n }).pipe(Effect.mapError(toolFailed(`downloading ${declared.repository}`)));\n\n/** @internal */\nexport const downloadEntries = (\n declared: Declared,\n): Effect.Effect<readonly TarEntry[], VpToolsError, HttpClient.HttpClient> =>\n download(declared).pipe(Effect.flatMap(readTarGz), Effect.map(Arr.map(withoutTopDirectory)));\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport type { SkillSelection } from \"#/shared/config/index.ts\";\nimport { checksFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\n\n/** @internal */\nexport interface Selecting {\n readonly label: string;\n readonly skills: SkillSelection;\n}\n\n/** @internal */\nexport const selectSkills =\n ({ label, skills }: Selecting) =>\n (available: readonly string[]): Effect.Effect<readonly string[], VpToolsError> => {\n if (skills === \"all\") {\n return Effect.succeed(available);\n }\n const missing = pipe(\n skills,\n Arr.filter((name) => !Arr.contains(available, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(missing)) {\n return Effect.fail(\n checksFailed(\n `${label} has no skill named ${Arr.join(missing, \", \")}. It has: ${Arr.join(available, \", \")}`,\n ),\n );\n }\n return Effect.succeed(skills);\n };\n","import { Array as Arr, Effect, FileSystem, Path, String as Str, pipe } from \"effect\";\n\nimport type { SkillSelection } from \"#/shared/config/index.ts\";\nimport { checksFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\n\nimport { SEPARATOR } from \"./archive.ts\";\nimport { selectSkills } from \"./select.ts\";\nimport type { Resolved } from \"./source.ts\";\n\nconst SKILL_FILE = \"SKILL.md\";\n\n/** @internal */\nexport interface LocalDeclared {\n readonly directory: string;\n readonly skills: SkillSelection;\n}\n\nconst hasSkillFile =\n (base: string) =>\n (name: string): Effect.Effect<boolean, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* checkSkillFile() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return yield* fs.exists(path.join(base, name, SKILL_FILE));\n }).pipe(Effect.orElseSucceed(() => false));\n\n/** @internal */\nexport const resolveLocal =\n (root: string) =>\n ({\n directory,\n skills,\n }: LocalDeclared): Effect.Effect<Resolved, VpToolsError, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* resolveLocalSource() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const base = path.join(root, ...Str.split(SEPARATOR)(directory));\n const entries = yield* fs\n .readDirectory(base)\n .pipe(Effect.mapError(() => checksFailed(`${directory} is not a folder`)));\n const available = yield* pipe(\n Arr.sort(entries, Str.Order),\n Effect.filter(hasSkillFile(base)),\n );\n const names = yield* selectSkills({ label: directory, skills })(available);\n return { repository: directory, names, directory: base };\n });\n","import { Array as Arr, Effect, Exit, FileSystem, Path, String as Str, pipe } from \"effect\";\nimport type { PlatformError } from \"effect\";\n\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { toJson } from \"#/shared/lib/json.ts\";\nimport type { TarEntry } from \"#/shared/lib/tar-gz.ts\";\n\nimport { SEPARATOR, isUnder, relativeTo } from \"./archive.ts\";\nimport type { FoundSkill } from \"./archive.ts\";\n\n/** @internal */\nexport type FileServices = FileSystem.FileSystem | Path.Path;\n\n/** @internal */\nexport type ExtractError = VpToolsError | PlatformError.PlatformError;\n\n/** @internal */\nexport const INDEX = \".index.json\";\n\nconst READ_ONLY = 0o444;\nconst READ_ONLY_EXECUTABLE = 0o555;\nconst OWNER_EXECUTE = 0o100;\nconst BIT = 2;\nconst SET = 1;\n\nconst modeOf = (mode: number): number => {\n if (Math.trunc(mode / OWNER_EXECUTE) % BIT === SET) {\n return READ_ONLY_EXECUTABLE;\n }\n return READ_ONLY;\n};\n\nconst renameOrKeep = (\n staging: string,\n target: string,\n): Effect.Effect<void, PlatformError.PlatformError, FileServices> =>\n Effect.gen(function* renameOrKeepPlaced() {\n const fs = yield* FileSystem.FileSystem;\n const renamed = yield* Effect.exit(fs.rename(staging, target));\n if (Exit.isSuccess(renamed) || !(yield* fs.exists(target))) {\n return yield* renamed;\n }\n return yield* fs.remove(staging, { recursive: true });\n });\n\nconst placeAtomically = <Failure>(\n target: string,\n write: (staging: string) => Effect.Effect<void, Failure, FileServices>,\n): Effect.Effect<void, Failure | PlatformError.PlatformError, FileServices> =>\n Effect.gen(function* place() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n yield* fs.makeDirectory(path.dirname(target), { recursive: true });\n const staging = yield* fs.makeTempDirectory({\n directory: path.dirname(target),\n prefix: \".partial-\",\n });\n yield* write(staging);\n yield* renameOrKeep(staging, target);\n });\n\nconst writeEntry =\n (staging: string, skill: FoundSkill) =>\n ({ header, bytes }: TarEntry): Effect.Effect<void, PlatformError.PlatformError, FileServices> =>\n Effect.gen(function* writeFile() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const relative = relativeTo(skill.directory)(header.path);\n const file = path.join(staging, ...Str.split(SEPARATOR)(relative));\n yield* fs.makeDirectory(path.dirname(file), { recursive: true });\n yield* fs.writeFile(file, bytes);\n yield* fs.chmod(file, modeOf(header.mode));\n });\n\n/** @internal */\nexport interface Placement {\n readonly skill: FoundSkill;\n readonly target: string;\n}\n\n/** @internal */\nexport const extractSkill =\n ({ skill, target }: Placement) =>\n (entries: readonly TarEntry[]): Effect.Effect<void, ExtractError, FileServices> =>\n placeAtomically(target, (staging) =>\n Effect.forEach(\n pipe(\n entries,\n Arr.filter(\n ({ header }) => header.type === \"File\" && isUnder(skill.directory)(header.path),\n ),\n ),\n writeEntry(staging, skill),\n { concurrency: 1, discard: true },\n ),\n );\n\n/** @internal */\nexport const writeIndex =\n (directory: string) =>\n (available: readonly string[]): Effect.Effect<void, ExtractError, FileServices> =>\n Effect.gen(function* writeIndexFile() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n yield* fs.makeDirectory(directory, { recursive: true });\n const staging = yield* fs.makeTempDirectory({ directory, prefix: \".partial-\" });\n const partial = path.join(staging, INDEX);\n yield* fs.writeFileString(partial, toJson(available));\n yield* fs.rename(partial, path.join(directory, INDEX));\n yield* fs.remove(staging, { recursive: true });\n });\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport type { HttpClient } from \"effect/http\";\n\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport type { TarEntry } from \"#/shared/lib/tar-gz.ts\";\n\nimport { SEPARATOR, downloadEntries, labelOf, skillsIn } from \"./archive.ts\";\nimport type { Declared, FoundSkill } from \"./archive.ts\";\nimport { INDEX, extractSkill, writeIndex } from \"./extract.ts\";\nimport { selectSkills } from \"./select.ts\";\n\n/** @internal */\nexport interface Resolved {\n readonly repository: string;\n readonly names: readonly string[];\n readonly directory: string;\n}\n\n/** @internal */\nexport type SourceServices = FileSystem.FileSystem | Path.Path | HttpClient.HttpClient;\n\n/** @internal */\nexport type SourceError = VpToolsError | PlatformError.PlatformError;\n\nconst Index = Schema.fromJsonString(Schema.Array(Schema.String));\n\nconst readIndex = (\n directory: string,\n): Effect.Effect<Option.Option<readonly string[]>, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readIndexFile() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const text = yield* fs.readFileString(path.join(directory, INDEX));\n return yield* Schema.decodeEffect(Index)(text);\n }).pipe(Effect.option);\n\nconst isPresent =\n (directory: string) =>\n (name: string): Effect.Effect<boolean, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* checkPresent() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return yield* fs.exists(path.join(directory, name));\n }).pipe(Effect.orElseSucceed(() => false));\n\nconst missingFrom = (\n directory: string,\n names: readonly string[],\n): Effect.Effect<readonly string[], never, FileSystem.FileSystem | Path.Path> =>\n pipe(\n names,\n Effect.filter((name) => isPresent(directory)(name).pipe(Effect.map((present) => !present))),\n );\n\nconst cachedNames = (\n declared: Declared,\n directory: string,\n): Effect.Effect<\n Option.Option<readonly string[]>,\n VpToolsError,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* fromCache() {\n const index = yield* readIndex(directory);\n if (Option.isNone(index)) {\n return Option.none();\n }\n const names = yield* selectSkills({ label: labelOf(declared), skills: declared.source.skills })(\n index.value,\n );\n const missing = yield* missingFrom(directory, names);\n return Option.liftPredicate(names, () => Arr.isReadonlyArrayEmpty(missing));\n });\n\nconst extractMissing =\n (entries: readonly TarEntry[], directory: string) =>\n (skill: FoundSkill): Effect.Effect<void, SourceError, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* extractIfMissing() {\n const path = yield* Path.Path;\n const present = yield* isPresent(directory)(skill.name);\n if (!present) {\n yield* extractSkill({ skill, target: path.join(directory, skill.name) })(entries);\n }\n });\n\nconst fetchNames = (\n declared: Declared,\n directory: string,\n): Effect.Effect<readonly string[], SourceError, SourceServices> =>\n Effect.gen(function* fromArchive() {\n const entries = yield* downloadEntries(declared);\n const found = yield* skillsIn(declared)(entries);\n const available = pipe(\n found,\n Arr.map(({ name }) => name),\n );\n const selected = yield* selectSkills({\n label: labelOf(declared),\n skills: declared.source.skills,\n })(available);\n yield* Effect.forEach(\n pipe(\n found,\n Arr.filter(({ name }) => Arr.contains(selected, name)),\n ),\n extractMissing(entries, directory),\n { concurrency: 1, discard: true },\n );\n yield* writeIndex(directory)(available);\n return selected;\n });\n\n/** @internal */\nexport const resolveSource =\n (cache: string) =>\n (declared: Declared): Effect.Effect<Resolved, SourceError, SourceServices> =>\n Effect.gen(function* resolve() {\n const path = yield* Path.Path;\n const directory = path.join(\n cache,\n ...Str.split(SEPARATOR)(declared.repository),\n declared.source.commit,\n );\n const cached = yield* cachedNames(declared, directory);\n const names = yield* Option.match(cached, {\n onNone: () => fetchNames(declared, directory),\n onSome: Effect.succeed,\n });\n return { repository: declared.repository, names, directory };\n });\n","import {\n Array as Arr,\n Effect,\n Option,\n Path,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { FileSystem, PlatformError } from \"effect\";\nimport type { HttpClient } from \"effect/http\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { loadViteConfig } from \"#/entities/vite-config/index.ts\";\nimport { RemoteSkillSourceSchema, SkillsSectionSchema } from \"#/shared/config/index.ts\";\nimport { checksFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\n\nimport { skillCacheDirectory } from \"./cache.ts\";\nimport { linkSkills } from \"./link.ts\";\nimport type { Link } from \"./link.ts\";\nimport { resolveLocal } from \"./local.ts\";\nimport { resolveSource } from \"./source.ts\";\nimport type { Resolved } from \"./source.ts\";\n\n/** @internal */\nexport type InstallServices =\n | FileSystem.FileSystem\n | Path.Path\n | HttpClient.HttpClient\n | ChildProcessSpawner.ChildProcessSpawner;\n\n/** @internal */\nexport type InstallError = VpToolsError | PlatformError.PlatformError;\n\ntype Section = typeof SkillsSectionSchema.Type;\n\ntype Entry = readonly [string, Section[string]];\n\nconst isRemote = Schema.is(RemoteSkillSourceSchema);\n\nconst LOCAL_PREFIX = \"./\";\n\nconst SINGLE = 1;\n\nconst decodeSection = (raw: unknown): Effect.Effect<Section, VpToolsError> =>\n Schema.decodeUnknownEffect(SkillsSectionSchema)(raw, { onExcessProperty: \"error\" }).pipe(\n Effect.mapError((failure) => checksFailed(`vite.config \"skills\": ${failure.message}`)),\n );\n\ninterface Named extends Link {\n readonly repository: string;\n}\n\nconst namedLinks =\n (path: Path.Path) =>\n ({ repository, names, directory }: Resolved): readonly Named[] =>\n pipe(\n names,\n Arr.map((name) => ({ name, repository, target: path.join(directory, name) })),\n );\n\nconst describeClash = ([name, group]: readonly [string, readonly Named[]]): string =>\n `${name} (${Arr.join(\n pipe(\n group,\n Arr.map(({ repository }) => repository),\n ),\n \", \",\n )})`;\n\nconst linksOf = (\n resolved: readonly Resolved[],\n): Effect.Effect<readonly Link[], VpToolsError, Path.Path> =>\n Effect.gen(function* collectLinks() {\n const path = yield* Path.Path;\n const links = pipe(resolved, Arr.flatMap(namedLinks(path)));\n const clashes = pipe(\n links,\n Arr.groupBy(({ name }) => name),\n Rec.filter((group) => group.length > SINGLE),\n Rec.toEntries,\n Arr.map(describeClash),\n );\n if (Arr.isReadonlyArrayNonEmpty(clashes)) {\n return yield* checksFailed(`More than one source provides ${Arr.join(clashes, \"; \")}`);\n }\n return pipe(\n links,\n Arr.map(({ name, target }): Link => ({ name, target })),\n );\n });\n\nconst resolveEntry =\n (root: string, cache: string) =>\n ([key, source]: Entry): Effect.Effect<Resolved, InstallError, InstallServices> => {\n const local = Str.startsWith(LOCAL_PREFIX)(key);\n if (isRemote(source)) {\n if (local) {\n return Effect.fail(\n checksFailed(\n `vite.config \"skills\": ${key} is a folder in this repository and takes no commit`,\n ),\n );\n }\n return resolveSource(cache)({ repository: key, source });\n }\n if (!local) {\n return Effect.fail(checksFailed(`vite.config \"skills\": ${key} needs a commit`));\n }\n return resolveLocal(root)({ directory: key, skills: source.skills });\n };\n\n/** @internal */\nexport const installSkills = (\n root: string,\n): Effect.Effect<Option.Option<number>, InstallError, InstallServices> =>\n Effect.gen(function* install() {\n const config = yield* loadViteConfig(root);\n const raw = Option.fromNullishOr(config.skills);\n if (Option.isNone(raw)) {\n return Option.none();\n }\n const section = yield* decodeSection(raw.value);\n const cache = yield* skillCacheDirectory;\n const resolved = yield* Effect.forEach(Rec.toEntries(section), resolveEntry(root, cache), {\n concurrency: \"unbounded\",\n });\n const links = yield* linksOf(resolved);\n yield* linkSkills(root)(links);\n return Option.some(links.length);\n });\n","import format from \"@commitlint/format\";\nimport lint from \"@commitlint/lint\";\nimport load from \"@commitlint/load\";\nimport type { LintOptions, QualifiedConfig } from \"@commitlint/types\";\nimport { Array as Arr, Effect, FileSystem, Option, Predicate, pipe, Function as Fn } from \"effect\";\nimport type { PlatformError } from \"effect\";\n\nimport type { CommitlintConfig } from \"#/shared/config/index.ts\";\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst COMMENT_CHAR = \"#\";\n\nconst parserOptionsOf = (loaded: QualifiedConfig): NonNullable<LintOptions[\"parserOpts\"]> => {\n const preset = pipe(\n Option.fromNullishOr(loaded.parserPreset),\n Option.map(({ parserOpts }) => parserOpts),\n Option.filter(Predicate.isObject),\n Option.getOrElse(() => ({})),\n );\n return { ...preset, commentChar: COMMENT_CHAR };\n};\n\nconst lintOptionsOf = (loaded: QualifiedConfig): LintOptions => ({\n parserOpts: parserOptionsOf(loaded),\n plugins: loaded.plugins,\n ignores: loaded.ignores ?? [],\n defaultIgnores: loaded.defaultIgnores ?? true,\n});\n\n/** @internal */\nexport const lintCommitMessages: {\n (\n root: string,\n messages: readonly string[],\n ): (config: CommitlintConfig) => Effect.Effect<Report, VpToolsError>;\n (\n config: CommitlintConfig,\n root: string,\n messages: readonly string[],\n ): Effect.Effect<Report, VpToolsError>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n config: CommitlintConfig,\n root: string,\n messages: readonly string[],\n ): Effect.Effect<Report, VpToolsError> =>\n Effect.gen(function* lintMessages() {\n const loaded = yield* attempt(\"commitlint\")(() => load(config, { cwd: root }));\n const results = yield* Effect.forEach(\n messages,\n (message) =>\n attempt(\"commitlint\")(() => lint(message, loaded.rules, lintOptionsOf(loaded))),\n { concurrency: 1 },\n );\n return {\n valid: pipe(\n results,\n Arr.every((result) => result.valid),\n ),\n output: format({ results }, { color: false }),\n };\n }),\n);\n\n/** @internal */\nexport const lintCommitMessageFile: {\n (\n root: string,\n messageFile: string,\n ): (\n config: CommitlintConfig,\n ) => Effect.Effect<Report, VpToolsError | PlatformError.PlatformError, FileSystem.FileSystem>;\n (\n config: CommitlintConfig,\n root: string,\n messageFile: string,\n ): Effect.Effect<Report, VpToolsError | PlatformError.PlatformError, FileSystem.FileSystem>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n config: CommitlintConfig,\n root: string,\n messageFile: string,\n ): Effect.Effect<Report, VpToolsError | PlatformError.PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* read() {\n const fs = yield* FileSystem.FileSystem;\n const message = yield* fs.readFileString(messageFile);\n return yield* lintCommitMessages(config, root, [message]);\n }),\n);\n","import { Effect, Function as Fn, Option, pipe } from \"effect\";\n\nimport type { ToolSection, ToolSections } from \"#/shared/config/index.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport type { Check, CheckContext, CheckError, CheckServices } from \"./check.ts\";\n\n/** @internal */\nexport type SectionRun<Key extends ToolSection> = (\n section: NonNullable<ToolSections[Key]>,\n context: CheckContext,\n) => Effect.Effect<Report, CheckError, CheckServices>;\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport const withSection: {\n <Key extends ToolSection>(run: SectionRun<Key>): (key: Key) => Check;\n <Key extends ToolSection>(key: Key, run: SectionRun<Key>): Check;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Key extends ToolSection>(key: Key, run: SectionRun<Key>): Check =>\n (context) =>\n pipe(\n Option.fromNullishOr(context.config[key]),\n Option.match({\n onNone: () => Effect.succeedNone,\n onSome: (section) => Effect.asSome(run(section, context)),\n }),\n ),\n);\n","import { Effect, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport const listGitFiles: {\n (\n pathspecs: readonly string[],\n ): (\n root: string,\n ) => Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n >;\n (\n root: string,\n pathspecs: readonly string[],\n ): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n >;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (\n root: string,\n pathspecs: readonly string[],\n ): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n > =>\n Effect.gen(function* list() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\n \"-c\",\n \"core.quotePath=false\",\n \"ls-files\",\n \"-co\",\n \"--exclude-standard\",\n \"-z\",\n \"--\",\n ...pathspecs,\n ],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n }),\n);\n\n/** @internal */\nexport const listCommitMessages: {\n (\n range: string,\n ): (\n root: string,\n ) => Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n >;\n (\n root: string,\n range: string,\n ): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n >;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (\n root: string,\n range: string,\n ): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n > =>\n Effect.gen(function* messages() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\"git\", [\"log\", \"-z\", \"--first-parent\", \"--format=%B\", range, \"--\"], {\n cwd: root,\n }),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n }),\n);\n","import { Effect, Option, Path, Array as Arr, Record as Rec, pipe, Function as Fn } from \"effect\";\nimport type { LintError, Options } from \"markdownlint\";\nimport { lint } from \"markdownlint/promise\";\n\nimport type { MarkdownlintConfig } from \"#/shared/config/index.ts\";\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst formatError =\n (file: string) =>\n (error: LintError): string => {\n const detail = pipe(\n [error.errorDetail, error.errorContext],\n Arr.filter((part): part is string => part !== null && part !== \"\"),\n Arr.map((part) => ` [${part}]`),\n Arr.join(\"\"),\n );\n return `${file}:${error.lineNumber} ${Arr.join(error.ruleNames, \"/\")} ${error.ruleDescription}${detail}`;\n };\n\nconst optionsOf = (config: MarkdownlintConfig, files: readonly string[]): Options => ({\n files: [...files],\n ...pipe(\n Option.fromNullishOr(config.config),\n Option.match({ onNone: () => ({}), onSome: (rules) => ({ config: rules }) }),\n ),\n ...pipe(\n Option.fromNullishOr(config.customRules),\n Option.match({ onNone: () => ({}), onSome: (rules) => ({ customRules: [...rules] }) }),\n ),\n});\n\n/** @internal */\nexport const lintMarkdown: {\n (\n root: string,\n files: readonly string[],\n ): (config: MarkdownlintConfig) => Effect.Effect<Report, VpToolsError, Path.Path>;\n (\n config: MarkdownlintConfig,\n root: string,\n files: readonly string[],\n ): Effect.Effect<Report, VpToolsError, Path.Path>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n config: MarkdownlintConfig,\n root: string,\n files: readonly string[],\n ): Effect.Effect<Report, VpToolsError, Path.Path> =>\n Effect.gen(function* markdown() {\n const path = yield* Path.Path;\n const absolute = pipe(\n files,\n Arr.map((file) => path.join(root, file)),\n );\n const results = yield* attempt(\"markdownlint\")(() => lint(optionsOf(config, absolute)));\n const linesOf = ([file, errors]: readonly [\n string,\n readonly LintError[],\n ]): readonly string[] => {\n const format = formatError(path.relative(root, file));\n return pipe(errors, Arr.map(format));\n };\n const lines = pipe(Rec.toEntries(results), Arr.flatMap(linesOf));\n return { valid: Arr.isArrayEmpty(lines), output: Arr.join(lines, \"\\n\") };\n }),\n);\n","import type { TextlintRcConfig } from \"@textlint/config-loader\";\nimport type { TextlintKernelRule } from \"@textlint/kernel\";\nimport { normalizeTextlintPresetSubRuleKey } from \"@textlint/utils\";\nimport { Array as Arr, Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport type { TextlintConfig } from \"#/shared/config/index.ts\";\n\nconst NO_OPTIONS: Readonly<Record<string, unknown>> = {};\n\nconst isRuleOptions = Predicate.or(Predicate.isBoolean, Predicate.isReadonlyObject);\n\n/** @internal */\nexport const presetRulesOf = (config: TextlintConfig): TextlintKernelRule[] => {\n const settings = config.rules ?? {};\n return pipe(\n Rec.toEntries(config.presets ?? {}),\n Arr.filter(([name]) => Boolean(settings[name])),\n Arr.flatMap(([name, preset]) => {\n const userOptions = pipe(\n Option.liftPredicate(settings[name], Predicate.isReadonlyObject),\n Option.getOrElse(() => NO_OPTIONS),\n );\n return pipe(\n Rec.toEntries(preset.rules),\n Arr.map(([key, rule]) => ({\n ruleId: normalizeTextlintPresetSubRuleKey({ preset: name, rule: key }),\n rule,\n options: pipe(\n Rec.get(userOptions, key),\n Option.filter((value) => value !== true),\n Option.filter(isRuleOptions),\n Option.getOrElse(() => preset.rulesConfig[key] ?? true),\n ),\n })),\n Arr.filter(({ options }) => options !== false),\n );\n }),\n );\n};\n\n/** @internal */\nexport const rawConfigOf = (config: TextlintConfig): TextlintRcConfig => {\n const { ignores: _ignores, presets = {}, sources: _sources, ...rawConfig } = config;\n return {\n ...rawConfig,\n rules: pipe(\n rawConfig.rules ?? {},\n Rec.filter((_setting, name) => !Rec.has(presets, name)),\n ),\n };\n};\n","import { loadPackagesFromRawConfig } from \"@textlint/config-loader\";\nimport type { TextlintLoadPackagesFromRawConfigResult } from \"@textlint/config-loader\";\nimport { TextlintKernelDescriptor } from \"@textlint/kernel\";\nimport { Effect, Path, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport { createLinter, loadLinterFormatter } from \"textlint\";\nimport { builtInPlugins } from \"textlint/lib/src/loader/TextlintrcLoader.js\";\n\nimport type { TextlintConfig } from \"#/shared/config/index.ts\";\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport { toolFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport { presetRulesOf, rawConfigOf } from \"./textlint-presets.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst descriptorOf = (\n loaded: TextlintLoadPackagesFromRawConfigResult,\n root: string,\n config: TextlintConfig,\n): Effect.Effect<TextlintKernelDescriptor, VpToolsError> => {\n if (!loaded.ok) {\n return Effect.fail(toolFailed(\"textlint\")(loaded.error.message));\n }\n return Effect.succeed(\n new TextlintKernelDescriptor({\n rules: [...loaded.config.rules, ...presetRulesOf(config)],\n filterRules: loaded.config.filterRules,\n plugins: [...builtInPlugins, ...loaded.config.plugins],\n configBaseDir: root,\n }),\n );\n};\n\n/** @internal */\nexport const lintTexts: {\n (\n root: string,\n files: readonly string[],\n ): (config: TextlintConfig) => Effect.Effect<Report, VpToolsError, Path.Path>;\n (\n config: TextlintConfig,\n root: string,\n files: readonly string[],\n ): Effect.Effect<Report, VpToolsError, Path.Path>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n config: TextlintConfig,\n root: string,\n files: readonly string[],\n ): Effect.Effect<Report, VpToolsError, Path.Path> =>\n Effect.gen(function* lint() {\n const path = yield* Path.Path;\n yield* attempt(\"textlint\")(() => import(\"vite-plus/register\"));\n const loaded = yield* attempt(\"textlint\")(() =>\n loadPackagesFromRawConfig({\n rawConfig: rawConfigOf(config),\n node_moduleDir: path.join(root, \"node_modules\"),\n }),\n );\n const descriptor = yield* descriptorOf(loaded, root, config);\n const absolute = pipe(\n files,\n Arr.map((file) => path.join(root, file)),\n );\n const results = yield* attempt(\"textlint\")(() =>\n createLinter({ descriptor }).lintFiles([...absolute]),\n );\n const formatter = yield* attempt(\"textlint\")(() =>\n loadLinterFormatter({ formatterName: \"stylish\", color: false }),\n );\n return {\n valid: pipe(\n results,\n Arr.every((result) => Arr.isArrayEmpty(result.messages)),\n ),\n output: formatter.format(results),\n };\n }),\n);\n","import { Effect, Array as Arr, String as Str, pipe } from \"effect\";\n\nimport { withSection } from \"#/entities/check/index.ts\";\nimport { listCommitMessages, listGitFiles } from \"#/shared/lib/git.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport { lintCommitMessages } from \"./commitlint.ts\";\nimport { lintMarkdown } from \"./markdownlint.ts\";\nimport { lintTexts } from \"./textlint.ts\";\n\nconst MARKDOWN = \"*.md\";\n\nconst GLOB_PATHSPEC = \":(glob)\";\n\nconst markdownFiles = (\n root: string,\n ignores: readonly string[] = [],\n): ReturnType<typeof listGitFiles> =>\n listGitFiles(root, [\n MARKDOWN,\n ...pipe(\n ignores,\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n ]);\n\nconst sourceFiles = (root: string, files: readonly string[]): ReturnType<typeof listGitFiles> =>\n listGitFiles(\n root,\n pipe(\n files,\n Arr.map((glob) => `${GLOB_PATHSPEC}${glob}`),\n ),\n );\n\nconst mergeReports = (reports: readonly Report[]): Report => ({\n valid: pipe(\n reports,\n Arr.every((report) => report.valid),\n ),\n output: pipe(\n reports,\n Arr.map((report) => report.output),\n Arr.filter(Str.isNonEmpty),\n Arr.join(\"\\n\"),\n ),\n});\n\n/** @internal */\nexport const textlintCheck = withSection(\"textlint\", (config, { root }) => {\n const markdown = markdownFiles(root, config.ignores).pipe(\n Effect.flatMap((files) => lintTexts(config, root, files)),\n );\n const presets = config.presets ?? {};\n const sources = pipe(\n config.sources ?? [],\n Arr.map(({ files, ...source }) =>\n Effect.flatMap(sourceFiles(root, files), (listed) =>\n lintTexts({ ...source, presets }, root, listed),\n ),\n ),\n );\n return Effect.all([markdown, ...sources], { concurrency: 1 }).pipe(Effect.map(mergeReports));\n});\n\n/** @internal */\nexport const markdownlintCheck = withSection(\"markdownlint\", (config, { root }) =>\n markdownFiles(root, config.ignores).pipe(\n Effect.flatMap((files) => lintMarkdown(config, root, files)),\n ),\n);\n\n/** @internal */\nexport const commitlintCheck = withSection(\"commitlint\", (config, { root, base }) =>\n listCommitMessages(root, `${base}..HEAD`).pipe(\n Effect.flatMap((messages) => lintCommitMessages(config, root, messages)),\n ),\n);\n","import { Array as Arr, pipe } from \"effect\";\nimport { stringify } from \"smol-toml\";\n\nimport type { BetterleaksConfig } from \"#/shared/config/index.ts\";\n\nexport const toBetterleaksToml = (config: BetterleaksConfig): string => {\n const { ignoredSecrets: _ignoredSecrets, ...rest } = config;\n return stringify(rest);\n};\n\nexport const toIgnoreFile = (config: BetterleaksConfig): string =>\n pipe(\n config.ignoredSecrets ?? [],\n Arr.map((digest) => `${digest}\\n`),\n Arr.join(\"\"),\n );\n","import { Effect, FileSystem, Function as Fn, String as Str } from \"effect\";\nimport type { PlatformError, Scope } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { BETTERLEAKS, runVendored } from \"#/entities/binary/index.ts\";\nimport type { CheckError, CheckServices } from \"#/entities/check/index.ts\";\nimport { withSection } from \"#/entities/check/index.ts\";\nimport type { BetterleaksConfig } from \"#/shared/config/index.ts\";\nimport { toolFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport { toBetterleaksToml, toIgnoreFile } from \"./betterleaks.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst ignoreFileArgs = (\n config: BetterleaksConfig,\n): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError,\n FileSystem.FileSystem | Scope.Scope\n> =>\n Effect.gen(function* ignoreFile() {\n const digests = toIgnoreFile(config);\n if (digests === \"\") {\n return [];\n }\n const fs = yield* FileSystem.FileSystem;\n const file = yield* fs.makeTempFileScoped({ prefix: \"betterleaksignore-\" });\n yield* fs.writeFileString(file, digests);\n return [\"--ignore-file\", file];\n });\n\nconst scanSecrets = ({\n config,\n root,\n args,\n input,\n}: {\n readonly config: BetterleaksConfig;\n readonly root: string;\n readonly args: readonly string[];\n readonly input?: string;\n}): Effect.Effect<Report, CheckError, CheckServices> =>\n Effect.gen(function* scan() {\n const ignore = yield* ignoreFileArgs(config);\n return yield* runVendored(BETTERLEAKS, {\n root,\n args: [...args, \"--redact\", \"--no-banner\", ...ignore],\n env: { BETTERLEAKS_CONFIG_TOML: toBetterleaksToml(config) },\n input,\n });\n }).pipe(Effect.scoped);\n\nconst SUCCESS = 0;\n\nconst lacksHistory = (\n root: string,\n): Effect.Effect<boolean, PlatformError.PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* history() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const shallow = yield* spawner.string(\n ChildProcess.make(\"git\", [\"rev-parse\", \"--is-shallow-repository\"], { cwd: root }),\n );\n const promisor = yield* spawner.exitCode(\n ChildProcess.make(\"git\", [\"config\", \"--get\", \"remote.origin.promisor\"], { cwd: root }),\n );\n return Str.trim(shallow) === \"true\" || promisor === SUCCESS;\n });\n\nconst succeeded = <Failure, Services>(\n tool: string,\n run: Effect.Effect<number, Failure, Services>,\n): Effect.Effect<void, Failure | VpToolsError, Services> =>\n run.pipe(\n Effect.flatMap((code) => {\n if (code === SUCCESS) {\n return Effect.void;\n }\n return Effect.fail(toolFailed(tool)(`exit code ${code}`));\n }),\n );\n\nconst scanCommittedTree = (\n config: BetterleaksConfig,\n root: string,\n): Effect.Effect<Report, CheckError, CheckServices> =>\n Effect.gen(function* tree() {\n const fs = yield* FileSystem.FileSystem;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"vpa-betterleaks-\" });\n const archive = `${directory}.tar`;\n yield* succeeded(\n \"git archive\",\n spawner.exitCode(\n ChildProcess.make(\"git\", [\"archive\", \"--format=tar\", \"-o\", archive, \"HEAD\"], { cwd: root }),\n ),\n );\n yield* succeeded(\n \"tar\",\n spawner.exitCode(ChildProcess.make(\"tar\", [\"-xf\", archive, \"-C\", directory])),\n );\n yield* fs.remove(archive);\n return yield* scanSecrets({ config, root, args: [directory] });\n }).pipe(Effect.scoped);\n\n/** @internal */\nexport const betterleaksCheck = withSection(\"betterleaks\", (config, { root, base }) =>\n lacksHistory(root).pipe(\n Effect.flatMap((partial) => {\n if (partial) {\n return scanCommittedTree(config, root);\n }\n return scanSecrets({ config, root, args: [\"git\", \".\", `--revision=${base}..HEAD`] });\n }),\n ),\n);\n\nconst STAGED_DIFF = [\n \"diff\",\n \"--cached\",\n \"--no-ext-diff\",\n \"--no-textconv\",\n \"--no-color\",\n \"--src-prefix=a/\",\n \"--dst-prefix=b/\",\n];\n\n/** @internal */\nexport const scanStagedSecrets: {\n (root: string): (config: BetterleaksConfig) => Effect.Effect<Report, CheckError, CheckServices>;\n (config: BetterleaksConfig, root: string): Effect.Effect<Report, CheckError, CheckServices>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (config: BetterleaksConfig, root: string): Effect.Effect<Report, CheckError, CheckServices> =>\n Effect.gen(function* staged() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const diff = yield* spawner.string(ChildProcess.make(\"git\", STAGED_DIFF, { cwd: root }));\n return yield* scanSecrets({ config, root, args: [\"stdin\", \"--git-diff\"], input: diff });\n }),\n);\n","import { findWorkspaceProjectsNoCheck } from \"@pnpm/workspace.projects-reader\";\nimport { readWorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-reader\";\nimport {\n Array as Arr,\n Effect,\n Option,\n Order,\n Path,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { attempt } from \"./attempt.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\n\nconst DEPENDENCY_FIELDS = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n] as const;\n\nconst MANIFEST_FILE = \"package.json\";\n\n/** @internal */\nexport type DependencyField = (typeof DEPENDENCY_FIELDS)[number];\n\n/** @internal */\nexport interface Dependency {\n readonly manifest: string;\n readonly field: DependencyField;\n readonly name: string;\n readonly specifier: string;\n}\n\ntype DeclaredDependencies = Readonly<\n Partial<Record<DependencyField, Readonly<Record<string, string>>>>\n>;\n\ninterface ListedManifest {\n readonly file: string;\n readonly dependencies: readonly Dependency[];\n}\n\nconst pnpm = attempt(\"pnpm\");\n\nconst byFile = Order.mapInput(Str.Order, ({ file }: ListedManifest) => file);\n\nconst manifestIn = (directory: string): string =>\n pipe(\n Option.liftPredicate(directory, Str.isNonEmpty),\n Option.map((own) => `${own}/${MANIFEST_FILE}`),\n Option.getOrElse(() => MANIFEST_FILE),\n );\n\nconst dependenciesIn = (file: string, declared: DeclaredDependencies): readonly Dependency[] =>\n pipe(\n DEPENDENCY_FIELDS,\n Arr.flatMap((field) => {\n const entries = Rec.toEntries(\n Option.getOrElse(Option.fromUndefinedOr(declared[field]), () => ({})),\n );\n return pipe(\n entries,\n Arr.map(([name, specifier]): Dependency => ({ manifest: file, field, name, specifier })),\n );\n }),\n );\n\n/** @internal */\nexport const listDependencies = (\n root: string,\n): Effect.Effect<readonly Dependency[], VpToolsError, Path.Path> =>\n Effect.gen(function* list() {\n const path = yield* Path.Path;\n const workspace = yield* pnpm(() => readWorkspaceManifest(root));\n const patterns = pipe(\n Option.fromUndefinedOr(workspace),\n Option.flatMap(({ packages }) => Option.fromNullishOr(packages)),\n Option.getOrElse((): string[] => []),\n );\n const projects = yield* pnpm(() => findWorkspaceProjectsNoCheck(root, { patterns }));\n const listed = pipe(\n projects,\n Arr.map(({ rootDir, manifest }): ListedManifest => {\n const file = manifestIn(path.relative(root, rootDir));\n return { file, dependencies: dependenciesIn(file, manifest) };\n }),\n );\n return pipe(\n Arr.sort(listed, byFile),\n Arr.flatMap(({ dependencies }) => dependencies),\n );\n });\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n Function as Fn,\n} from \"effect\";\nimport { minimatch } from \"minimatch\";\nimport { intersects, valid, validRange } from \"semver\";\n\nimport type { AllowedDependencies, DependencyRules } from \"#/shared/config/index.ts\";\nimport type { Dependency } from \"#/shared/lib/workspace.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst SINGLE = 1;\n\nconst bannedBy =\n (dependencies: readonly Dependency[]) =>\n ([reason, globs]: readonly [string, readonly string[]]): readonly string[] => {\n const isBanned = (name: string): boolean =>\n pipe(\n globs,\n Arr.some((glob) => minimatch(name, glob)),\n );\n return pipe(\n dependencies,\n Arr.filter((dependency) => isBanned(dependency.name)),\n Arr.map(\n (dependency) =>\n `${dependency.manifest} ${dependency.field}.${dependency.name} is banned: ${reason}`,\n ),\n );\n };\n\nconst MANIFEST = \"package.json\";\n\nconst matchesAny =\n (globs: readonly string[]) =>\n (value: string): boolean =>\n pipe(\n globs,\n Arr.some((glob) => minimatch(value, glob)),\n );\n\nconst inWorkspace =\n (globs: readonly string[]) =>\n (dependency: Dependency): boolean =>\n pipe(\n globs,\n Arr.some((glob) => minimatch(dependency.manifest, `${glob}/${MANIFEST}`)),\n );\n\nconst inFields =\n (fields: AllowedDependencies[\"fields\"]) =>\n (dependency: Dependency): boolean =>\n pipe(\n Option.fromNullishOr(fields),\n Option.match({\n onNone: () => true,\n onSome: (names) => Arr.contains(names, dependency.field),\n }),\n );\n\nconst allowedBy =\n (dependency: Dependency) =>\n ({ workspaces, dependencies, fields }: AllowedDependencies): boolean =>\n inWorkspace(workspaces)(dependency) &&\n matchesAny(dependencies)(dependency.name) &&\n inFields(fields)(dependency);\n\nconst isAllowed =\n (rules: DependencyRules) =>\n (dependency: Dependency): boolean =>\n pipe(Rec.values(rules.allowed ?? {}), Arr.some(allowedBy(dependency)));\n\nconst bannedProblems = (\n rules: DependencyRules,\n dependencies: readonly Dependency[],\n): readonly string[] => {\n const allowed = isAllowed(rules);\n const checked = pipe(dependencies, Arr.filter(Predicate.not(allowed)));\n return pipe(Rec.toEntries(rules.banned ?? {}), Arr.flatMap(bannedBy(checked)));\n};\n\nconst inWorkspaces =\n (globs: readonly string[]) =>\n (dependency: Dependency): boolean =>\n dependency.field === \"dependencies\" && inWorkspace(globs)(dependency);\n\nconst exactGlobs = (rules: DependencyRules): readonly string[] =>\n pipe(Rec.values(rules.exactDependencies ?? {}), Arr.flatten);\n\nconst notExactBy =\n (dependencies: readonly Dependency[]) =>\n ([reason, globs]: readonly [string, readonly string[]]): readonly string[] =>\n pipe(\n dependencies,\n Arr.filter(inWorkspaces(globs)),\n Arr.filter((dependency) => valid(dependency.specifier) === null),\n Arr.map(\n (dependency) =>\n `${dependency.manifest} dependencies.${dependency.name} must be an exact version: ${reason}`,\n ),\n );\n\nconst exactProblems = (\n rules: DependencyRules,\n dependencies: readonly Dependency[],\n): readonly string[] =>\n pipe(Rec.toEntries(rules.exactDependencies ?? {}), Arr.flatMap(notExactBy(dependencies)));\n\nconst groupByName = (dependencies: readonly Dependency[]): readonly (readonly Dependency[])[] =>\n Rec.values(Arr.groupBy(dependencies, ({ name }) => name));\n\nconst describe = (dependencies: readonly Dependency[]): string => {\n const name = pipe(\n Arr.head(dependencies),\n Option.match({ onNone: () => \"\", onSome: (dependency) => dependency.name }),\n );\n const uses = pipe(\n dependencies,\n Arr.map((dependency) => `${dependency.manifest} ${dependency.field} ${dependency.specifier}`),\n Arr.join(\", \"),\n );\n return `${name}: ${uses}`;\n};\n\nconst mismatchProblems = (dependencies: readonly Dependency[]): readonly string[] =>\n pipe(\n groupByName(dependencies),\n Arr.filter(\n (group) =>\n new Set(\n pipe(\n group,\n Arr.map(({ specifier }) => specifier),\n ),\n ).size > SINGLE,\n ),\n Arr.map((group) => `different specifiers for ${describe(group)}`),\n );\n\nconst isDisjoint = (ranges: readonly Dependency[]): boolean =>\n pipe(\n ranges,\n Arr.some((left) =>\n pipe(\n ranges,\n Arr.some((right) => !intersects(left.specifier, right.specifier)),\n ),\n ),\n );\n\nconst disjointRangeProblems = (peers: readonly Dependency[]): readonly string[] =>\n pipe(\n groupByName(peers),\n Arr.map((group) =>\n pipe(\n group,\n Arr.filter(({ specifier }) => validRange(specifier) !== null),\n ),\n ),\n Arr.filter(isDisjoint),\n Arr.map((ranges) => `peer ranges do not intersect for ${describe(ranges)}`),\n );\n\nconst isPeer = ({ field }: Dependency): boolean => field === \"peerDependencies\";\n\nconst versionProblems = (\n rules: DependencyRules,\n pinned: readonly Dependency[],\n): readonly string[] => {\n if (rules.peerRanges !== \"intersect\") {\n return mismatchProblems(pinned);\n }\n const others = pipe(pinned, Arr.filter(Predicate.not(isPeer)));\n const peers = pipe(pinned, Arr.filter(isPeer));\n return [...mismatchProblems(others), ...disjointRangeProblems(peers)];\n};\n\nconst comparedDependencies = (\n rules: DependencyRules,\n dependencies: readonly Dependency[],\n): readonly Dependency[] => {\n const isExact = inWorkspaces(exactGlobs(rules));\n return pipe(\n dependencies,\n Arr.filter(({ specifier }) => !Str.startsWith(\"workspace:\")(specifier)),\n Arr.filter(Predicate.not(isExact)),\n );\n};\n\nexport const checkDependencies: {\n (dependencies: readonly Dependency[]): (rules: DependencyRules) => readonly string[];\n (rules: DependencyRules, dependencies: readonly Dependency[]): readonly string[];\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (rules: DependencyRules, dependencies: readonly Dependency[]): readonly string[] => [\n ...bannedProblems(rules, dependencies),\n ...exactProblems(rules, dependencies),\n ...versionProblems(rules, comparedDependencies(rules, dependencies)),\n ],\n);\n","import { Effect, Path, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport { linter, processConfiguration } from \"steiger\";\n\nimport type { SteigerConfig } from \"#/shared/config/index.ts\";\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface Diagnostic {\n readonly severity: string;\n readonly message: string;\n readonly ruleName: string;\n readonly location: { readonly path: string };\n}\n\nconst formatDiagnostic =\n (relative: (file: string) => string) =>\n (diagnostic: Diagnostic): string =>\n `${diagnostic.severity} ${relative(diagnostic.location.path)}: ${diagnostic.message} (${diagnostic.ruleName})`;\n\nconst reportOf = (\n diagnostics: readonly Diagnostic[],\n relative: (file: string) => string,\n): Report => ({\n valid: pipe(\n diagnostics,\n Arr.every((diagnostic) => diagnostic.severity !== \"error\"),\n ),\n output: pipe(diagnostics, Arr.map(formatDiagnostic(relative)), Arr.join(\"\\n\")),\n});\n\n/** @internal */\nexport const checkSlices: {\n (\n root: string,\n targets: readonly string[],\n ): (config: SteigerConfig) => Effect.Effect<Report, VpToolsError, Path.Path>;\n (\n config: SteigerConfig,\n root: string,\n targets: readonly string[],\n ): Effect.Effect<Report, VpToolsError, Path.Path>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n config: SteigerConfig,\n root: string,\n targets: readonly string[],\n ): Effect.Effect<Report, VpToolsError, Path.Path> =>\n Effect.gen(function* check() {\n const path = yield* Path.Path;\n processConfiguration([...config], root);\n const perTarget = yield* Effect.forEach(\n targets,\n (target) => attempt(\"steiger\")(() => linter.run(path.resolve(root, target))),\n { concurrency: 1 },\n );\n return reportOf(Arr.flatten(perTarget), (file) => path.relative(root, file));\n }),\n);\n","import { Effect, Array as Arr, String as Str, pipe } from \"effect\";\nimport { minimatch } from \"minimatch\";\n\nimport { withSection } from \"#/entities/check/index.ts\";\nimport { listGitFiles } from \"#/shared/lib/git.ts\";\nimport { listDependencies } from \"#/shared/lib/workspace.ts\";\n\nimport { checkDependencies } from \"./dependency-rules.ts\";\nimport { checkSlices } from \"./steiger.ts\";\n\nconst LAYER_FOLDER = /\\/(?:app|pages|widgets|features|entities|shared)\\//gu;\n\nconst layeredDirectories = (\n root: string,\n patterns: readonly string[],\n): ReturnType<typeof listGitFiles> =>\n listGitFiles(root, []).pipe(\n Effect.map((files) =>\n pipe(\n files,\n Arr.flatMap((file) =>\n Arr.map(Arr.fromIterable(Str.matchAll(LAYER_FOLDER)(file)), ({ index }) =>\n Str.takeLeft(file, index ?? file.length),\n ),\n ),\n Arr.dedupe,\n Arr.filter((directory) =>\n pipe(\n patterns,\n Arr.some((pattern) => minimatch(directory, pattern)),\n ),\n ),\n ),\n ),\n );\n\n/** @internal */\nexport const steigerCheck = withSection(\"steiger\", (section, { root }) =>\n layeredDirectories(root, section.paths).pipe(\n Effect.flatMap((targets) => checkSlices(section.rules, root, targets)),\n ),\n);\n\n/** @internal */\nexport const dependenciesCheck = withSection(\"dependencyRules\", (rules, { root }) =>\n listDependencies(root).pipe(\n Effect.map((dependencies) => {\n const problems = checkDependencies(rules, dependencies);\n return { valid: Arr.isReadonlyArrayEmpty(problems), output: Arr.join(problems, \"\\n\") };\n }),\n ),\n);\n","import { Config, Effect, FileSystem, Option, Path, pipe } from \"effect\";\n\nimport { ACTIONLINT, ZIZMOR, runVendored } from \"#/entities/binary/index.ts\";\nimport type { Binary } from \"#/entities/binary/index.ts\";\nimport type { Check } from \"#/entities/check/index.ts\";\n\nconst WORKFLOWS = \".github/workflows\";\n\nconst onWorkflows =\n (binary: Binary, args: Effect.Effect<readonly string[]>): Check =>\n ({ root }) =>\n Effect.gen(function* workflows() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n if (!(yield* fs.exists(path.join(root, WORKFLOWS)))) {\n return Option.none();\n }\n const resolvedArgs = yield* args;\n const ran = yield* runVendored(binary, { root, args: resolvedArgs });\n return Option.some(ran);\n });\n\n/** @internal */\nexport const actionlintCheck = onWorkflows(ACTIONLINT, Effect.succeed([]));\n\nconst zizmorArgs = Effect.gen(function* zizmorArgs() {\n const remote = yield* Config.option(Config.String(\"CLAUDE_CODE_REMOTE\")).pipe(Effect.orDie);\n return pipe(\n remote,\n Option.match({\n onNone: () => [\".github\"],\n onSome: () => [\"--no-online-audits\", \".github\"],\n }),\n );\n});\n\n/** @internal */\nexport const zizmorCheck = onWorkflows(ZIZMOR, zizmorArgs);\n","import { Effect, FileSystem, Path, Schema, Array as Arr, pipe } from \"effect\";\n\nimport type { CheckError, CheckServices } from \"#/entities/check/index.ts\";\nimport { withSection } from \"#/entities/check/index.ts\";\nimport type { FallowConfig } from \"#/shared/config/index.ts\";\nimport { toJson } from \"#/shared/lib/json.ts\";\nimport { runCaptured } from \"#/shared/lib/process.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nconst QUIET = [\"--fail-on-issues\", \"--quiet\", \"--format\", \"compact\"];\n\nconst RUNS: readonly (readonly string[])[] = [\n [\"--skip\", \"dupes\", ...QUIET],\n [\"dead-code\", \"--no-production\", ...QUIET],\n [\"dupes\", ...QUIET],\n [\"security\", \"--fail-on-issues\", \"--quiet\"],\n];\n\nconst SMELLS = Schema.Array(Schema.Unknown).pipe(Schema.withDecodingDefaultKey(Effect.succeed([])));\n\nconst COMPONENT_SMELLS = Schema.Struct({\n prop_drilling_chains: SMELLS,\n thin_wrappers: SMELLS,\n duplicate_prop_shapes: SMELLS,\n});\n\nconst decodeSmells = Schema.decodeUnknownEffect(Schema.fromJsonString(COMPONENT_SMELLS));\n\nconst componentSmells = (\n root: string,\n configFile: string,\n): Effect.Effect<Report, CheckError, CheckServices> =>\n runCaptured({\n root,\n file: \"fallow\",\n args: [\"dead-code\", \"--no-production\", \"--quiet\", \"--format\", \"json\", \"-c\", configFile],\n output: \"stdout\",\n }).pipe(\n Effect.flatMap((report) => decodeSmells(report.output)),\n Effect.map((smells) => {\n const found = [\n ...smells.prop_drilling_chains,\n ...smells.thin_wrappers,\n ...smells.duplicate_prop_shapes,\n ];\n return {\n valid: Arr.isReadonlyArrayEmpty(found),\n output: toJson(smells),\n };\n }),\n );\n\nconst runFallow = (\n config: FallowConfig,\n root: string,\n): Effect.Effect<Report, CheckError, CheckServices> =>\n Effect.gen(function* fallow() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"vpa-fallow-\" });\n const configFile = path.join(directory, \".fallowrc.json\");\n const configText = yield* Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown))(\n config,\n ).pipe(Effect.orDie);\n yield* fs.writeFileString(configFile, configText);\n const reports = yield* Effect.forEach(\n RUNS,\n (args) => runCaptured({ root, file: \"fallow\", args: [...args, \"-c\", configFile] }),\n { concurrency: 1 },\n );\n const smells = yield* componentSmells(root, configFile);\n const all = [...reports, smells];\n return {\n valid: pipe(\n all,\n Arr.every((report) => report.valid),\n ),\n output: pipe(\n all,\n Arr.filter((report) => !report.valid),\n Arr.map((report) => report.output),\n Arr.join(\"\\n\"),\n ),\n };\n }).pipe(Effect.scoped);\n\n/** @internal */\nexport const fallowCheck = withSection(\"fallow\", (config, { root }) => runFallow(config, root));\n","import type { NamedCheck } from \"#/entities/check/index.ts\";\nimport { dependenciesCheck, steigerCheck } from \"#/features/check-repository/index.ts\";\nimport { actionlintCheck, zizmorCheck } from \"#/features/check-workflows/index.ts\";\nimport { commitlintCheck, markdownlintCheck, textlintCheck } from \"#/features/lint-text/index.ts\";\nimport { fallowCheck } from \"#/features/run-fallow/index.ts\";\nimport { betterleaksCheck } from \"#/features/scan-secrets/index.ts\";\n\nexport const CHECKS: readonly NamedCheck[] = [\n { name: \"betterleaks\", run: betterleaksCheck },\n { name: \"commitlint\", run: commitlintCheck },\n { name: \"actionlint\", run: actionlintCheck },\n { name: \"zizmor\", run: zizmorCheck },\n { name: \"dependencies\", run: dependenciesCheck },\n { name: \"steiger\", run: steigerCheck },\n { name: \"textlint\", run: textlintCheck },\n { name: \"markdownlint\", run: markdownlintCheck },\n { name: \"fallow\", run: fallowCheck },\n];\n","import type { Stdio } from \"effect\";\nimport { Config, Effect, Option, Array as Arr, pipe } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport type {\n CheckContext,\n CheckError,\n CheckServices,\n NamedCheck,\n} from \"#/entities/check/index.ts\";\nimport { loadViteConfig } from \"#/entities/vite-config/index.ts\";\nimport { checksFailed } from \"#/shared/lib/errors.ts\";\nimport { writeTo } from \"#/shared/lib/output.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport { CHECKS } from \"./checks.ts\";\n\nconst DEFAULT_BASE = \"origin/main\";\nconst RESOLVED = 0;\n\nconst isCommit = (\n root: string,\n revision: string,\n): Effect.Effect<boolean, never, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* verify() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"git\", [\"rev-parse\", \"-q\", \"--verify\", `${revision}^{commit}`], {\n cwd: root,\n }),\n );\n return exitCode === RESOLVED;\n }).pipe(Effect.orElseSucceed(() => false));\n\nconst resolveBase = (\n root: string,\n): Effect.Effect<string, never, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* base() {\n const configured = yield* Config.option(Config.String(\"VPA_BASE\")).pipe(Effect.orDie);\n if (Option.isSome(configured) && (yield* isCommit(root, configured.value))) {\n return configured.value;\n }\n return DEFAULT_BASE;\n });\n\ninterface Outcome {\n readonly name: string;\n readonly report: Report;\n}\n\nconst describe = ({ name, report }: Outcome): string => {\n if (report.valid) {\n return `✓ ${name}`;\n }\n return `✗ ${name}\\n${report.output}`;\n};\n\nconst runCheck =\n (context: CheckContext) =>\n ({ name, run }: NamedCheck): Effect.Effect<Option.Option<Outcome>, CheckError, CheckServices> =>\n run(context).pipe(Effect.map(Option.map((report) => ({ name, report }))));\n\n/** @internal */\nexport const runAllChecks = (\n root: string,\n): Effect.Effect<void, CheckError, CheckServices | Stdio.Stdio> =>\n Effect.gen(function* all() {\n const config = yield* loadViteConfig(root);\n const base = yield* resolveBase(root);\n const outcomes = yield* pipe(\n CHECKS,\n Effect.forEach(runCheck({ root, config, base }), { concurrency: \"unbounded\" }),\n Effect.map(Arr.getSomes),\n );\n yield* writeTo(\"stdout\", `${pipe(outcomes, Arr.map(describe), Arr.join(\"\\n\"))}\\n`);\n return yield* pipe(\n outcomes,\n Arr.filter(({ report }) => !report.valid),\n Arr.map(({ name }) => name),\n Arr.match({\n onEmpty: () => Effect.void,\n onNonEmpty: (failed) => Effect.fail(checksFailed(`Failed: ${Arr.join(failed, \", \")}`)),\n }),\n );\n });\n","import {\n Effect,\n FileSystem,\n Layer,\n Option,\n Array as Arr,\n Record as Rec,\n pipe,\n Function as Fn,\n} from \"effect\";\nimport type { PlatformError, Stdio } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport { loadSection } from \"#/entities/vite-config/index.ts\";\nimport { installSkills } from \"#/features/install-skills/index.ts\";\nimport { lintCommitMessages } from \"#/features/lint-text/index.ts\";\nimport { scanStagedSecrets } from \"#/features/scan-secrets/index.ts\";\nimport type { CommandEffect } from \"#/shared/lib/command.ts\";\nimport { checksFailed } from \"#/shared/lib/errors.ts\";\nimport { finish, writeTo } from \"#/shared/lib/output.ts\";\n\nimport { runAllChecks } from \"./run-checks.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst USAGE = pipe(\n [\n \"Usage: vpa run every check configured in vite.config.ts\",\n \" vpa --prepare install the skills in vite.config.ts into .agents/skills (prepare)\",\n \" vpa --staged scan the staged changes for secrets (pre-commit)\",\n \" vpa --commit-msg <file> lint a commit message (commit-msg)\",\n \" vpa --message <text> lint a message\",\n ],\n Arr.join(\"\\n\"),\n);\n\nconst usage: CommandEffect = Effect.fail(checksFailed(USAGE));\n\nconst stagedSecrets = (root: string): CommandEffect =>\n loadSection(root, \"betterleaks\").pipe(\n Effect.flatMap((config) => scanStagedSecrets(config, root)),\n Effect.flatMap(finish),\n );\n\nconst lintMessage =\n (\n toMessage: (\n argument: string,\n ) => Effect.Effect<string, PlatformError.PlatformError, FileSystem.FileSystem>,\n ) =>\n (root: string, rest: readonly string[]): CommandEffect =>\n pipe(\n Arr.head(rest),\n Option.match({\n onNone: () => usage,\n onSome: (argument) =>\n Effect.gen(function* lintGiven() {\n const message = yield* toMessage(argument);\n const config = yield* loadSection(root, \"commitlint\");\n const report = yield* lintCommitMessages(config, root, [message]);\n return yield* finish(report);\n }),\n }),\n );\n\nconst readMessage = (\n file: string,\n): Effect.Effect<string, PlatformError.PlatformError, FileSystem.FileSystem> =>\n FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)));\n\nconst reportLinked = Option.match({\n onNone: (): Effect.Effect<void, never, Stdio.Stdio> => Effect.void,\n onSome: (count: number) => writeTo(\"stdout\", `Linked ${count} skills into .agents/skills\\n`),\n});\n\nconst prepare = (root: string): CommandEffect =>\n Layer.build(FetchHttpClient.layer).pipe(\n Effect.flatMap((context) => Effect.provideContext(installSkills(root), context)),\n Effect.flatMap(reportLinked),\n Effect.scoped,\n );\n\nconst HOOKS: Readonly<Record<string, (root: string, rest: readonly string[]) => CommandEffect>> = {\n \"--prepare\": prepare,\n \"--staged\": stagedSecrets,\n \"--commit-msg\": lintMessage(readMessage),\n \"--message\": lintMessage(Effect.succeed),\n};\n\n/** @internal */\nexport const runVpa: {\n (args: readonly string[]): (root: string) => CommandEffect;\n (root: string, args: readonly string[]): CommandEffect;\n} = Fn.dual(DATA_FIRST_ARITY, (root: string, args: readonly string[]): CommandEffect =>\n pipe(\n args,\n Arr.match({\n onEmpty: () => runAllChecks(root),\n onNonEmpty: ([flag, ...rest]) =>\n pipe(\n Rec.get(HOOKS, flag),\n Option.match({ onNone: () => usage, onSome: (hook) => hook(root, rest) }),\n ),\n }),\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,eAAe;CAAC;CAAkB;CAAmB;CAAkB;AAAiB;AAE9F,MAAM,kBAAkB,SACtB,OAAO,IAAI,UAAU,OAAO;CAC1B,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,WAAW,OAAO,KACtB,cACAA,MAAI,KAAK,SAAS,KAAK,KAAK,MA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AAI,IAAI,OAAO,IAAI,GACnB,OAAO,MAAM;EAAE,cAAc;EAAO,SAAS,SAAS,KAAK,MAAM,IAAI;CAAE,CAAC,CAC1E;AACJ,CAAC,CACH,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/vite-plus-adopt",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Adopt Betterleaks, actionlint, zizmor, commitlint, textlint, Steiger and dependency checks into Vite+ through the settings in vite.config.ts, and ship the Feature-Sliced Design Steiger plugin and @arethetypeswrong/core for TypeScript 7.",
5
5
  "keywords": [
6
6
  "actionlint",
@@ -10,6 +10,7 @@
10
10
  "commitlint",
11
11
  "feature-sliced",
12
12
  "steiger",
13
+ "tanstack-intent",
13
14
  "textlint",
14
15
  "vite-plus",
15
16
  "zizmor"
@@ -28,8 +29,9 @@
28
29
  "vpa": "./dist/cli.mjs"
29
30
  },
30
31
  "files": [
32
+ "THIRD-PARTY-NOTICES",
31
33
  "dist",
32
- "THIRD-PARTY-NOTICES"
34
+ "skills/configure-checks"
33
35
  ],
34
36
  "type": "module",
35
37
  "imports": {
@@ -63,8 +65,12 @@
63
65
  "@commitlint/types": "21.2.3",
64
66
  "@effect/platform-node-shared": "4.1.4",
65
67
  "@loaderkit/resolve": "1.0.6",
68
+ "@pnpm/logger": "1100.0.0",
69
+ "@pnpm/workspace.projects-reader": "1101.1.7",
70
+ "@pnpm/workspace.workspace-manifest-reader": "1100.3.2",
66
71
  "@textlint/config-loader": "15.8.0",
67
72
  "@textlint/kernel": "15.8.0",
73
+ "@textlint/utils": "15.8.0",
68
74
  "cjs-module-lexer": "2.3.0",
69
75
  "fastest-levenshtein": "^1.0.16",
70
76
  "fflate": "^0.8.3",
@@ -108,7 +114,7 @@
108
114
  "!dist/fsd.mjs",
109
115
  "!dist/attw.mjs"
110
116
  ],
111
- "limit": "11565 B"
117
+ "limit": "15470 B"
112
118
  },
113
119
  {
114
120
  "name": "fsd",
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: configure-checks
3
+ description: >
4
+ Use when configuring or running the vpa CLI of @r_masseater/vite-plus-adopt in a Vite+ repository:
5
+ the betterleaks, commitlint, textlint, markdownlint, steiger, fallow and dependencyRules sections of
6
+ vite.config.ts, git hooks, the bundled Feature-Sliced Design Steiger plugin and the
7
+ @arethetypeswrong/core replacement for pack.attw. Also use when a vpa check fails.
8
+ metadata:
9
+ type: core
10
+ library: "@r_masseater/vite-plus-adopt"
11
+ library_version: 0.8.1
12
+ sources:
13
+ - src/app/**
14
+ - src/features/**
15
+ - src/shared/config/types.ts
16
+ - README.md
17
+ ---
18
+
19
+ # configure-checks
20
+
21
+ `vpa` runs the checks that the sections of `vite.config.ts` configure.
22
+ They cover secrets with Betterleaks and workflows with actionlint and zizmor.
23
+ They also run commitlint, textlint and markdownlint.
24
+ Steiger, fallow and the dependency rules check the code.
25
+ Run without arguments, it runs every configured check in parallel and prints the results together.
26
+
27
+ ## Setup
28
+
29
+ 1. Install it and allow its postinstall, which fetches the tool binaries.
30
+
31
+ ```sh
32
+ vp add -D @r_masseater/vite-plus-adopt
33
+ ```
34
+
35
+ ```yaml
36
+ allowBuilds:
37
+ "@r_masseater/vite-plus-adopt": true
38
+ ```
39
+
40
+ 2. Write the sections. `import type {} from "@r_masseater/vite-plus-adopt"` types them in `defineConfig`.
41
+
42
+ ```ts
43
+ import type {} from "@r_masseater/vite-plus-adopt";
44
+ import fsd from "@r_masseater/vite-plus-adopt/fsd";
45
+ import { defineConfig } from "vite-plus";
46
+
47
+ export default defineConfig({
48
+ commitlint: { extends: ["@commitlint/config-conventional"] },
49
+ dependencyRules: {
50
+ banned: { "Tests import from vite-plus/test": ["vitest", "@vitest/*"] },
51
+ peerRanges: "intersect",
52
+ },
53
+ betterleaks: { extend: { useDefault: true } },
54
+ steiger: { paths: ["apps/*/src"], rules: [...fsd.configs.recommended] },
55
+ textlint: { ignores: ["CHANGELOG.md"], rules: { "preset-ja-technical-writing": true } },
56
+ markdownlint: { ignores: ["CHANGELOG.md"] },
57
+ fallow: { production: true, rules: { "unused-files": "error" } },
58
+ run: { tasks: { vpa: { command: "vpa", cache: false } } },
59
+ });
60
+ ```
61
+
62
+ 3. Run `vpa` from git hooks.
63
+
64
+ ```sh
65
+ # .vite-hooks/pre-commit
66
+ vpa --staged
67
+ # .vite-hooks/commit-msg
68
+ vpa --commit-msg "$1"
69
+ ```
70
+
71
+ In a repository that uses @r_masseater/msch, `repositoryConfig` writes these sections and `msch` runs them. Change them through msch's options instead.
72
+
73
+ ## Section notes
74
+
75
+ | Section | Note |
76
+ | ------------- | -------------------------------------------------------------------------------------------------------- |
77
+ | `textlint` | Checks the Markdown that git tracks. List other globs (`files`) and their settings in `textlint.sources` |
78
+ | `steiger` | Checks only the `steiger.paths` directories that hold FSD layer folders such as `features` directly |
79
+ | `betterleaks` | `filter` is an expression that accepts a finding. `ignoredSecrets` takes SHA-256 hashes of safe secrets |
80
+ | `commitlint` | Compares against `VPA_BASE` (default `origin/main`) like the git-history checks. Run with `cache: false` |
81
+
82
+ ## Bundled replacements
83
+
84
+ `@r_masseater/vite-plus-adopt/fsd` bundles @feature-sliced/steiger-plugin with the same rules and `configs.recommended`.
85
+ vpa does not use Steiger's CLI.
86
+ The plugin pulls in TypeScript 5.
87
+ Add `overrides: { "steiger>@feature-sliced/steiger-plugin": "-" }` to `pnpm-workspace.yaml` to drop it.
88
+
89
+ `@r_masseater/vite-plus-adopt/attw` has the API of @arethetypeswrong/core on TypeScript 7.1 alone.
90
+ Pass it as `pack.attw.module`.
91
+
92
+ ```ts
93
+ import * as attw from "@r_masseater/vite-plus-adopt/attw";
94
+ import { defineConfig } from "vite-plus";
95
+
96
+ export default defineConfig({
97
+ pack: { attw: { module: attw, profile: "esm-only", level: "error" } },
98
+ });
99
+ ```
@@ -1 +0,0 @@
1
- {"version":3,"file":"output-DKrfYl9Q.mjs","names":["Str","Arr","encodeHex","Rec","DATA_FIRST_ARITY","Fn","Fn"],"sources":["../src/shared/lib/errors.ts","../src/shared/lib/attempt.ts","../src/entities/binary/model/binaries.ts","../src/entities/binary/model/vendor.ts","../src/entities/binary/model/install.ts","../src/shared/lib/process.ts","../src/entities/binary/model/vendored.ts","../src/shared/lib/output.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class VpToolsError extends taggedError<VpToolsError, { readonly brand: unique symbol }>()(\n \"VpToolsError\",\n {\n kind: Schema.Literals([\"config-missing\", \"tool-failed\", \"checks-failed\"]),\n message: Schema.String,\n },\n) {}\n\nexport const configMissing = (message: string): VpToolsError =>\n VpToolsError.make({ kind: \"config-missing\", message });\n\nexport const checksFailed = (message: string): VpToolsError =>\n VpToolsError.make({ kind: \"checks-failed\", message });\n\nexport const toolFailed =\n (tool: string) =>\n (cause: unknown): VpToolsError =>\n VpToolsError.make({ kind: \"tool-failed\", message: `${tool} failed: ${String(cause)}` });\n","import { Effect } from \"effect\";\n\nimport { toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\n\nexport const attempt =\n (tool: string) =>\n <Value>(run: () => PromiseLike<Value>): Effect.Effect<Value, VpToolsError> =>\n Effect.tryPromise({ try: run, catch: toolFailed(tool) });\n","import { String as Str } from \"effect\";\n\nexport type Platform = \"darwin-arm64\" | \"darwin-x64\" | \"linux-arm64\" | \"linux-x64\" | \"win32-x64\";\n\nexport type Archive = \"tar.gz\" | \"zip\";\n\nexport interface BinaryAsset {\n readonly url: string;\n readonly sha256: string;\n readonly archive: Archive;\n}\n\nexport interface Binary {\n readonly name: string;\n readonly version: string;\n readonly assets: Readonly<Record<Platform, BinaryAsset>>;\n}\n\nconst archiveOf = (file: string): Archive => {\n if (Str.endsWith(\".zip\")(file)) {\n return \"zip\";\n }\n return \"tar.gz\";\n};\n\nconst releaseAsset =\n (release: string) =>\n (file: string, sha256: string): BinaryAsset => ({\n url: `${release}/${file}`,\n sha256,\n archive: archiveOf(file),\n });\n\nconst betterleaksAsset = releaseAsset(\n \"https://github.com/betterleaks/betterleaks/releases/download/v2.0.0-rc.7\",\n);\n\nexport const BETTERLEAKS: Binary = {\n name: \"betterleaks\",\n version: \"2.0.0-rc.7\",\n assets: {\n \"darwin-arm64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_darwin_arm64.tar.gz\",\n \"d5052b4789752e3d9995c0b71a5b531aea747455ba4f8d1534c90b41e03f906c\",\n ),\n \"darwin-x64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_darwin_x64.tar.gz\",\n \"b3be0c6b4b91036a6d8b98e47642470a5a872d4bff08b8ee34348e9baf1e3434\",\n ),\n \"linux-arm64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_linux_arm64.tar.gz\",\n \"32fcd5a77d7c3c2d97cc615c5d70344d0c62b5a36f38568ce8ec72e62783acad\",\n ),\n \"linux-x64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_linux_x64.tar.gz\",\n \"230ef42dc3a0ee35e5148b7b4e9280224a412ef100cd4e74d3d6681d94e6ccb8\",\n ),\n \"win32-x64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_windows_x64.zip\",\n \"36db668ba12b55537a11cc45cd61565ab7f4f23ce606e0827206f49048a5183e\",\n ),\n },\n};\n\nconst actionlintAsset = releaseAsset(\n \"https://github.com/rhysd/actionlint/releases/download/v1.7.12\",\n);\n\nexport const ACTIONLINT: Binary = {\n name: \"actionlint\",\n version: \"1.7.12\",\n assets: {\n \"darwin-arm64\": actionlintAsset(\n \"actionlint_1.7.12_darwin_arm64.tar.gz\",\n \"aba9ced2dee8d27fecca3dc7feb1a7f9a52caefa1eb46f3271ea66b6e0e6953f\",\n ),\n \"darwin-x64\": actionlintAsset(\n \"actionlint_1.7.12_darwin_amd64.tar.gz\",\n \"5b44c3bc2255115c9b69e30efc0fecdf498fdb63c5d58e17084fd5f16324c644\",\n ),\n \"linux-arm64\": actionlintAsset(\n \"actionlint_1.7.12_linux_arm64.tar.gz\",\n \"325e971b6ba9bfa504672e29be93c24981eeb1c07576d730e9f7c8805afff0c6\",\n ),\n \"linux-x64\": actionlintAsset(\n \"actionlint_1.7.12_linux_amd64.tar.gz\",\n \"8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8\",\n ),\n \"win32-x64\": actionlintAsset(\n \"actionlint_1.7.12_windows_amd64.zip\",\n \"6e7241b51e6817ea6a047693d8e6fed13b31819c9a0dd6c5a726e1592d22f6e9\",\n ),\n },\n};\n\nconst zizmorAsset = releaseAsset(\"https://github.com/zizmorcore/zizmor/releases/download/v1.32.0\");\n\nexport const ZIZMOR: Binary = {\n name: \"zizmor\",\n version: \"1.32.0\",\n assets: {\n \"darwin-arm64\": zizmorAsset(\n \"zizmor-aarch64-apple-darwin.tar.gz\",\n \"6efed18c4539a663fd3c851a2be9533fd8456c4e646d9416206da059154a0d3c\",\n ),\n \"darwin-x64\": zizmorAsset(\n \"zizmor-x86_64-apple-darwin.tar.gz\",\n \"6983143c719ada6845a69cc4dd2bacc215f971662fecd8bbd2678388e5ce5969\",\n ),\n \"linux-arm64\": zizmorAsset(\n \"zizmor-aarch64-unknown-linux-gnu.tar.gz\",\n \"cb152b207f815116d7fa1c1ee4614f61578803351395052908095e79adfd9fd0\",\n ),\n \"linux-x64\": zizmorAsset(\n \"zizmor-x86_64-unknown-linux-gnu.tar.gz\",\n \"bb110cc765eca9cd7efb2e284a956be5974c60027b0970f16397d86208a9957b\",\n ),\n \"win32-x64\": zizmorAsset(\n \"zizmor-x86_64-pc-windows-msvc.zip\",\n \"d284a16e09d9df4ce2c000357e7b59bd531be093bea5718a1ce225b449b59d49\",\n ),\n },\n};\n\nexport const PLATFORMS: readonly Platform[] = [\n \"darwin-arm64\",\n \"darwin-x64\",\n \"linux-arm64\",\n \"linux-x64\",\n \"win32-x64\",\n];\n","import { Context } from \"effect\";\n\nexport const VendorDirectory = Context.Reference<string>(\"vite-plus-adopt/VendorDirectory\", {\n defaultValue: () => `${import.meta.dirname}/../vendor`,\n});\n","import { untar } from \"@andrewbranch/untar.js\";\nimport { Array as Arr, Effect, FileSystem, Path, pipe, Record as Rec } from \"effect\";\nimport type { Option, PlatformError } from \"effect\";\nimport { encode as encodeHex } from \"effect/encoding/Hex\";\nimport { HttpClient } from \"effect/http\";\nimport { unzip } from \"fflate\";\n\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport { configMissing, toolFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\n\nimport { PLATFORMS } from \"./binaries.ts\";\nimport type { Binary, BinaryAsset, Platform } from \"./binaries.ts\";\nimport { VendorDirectory } from \"./vendor.ts\";\n\ntype Entries = ReadonlyMap<string, Uint8Array>;\n\ninterface Download {\n readonly binary: Binary;\n readonly platform: Platform;\n readonly data: Uint8Array;\n}\n\ntype InstallServices = FileSystem.FileSystem | Path.Path;\n\ntype InstallError = VpToolsError | PlatformError.PlatformError;\n\nconst EXECUTABLE = 0o755;\n\nconst NOT_INSTALLED =\n \"was not installed. Allow the postinstall of @r_masseater/vite-plus-adopt in allowBuilds of pnpm-workspace.yaml and run vp install.\";\n\nconst currentPlatform = (): Option.Option<Platform> =>\n Arr.findFirst(PLATFORMS, (platform) => platform === `${process.platform}-${process.arch}`);\n\nconst executableName = (binary: Binary, platform: Platform): string => {\n if (platform === \"win32-x64\") {\n return `${binary.name}.exe`;\n }\n return binary.name;\n};\n\nconst assetOf = ({ binary, platform }: Download): BinaryAsset => binary.assets[platform];\n\nconst download = (\n binary: Binary,\n asset: BinaryAsset,\n): Effect.Effect<Uint8Array, VpToolsError, HttpClient.HttpClient> =>\n Effect.gen(function* fetchAsset() {\n const httpClient = yield* HttpClient.HttpClient;\n const client = HttpClient.filterStatusOk(httpClient);\n const response = yield* client.get(asset.url);\n const body = yield* response.arrayBuffer;\n return new Uint8Array(body);\n }).pipe(Effect.mapError(toolFailed(binary.name)));\n\nconst verify = (fetched: Download): Effect.Effect<Download, VpToolsError> => {\n const asset = assetOf(fetched);\n const failed = toolFailed(fetched.binary.name);\n const data = new Uint8Array(fetched.data);\n return attempt(fetched.binary.name)(() => crypto.subtle.digest(\"SHA-256\", data)).pipe(\n Effect.map((digest) => encodeHex(new Uint8Array(digest))),\n Effect.filterOrFail(\n (digest) => digest === asset.sha256,\n (digest) => failed(`${asset.url} has SHA-256 ${digest}, expected ${asset.sha256}`),\n ),\n Effect.as(fetched),\n );\n};\n\nconst gunzipped = (data: Uint8Array): Effect.Effect<ArrayBuffer, VpToolsError> => {\n const compressed = new Blob([new Uint8Array(data)]).stream();\n return attempt(\"gunzip\")(() =>\n new Response(compressed.pipeThrough(new DecompressionStream(\"gzip\"))).arrayBuffer(),\n );\n};\n\nconst tarEntries = (data: Uint8Array): Effect.Effect<Entries, VpToolsError> =>\n gunzipped(data).pipe(\n Effect.map(untar),\n Effect.map(\n (files) =>\n new Map(\n pipe(\n files,\n Arr.map((file) => [file.name, file.fileData] as const),\n ),\n ),\n ),\n );\n\nconst zipEntries = (data: Uint8Array): Effect.Effect<Entries, VpToolsError> =>\n Effect.callback<Entries, VpToolsError>((resume) => {\n unzip(data, (failure, files) => {\n if (failure === null) {\n const entries: Entries = new Map(Rec.toEntries(files));\n resume(Effect.succeed(entries));\n return;\n }\n resume(Effect.fail(toolFailed(\"unzip\")(failure)));\n });\n });\n\nconst entriesOf = (\n asset: BinaryAsset,\n): ((data: Uint8Array) => Effect.Effect<Entries, VpToolsError>) => {\n if (asset.archive === \"zip\") {\n return zipEntries;\n }\n return tarEntries;\n};\n\nconst extract = (fetched: Download): Effect.Effect<Uint8Array, VpToolsError> => {\n const asset = assetOf(fetched);\n const executable = executableName(fetched.binary, fetched.platform);\n return entriesOf(asset)(fetched.data).pipe(\n Effect.flatMap((files) => Effect.fromNullishOr(files.get(executable))),\n Effect.mapError(() => toolFailed(fetched.binary.name)(`${asset.url} has no ${executable}`)),\n );\n};\n\nconst binaryPath = (binary: Binary, platform: Platform): Effect.Effect<string, never, Path.Path> =>\n Effect.gen(function* vendoredPath() {\n const path = yield* Path.Path;\n const vendor = yield* VendorDirectory;\n return path.join(vendor, binary.name, binary.version, executableName(binary, platform));\n });\n\nconst place = (\n fetched: Download,\n bytes: Uint8Array,\n): Effect.Effect<void, PlatformError.PlatformError, InstallServices> =>\n Effect.gen(function* write() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const file = yield* binaryPath(fetched.binary, fetched.platform);\n yield* fs.makeDirectory(path.dirname(file), { recursive: true });\n yield* Effect.scoped(\n Effect.gen(function* stage() {\n const staging = yield* fs.makeTempDirectoryScoped({\n directory: path.dirname(file),\n prefix: \".partial-\",\n });\n const partial = path.join(staging, path.basename(file));\n yield* fs.writeFile(partial, bytes);\n yield* fs.chmod(partial, EXECUTABLE);\n yield* fs.rename(partial, file);\n }),\n );\n });\n\nconst unpack = (fetched: Download): Effect.Effect<void, InstallError, InstallServices> =>\n verify(fetched).pipe(\n Effect.flatMap(extract),\n Effect.flatMap((bytes) => place(fetched, bytes)),\n );\n\nconst platformOf = (binary: Binary): Effect.Effect<Platform, VpToolsError> =>\n pipe(\n currentPlatform(),\n Effect.fromOption,\n Effect.mapError(() =>\n toolFailed(binary.name)(`no release for ${process.platform}-${process.arch}`),\n ),\n );\n\nconst isPlaced = (\n binary: Binary,\n platform: Platform,\n): Effect.Effect<boolean, PlatformError.PlatformError, InstallServices> =>\n Effect.gen(function* placed() {\n const fs = yield* FileSystem.FileSystem;\n const file = yield* binaryPath(binary, platform);\n return yield* fs.exists(file);\n });\n\n/** @internal */\nexport const installBinary = (\n binary: Binary,\n): Effect.Effect<\n void,\n VpToolsError | PlatformError.PlatformError,\n FileSystem.FileSystem | HttpClient.HttpClient | Path.Path\n> =>\n Effect.gen(function* install() {\n const platform = yield* platformOf(binary);\n if (yield* isPlaced(binary, platform)) {\n return;\n }\n const data = yield* download(binary, binary.assets[platform]);\n yield* unpack({ binary, platform, data });\n });\n\n/** @internal */\nexport const locateBinary = (\n binary: Binary,\n): Effect.Effect<\n string,\n VpToolsError | PlatformError.PlatformError,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* locate() {\n const platform = yield* platformOf(binary);\n if (!(yield* isPlaced(binary, platform))) {\n return yield* configMissing(`${binary.name} ${binary.version} ${NOT_INSTALLED}`);\n }\n return yield* binaryPath(binary, platform);\n });\n","import { Effect, Option, Stream, pipe } from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport type { Report } from \"./report.ts\";\n\nconst SUCCESS = 0;\n\n/** @internal */\nexport interface Invocation {\n readonly root: string;\n readonly file: string;\n readonly args: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly input?: string | undefined;\n readonly output?: \"all\" | \"stdout\";\n}\n\nconst stdinOf = (input: string | undefined): ChildProcess.CommandInput =>\n pipe(\n Option.fromNullishOr(input),\n Option.match({\n onNone: (): ChildProcess.CommandInput => \"ignore\",\n onSome: (text) => Stream.make(new TextEncoder().encode(text)),\n }),\n );\n\n/** @internal */\nexport const runCaptured = ({\n root,\n file,\n args,\n env = {},\n input,\n output = \"all\",\n}: Invocation): Effect.Effect<\n Report,\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n> =>\n Effect.gen(function* run() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const handle = yield* spawner.spawn(\n ChildProcess.make(file, args, { cwd: root, env, extendEnv: true, stdin: stdinOf(input) }),\n );\n const [text, exitCode] = yield* Effect.all(\n [handle[output].pipe(Stream.decodeText, Stream.mkString), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n return { valid: exitCode === SUCCESS, output: text };\n }).pipe(Effect.scoped);\n","import { Effect, Function as Fn } from \"effect\";\nimport type { FileSystem, Path, PlatformError } from \"effect\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { runCaptured } from \"#/shared/lib/process.ts\";\nimport type { Invocation } from \"#/shared/lib/process.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport type { Binary } from \"./binaries.ts\";\nimport { locateBinary } from \"./install.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport const runVendored: {\n (\n invocation: Omit<Invocation, \"file\">,\n ): (\n binary: Binary,\n ) => Effect.Effect<\n Report,\n VpToolsError | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path\n >;\n (\n binary: Binary,\n invocation: Omit<Invocation, \"file\">,\n ): Effect.Effect<\n Report,\n VpToolsError | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path\n >;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (\n binary: Binary,\n invocation: Omit<Invocation, \"file\">,\n ): Effect.Effect<\n Report,\n VpToolsError | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path\n > => locateBinary(binary).pipe(Effect.flatMap((file) => runCaptured({ ...invocation, file }))),\n);\n","import { Effect, Stdio, Stream, Function as Fn } from \"effect\";\n\nimport { checksFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport type Sink = \"stdout\" | \"stderr\";\n\n/** @internal */\nexport const writeTo: {\n (text: string): (sink: Sink) => Effect.Effect<void, never, Stdio.Stdio>;\n (sink: Sink, text: string): Effect.Effect<void, never, Stdio.Stdio>;\n} = Fn.dual(DATA_FIRST_ARITY, (sink: Sink, text: string): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* write() {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio[sink]()), Effect.orDie);\n }),\n);\n\n/** @internal */\nexport const finish = (report: Report): Effect.Effect<void, VpToolsError, Stdio.Stdio> => {\n if (!report.valid) {\n return Effect.fail(checksFailed(report.output));\n }\n if (report.output === \"\") {\n return Effect.void;\n }\n return writeTo(\"stdout\", `${report.output}\\n`);\n};\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,eAAb,cAAkC,YAA6D,CAAC,CAC9F,gBACA;CACE,MAAM,OAAO,SAAS;EAAC;EAAkB;EAAe;CAAe,CAAC;CACxE,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;AAEH,MAAa,iBAAiB,YAC5B,aAAa,KAAK;CAAE,MAAM;CAAkB;AAAQ,CAAC;AAEvD,MAAa,gBAAgB,YAC3B,aAAa,KAAK;CAAE,MAAM;CAAiB;AAAQ,CAAC;AAEtD,MAAa,cACV,UACA,UACC,aAAa,KAAK;CAAE,MAAM;CAAe,SAAS,GAAG,KAAK,WAAW,OAAO,KAAK;AAAI,CAAC;;AChB1F,MAAa,WACV,UACO,QACN,OAAO,WAAW;CAAE,KAAK;CAAK,OAAO,WAAW,IAAI;AAAE,CAAC;;ACU3D,MAAM,aAAa,SAA0B;CAC3C,IAAIA,SAAI,SAAS,MAAM,CAAC,CAAC,IAAI,GAC3B,OAAO;CAET,OAAO;AACT;AAEA,MAAM,gBACH,aACA,MAAc,YAAiC;CAC9C,KAAK,GAAG,QAAQ,GAAG;CACnB;CACA,SAAS,UAAU,IAAI;AACzB;AAEF,MAAM,mBAAmB,aACvB,0EACF;AAEA,MAAa,cAAsB;CACjC,MAAM;CACN,SAAS;CACT,QAAQ;EACN,gBAAgB,iBACd,8CACA,kEACF;EACA,cAAc,iBACZ,4CACA,kEACF;EACA,eAAe,iBACb,6CACA,kEACF;EACA,aAAa,iBACX,2CACA,kEACF;EACA,aAAa,iBACX,0CACA,kEACF;CACF;AACF;AAEA,MAAM,kBAAkB,aACtB,+DACF;AAEA,MAAa,aAAqB;CAChC,MAAM;CACN,SAAS;CACT,QAAQ;EACN,gBAAgB,gBACd,yCACA,kEACF;EACA,cAAc,gBACZ,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