@r_masseater/vite-plus-adopt 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/attw.mjs +71 -71
- package/dist/attw.mjs.map +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/fsd.d.mts +1 -1
- package/dist/fsd.mjs +3 -3
- package/dist/fsd.mjs.map +1 -1
- package/dist/{types-roDZO7vm.d.mts → index-D34U8BFs.d.mts} +6 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{json-D-rhjlSM.mjs → json-QtVKpodH.mjs} +2 -2
- package/dist/json-QtVKpodH.mjs.map +1 -0
- package/dist/{install-Cj_2weFd.mjs → output-DKrfYl9Q.mjs} +45 -19
- package/dist/output-DKrfYl9Q.mjs.map +1 -0
- package/dist/postinstall.mjs +3 -3
- package/dist/postinstall.mjs.map +1 -1
- package/dist/{run-cli-CSEt6b4a.mjs → run-cli-BVnXT7zF.mjs} +4 -4
- package/dist/run-cli-BVnXT7zF.mjs.map +1 -0
- package/dist/{vpa-Cq7jIoC7.mjs → vpa-Cvkfsskf.mjs} +307 -314
- package/dist/vpa-Cvkfsskf.mjs.map +1 -0
- package/package.json +6 -5
- package/dist/install-Cj_2weFd.mjs.map +0 -1
- package/dist/json-D-rhjlSM.mjs.map +0 -1
- package/dist/run-cli-CSEt6b4a.mjs.map +0 -1
- package/dist/vpa-Cq7jIoC7.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vpa-Cvkfsskf.mjs","names":["Arr","DATA_FIRST_ARITY","Fn","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/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 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* pipe(\n messages,\n Effect.forEach((message) =>\n attempt(\"commitlint\")(() => lint(message, loaded.rules, lintOptionsOf(loaded))),\n ),\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]).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 {\n Effect,\n FileSystem,\n Path,\n Schema,\n Array as Arr,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport type { ChildProcessSpawner } from \"effect/process\";\nimport { parse } from \"yaml\";\n\nimport { listGitFiles } from \"./git.ts\";\n\nconst DEPENDENCY_FIELDS = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n] as const;\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\n/** @internal */\nexport type WorkspaceServices =\n | ChildProcessSpawner.ChildProcessSpawner\n | FileSystem.FileSystem\n | Path.Path;\n\nconst Manifest = Schema.Record(Schema.String, Schema.Unknown);\n\nconst decodeSpecifiers = Schema.decodeUnknownEffect(Schema.Record(Schema.String, Schema.String));\n\nconst Workspace = Schema.Struct({\n packages: Schema.optionalKey(Schema.Array(Schema.String)),\n});\n\nconst decodeManifest = Schema.decodeEffect(Schema.fromJsonString(Manifest));\n\nconst decodeWorkspace = Schema.decodeUnknownEffect(Workspace);\n\nconst NEGATION = \"!\";\n\nconst manifestPathspec = (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `:(glob,exclude)${Str.slice(NEGATION.length)(pattern)}/package.json`;\n }\n return `:(glob)${pattern}/package.json`;\n};\n\nconst listManifests = (\n root: string,\n): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError | Schema.SchemaError,\n WorkspaceServices\n> =>\n Effect.gen(function* list() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const text = yield* fs.readFileString(path.join(root, \"pnpm-workspace.yaml\"));\n const raw: unknown = parse(text);\n const workspace = yield* decodeWorkspace(raw);\n const found = yield* listGitFiles(\n root,\n pipe(workspace.packages ?? [], Arr.map(manifestPathspec)),\n );\n return [\"package.json\", ...Arr.sort(found, Str.Order)];\n });\n\nconst dependenciesOf =\n (manifest: string) =>\n (fields: typeof Manifest.Type): Effect.Effect<readonly Dependency[], Schema.SchemaError> =>\n pipe(\n DEPENDENCY_FIELDS,\n Effect.forEach((field) =>\n decodeSpecifiers(fields[field] ?? {}).pipe(\n Effect.map((specifiers) =>\n pipe(\n Rec.toEntries(specifiers),\n Arr.map(([name, specifier]) => ({ manifest, field, name, specifier })),\n ),\n ),\n ),\n ),\n Effect.map(Arr.flatten),\n );\n\n/** @internal */\nexport const listDependencies = (\n root: string,\n): Effect.Effect<\n readonly Dependency[],\n PlatformError.PlatformError | Schema.SchemaError,\n WorkspaceServices\n> =>\n Effect.gen(function* list() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifests = yield* listManifests(root);\n const parsed = yield* pipe(\n manifests,\n Effect.forEach((manifest) =>\n fs\n .readFileString(path.join(root, manifest))\n .pipe(Effect.flatMap(decodeManifest), Effect.flatMap(dependenciesOf(manifest))),\n ),\n );\n return Arr.flatten(parsed);\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* pipe(\n targets,\n Effect.forEach((target) =>\n attempt(\"steiger\")(() => linter.run(path.resolve(root, target))),\n ),\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* pipe(\n RUNS,\n Effect.forEach((args) =>\n runCaptured({ root, file: \"fallow\", args: [...args, \"-c\", configFile] }),\n ),\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 Option,\n Array as Arr,\n Record as Rec,\n pipe,\n Function as Fn,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\n\nimport { loadSection } from \"#/entities/vite-config/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 } 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 --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 HOOKS: Readonly<Record<string, (root: string, rest: readonly string[]) => CommandEffect>> = {\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,MAAM,IAAI,CAAC,GACvC,OAAO,QAAQ,SAAS,GAAG,OAAO,IAAI,CAAC,CAAC,KAAK,OAAO,oBAAoB,KAAK,CAAC,CAAC,CACjF;CACA,OAAO,OAAO,OAAO,WAAWA,MAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAClD,OAAO,eAAe,cAAc,0BAA0B,MAAM,CAAC,CACvE;AACF,CAAC;;AAGH,MAAa,kBACX,SAEA,eAAe,IAAI,CAAC,CAAC,KACnB,OAAO,SAAS,SAAS,QAAQ,aAAa,CAAC,OAAO,sBAAsB,IAAI,CAAC,CAAC,CACpF;AAEF,MAAM,kBACsB,SACzB,WACC,OAAO,WAAW,OAAO,cAAc,OAAO,IAAI,CAAC,CAAC,CAAC,KACnD,OAAO,eAAe,cAAc,uBAAuB,IAAI,UAAU,CAAC,CAC5E;;AAKJ,MAAa,cAQTE,SAAG,KACLD,IAEE,MACA,QAEA,eAAe,IAAI,CAAC,CAAC,KAAK,OAAO,QAAQ,eAAe,GAAG,CAAC,CAAC,CACjE;;AChDA,MAAME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AM;CAC7B,CAAC;AACL,CAAC,CACH;AAEJ,MAAM,eACJ,SAEA,WAAW,WAAW,KAAK,OAAO,SAAS,OAAO,GAAG,eAAe,IAAI,CAAC,CAAC;AAE5E,MAAM,QAA4F;CAChG,YAAY;CACZ,gBAAgB,YAAY,WAAW;CACvC,aAAa,YAAY,OAAO,OAAO;AACzC;;AAGA,MAAa,SAGTC,SAAG,KAAK,mBAAmB,MAAc,SAC3C,KACE,MACAD,MAAI,MAAM;CACR,eAAe,aAAa,IAAI;CAChC,aAAa,CAAC,MAAM,GAAG,UACrB,KACEE,OAAI,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.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"type": "module",
|
|
35
35
|
"imports": {
|
|
36
36
|
"#attw-upstream/*": "./upstream/attw-core/lib/*",
|
|
37
|
-
"
|
|
37
|
+
"#/*": "./src/*"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@loaderkit/resolve": "1.0.6",
|
|
66
66
|
"@textlint/config-loader": "15.8.0",
|
|
67
67
|
"@textlint/kernel": "15.8.0",
|
|
68
|
+
"@textlint/utils": "15.8.0",
|
|
68
69
|
"cjs-module-lexer": "2.3.0",
|
|
69
70
|
"fastest-levenshtein": "^1.0.16",
|
|
70
71
|
"fflate": "^0.8.3",
|
|
@@ -108,17 +109,17 @@
|
|
|
108
109
|
"!dist/fsd.mjs",
|
|
109
110
|
"!dist/attw.mjs"
|
|
110
111
|
],
|
|
111
|
-
"limit": "
|
|
112
|
+
"limit": "11590 B"
|
|
112
113
|
},
|
|
113
114
|
{
|
|
114
115
|
"name": "fsd",
|
|
115
116
|
"path": "dist/fsd.mjs",
|
|
116
|
-
"limit": "
|
|
117
|
+
"limit": "9420 B"
|
|
117
118
|
},
|
|
118
119
|
{
|
|
119
120
|
"name": "attw",
|
|
120
121
|
"path": "dist/attw.mjs",
|
|
121
|
-
"limit": "
|
|
122
|
+
"limit": "47120 B"
|
|
122
123
|
}
|
|
123
124
|
],
|
|
124
125
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-Cj_2weFd.mjs","names":["Fn","Str","Arr","encodeHex","Rec"],"sources":["../src/errors.ts","../src/attempt.ts","../src/output.ts","../src/binaries.ts","../src/vendor.ts","../src/install.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 { 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","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 \"./attempt.ts\";\nimport { PLATFORMS } from \"./binaries.ts\";\nimport type { Binary, BinaryAsset, Platform } from \"./binaries.ts\";\nimport { configMissing, toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.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"],"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;;ACI3D,MAAa,UAGTA,SAAG,KAAK,IAAmB,MAAY,SACzC,OAAO,IAAI,UAAU,QAAQ;CAC3B,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,KAAK,CAAC,CAAC,GAAG,OAAO,KAAK;AACvE,CAAC,CACH;;AAGA,MAAa,UAAU,WAAmE;CACxF,IAAI,CAAC,OAAO,OACV,OAAO,OAAO,KAAK,aAAa,OAAO,MAAM,CAAC;CAEhD,IAAI,OAAO,WAAW,IACpB,OAAO,OAAO;CAEhB,OAAO,QAAQ,UAAU,GAAG,OAAO,OAAO,GAAG;AAC/C;;ACbA,MAAM,aAAa,SAA0B;CAC3C,IAAIC,SAAI,SAAS,MAAM,CAAC,CAAC,IAAI,GAC3B,OAAO;CAET,OAAO;AACT;AAEA,MAAM,gBACH,aACA,MAAc,YAAiC;CAC9C,KA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json.ts"],"sourcesContent":["import { Option, Schema } from \"effect\";\n\nconst JsonText = Schema.fromJsonString(Schema.Unknown);\n\nconst encodeJson = Schema.encodeUnknownOption(JsonText);\n\nexport const toJson = (value: unknown): string =>\n Option.getOrElse(encodeJson(value), () => String(value));\n\nexport const parseJson: (text: string) => Option.Option<unknown> = Schema.decodeOption(JsonText);\n"],"mappings":";;AAEA,MAAM,WAAW,OAAO,eAAe,OAAO,OAAO;AAErD,MAAM,aAAa,OAAO,oBAAoB,QAAQ;AAEtD,MAAa,UAAU,UACrB,OAAO,UAAU,WAAW,KAAK,SAAS,OAAO,KAAK,CAAC;AAEzD,MAAa,YAAsD,OAAO,aAAa,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli-CSEt6b4a.mjs","names":[],"sources":["../src/node-services.ts","../src/run-cli.ts"],"sourcesContent":["import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { Layer } from \"effect\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n","import { runMain } from \"@effect/platform-node-shared/NodeRuntime\";\nimport { Cause, Effect, Layer, Option, Schema, pipe } from \"effect\";\nimport type { Stdio } from \"effect\";\n\nimport type { CommandServices } from \"./command.ts\";\nimport { VpToolsError } from \"./errors.ts\";\nimport { nodeServicesLayer } from \"./node-services.ts\";\nimport { writeTo } from \"./output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> => {\n const message = pipe(\n Cause.findErrorOption(cause),\n Option.filter(Schema.is(VpToolsError)),\n Option.match({\n onNone: () => Cause.pretty(cause),\n onSome: (error) => error.message,\n }),\n );\n return writeTo(\"stderr\", `${message}\\n`);\n};\n\n/** @internal */\nexport const runCli = <Failure>(program: Effect.Effect<void, Failure, CommandServices>): void => {\n const reported = program.pipe(Effect.tapCause(reportFailure));\n const main = Layer.build(nodeServicesLayer).pipe(\n Effect.flatMap((services) => Effect.provideContext(reported, services)),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n"],"mappings":";;;;;;AASA,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;;ACHA,MAAM,iBACJ,UAC4C;CAC5C,MAAM,UAAU,KACd,MAAM,gBAAgB,KAAK,GAC3B,OAAO,OAAO,OAAO,GAAG,YAAY,CAAC,GACrC,OAAO,MAAM;EACX,cAAc,MAAM,OAAO,KAAK;EAChC,SAAS,UAAU,MAAM;CAC3B,CAAC,CACH;CACA,OAAO,QAAQ,UAAU,GAAG,QAAQ,GAAG;AACzC;;AAGA,MAAa,UAAmB,YAAiE;CAC/F,MAAM,WAAW,QAAQ,KAAK,OAAO,SAAS,aAAa,CAAC;CAC5D,MAAM,OAAO,MAAM,MAAM,iBAAiB,CAAC,CAAC,KAC1C,OAAO,SAAS,aAAa,OAAO,eAAe,UAAU,QAAQ,CAAC,GACtE,OAAO,MACT;CACA,QAAQ,MAAM,EAAE,uBAAuB,KAAK,CAAC;AAC/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vpa-Cq7jIoC7.mjs","names":["Arr","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY_3","Fn","Arr","SUCCESS","DATA_FIRST_ARITY","Fn","Arr","DATA_FIRST_ARITY","Arr","Rec","describe","Str","Fn","DATA_FIRST_ARITY","Fn","Str","Arr","DATA_FIRST_ARITY_3","Arr","Fn","Str","Arr","Rec","Arr","Str","Arr","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","Str","Fn","DATA_FIRST_ARITY_3","Arr","Fn","lint","Rec","Rec","Arr","Fn","Arr","Arr","Arr","Arr","Fn","Rec"],"sources":["../src/config.ts","../src/commitlint.ts","../src/process.ts","../src/section-check.ts","../src/fallow-check.ts","../src/dependency-rules.ts","../src/git.ts","../src/steiger.ts","../src/workspace.ts","../src/repository-checks.ts","../src/betterleaks.ts","../src/vendored.ts","../src/secret-checks.ts","../src/markdownlint.ts","../src/textlint-presets.ts","../src/textlint.ts","../src/text-checks.ts","../src/workflow-checks.ts","../src/checks.ts","../src/run-checks.ts","../src/vpa.ts"],"sourcesContent":["import { Effect, FileSystem, Function as Fn, Option, Path, Array as Arr, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { attempt } from \"./attempt.ts\";\nimport { configMissing } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { ToolSection, ToolSections } from \"./types.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 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 { attempt } from \"./attempt.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\nimport type { CommitlintConfig } from \"./types.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* pipe(\n messages,\n Effect.forEach((message) =>\n attempt(\"commitlint\")(() => lint(message, loaded.rules, lintOptionsOf(loaded))),\n ),\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, 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, Option, pipe } from \"effect\";\n\nimport type { Check, CheckContext, CheckError, CheckServices } from \"./check.ts\";\nimport type { Report } from \"./report.ts\";\nimport type { ToolSection, ToolSections } from \"./types.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, FileSystem, Path, Schema, Array as Arr, pipe } from \"effect\";\n\nimport type { CheckError, CheckServices } from \"./check.ts\";\nimport { toJson } from \"./json.ts\";\nimport { runCaptured } from \"./process.ts\";\nimport type { Report } from \"./report.ts\";\nimport { withSection } from \"./section-check.ts\";\nimport type { FallowConfig } from \"./types.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* pipe(\n RUNS,\n Effect.forEach((args) =>\n runCaptured({ root, file: \"fallow\", args: [...args, \"-c\", configFile] }),\n ),\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 {\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 \"./types.ts\";\nimport type { Dependency } from \"./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, 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, Path, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport { linter, processConfiguration } from \"steiger\";\n\nimport { attempt } from \"./attempt.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\nimport type { SteigerConfig } from \"./types.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* pipe(\n targets,\n Effect.forEach((target) =>\n attempt(\"steiger\")(() => linter.run(path.resolve(root, target))),\n ),\n );\n return reportOf(Arr.flatten(perTarget), (file) => path.relative(root, file));\n }),\n);\n","import {\n Effect,\n FileSystem,\n Path,\n Schema,\n Array as Arr,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport type { ChildProcessSpawner } from \"effect/process\";\nimport { parse } from \"yaml\";\n\nimport { listGitFiles } from \"./git.ts\";\n\nconst DEPENDENCY_FIELDS = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n] as const;\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\n/** @internal */\nexport type WorkspaceServices =\n | ChildProcessSpawner.ChildProcessSpawner\n | FileSystem.FileSystem\n | Path.Path;\n\nconst Manifest = Schema.Record(Schema.String, Schema.Unknown);\n\nconst decodeSpecifiers = Schema.decodeUnknownEffect(Schema.Record(Schema.String, Schema.String));\n\nconst Workspace = Schema.Struct({\n packages: Schema.optionalKey(Schema.Array(Schema.String)),\n});\n\nconst decodeManifest = Schema.decodeEffect(Schema.fromJsonString(Manifest));\n\nconst decodeWorkspace = Schema.decodeUnknownEffect(Workspace);\n\nconst NEGATION = \"!\";\n\nconst manifestPathspec = (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `:(glob,exclude)${Str.slice(NEGATION.length)(pattern)}/package.json`;\n }\n return `:(glob)${pattern}/package.json`;\n};\n\nconst listManifests = (\n root: string,\n): Effect.Effect<\n readonly string[],\n PlatformError.PlatformError | Schema.SchemaError,\n WorkspaceServices\n> =>\n Effect.gen(function* list() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const text = yield* fs.readFileString(path.join(root, \"pnpm-workspace.yaml\"));\n const raw: unknown = parse(text);\n const workspace = yield* decodeWorkspace(raw);\n const found = yield* listGitFiles(\n root,\n pipe(workspace.packages ?? [], Arr.map(manifestPathspec)),\n );\n return [\"package.json\", ...Arr.sort(found, Str.Order)];\n });\n\nconst dependenciesOf =\n (manifest: string) =>\n (fields: typeof Manifest.Type): Effect.Effect<readonly Dependency[], Schema.SchemaError> =>\n pipe(\n DEPENDENCY_FIELDS,\n Effect.forEach((field) =>\n decodeSpecifiers(fields[field] ?? {}).pipe(\n Effect.map((specifiers) =>\n pipe(\n Rec.toEntries(specifiers),\n Arr.map(([name, specifier]) => ({ manifest, field, name, specifier })),\n ),\n ),\n ),\n ),\n Effect.map(Arr.flatten),\n );\n\n/** @internal */\nexport const listDependencies = (\n root: string,\n): Effect.Effect<\n readonly Dependency[],\n PlatformError.PlatformError | Schema.SchemaError,\n WorkspaceServices\n> =>\n Effect.gen(function* list() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifests = yield* listManifests(root);\n const parsed = yield* pipe(\n manifests,\n Effect.forEach((manifest) =>\n fs\n .readFileString(path.join(root, manifest))\n .pipe(Effect.flatMap(decodeManifest), Effect.flatMap(dependenciesOf(manifest))),\n ),\n );\n return Arr.flatten(parsed);\n });\n","import { Effect, Array as Arr, String as Str, pipe } from \"effect\";\nimport { minimatch } from \"minimatch\";\n\nimport { checkDependencies } from \"./dependency-rules.ts\";\nimport { listGitFiles } from \"./git.ts\";\nimport { withSection } from \"./section-check.ts\";\nimport { checkSlices } from \"./steiger.ts\";\nimport { listDependencies } from \"./workspace.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 { Array as Arr, pipe } from \"effect\";\nimport { stringify } from \"smol-toml\";\n\nimport type { BetterleaksConfig } from \"./types.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, Function as Fn } from \"effect\";\nimport type { FileSystem, Path, PlatformError } from \"effect\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport type { Binary } from \"./binaries.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport { locateBinary } from \"./install.ts\";\nimport { runCaptured } from \"./process.ts\";\nimport type { Invocation } from \"./process.ts\";\nimport type { Report } from \"./report.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, FileSystem, Function as Fn, String as Str } from \"effect\";\nimport type { PlatformError, Scope } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { toBetterleaksToml, toIgnoreFile } from \"./betterleaks.ts\";\nimport { BETTERLEAKS } from \"./binaries.ts\";\nimport type { CheckError, CheckServices } from \"./check.ts\";\nimport { toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\nimport { withSection } from \"./section-check.ts\";\nimport type { BetterleaksConfig } from \"./types.ts\";\nimport { runVendored } from \"./vendored.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 { 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 { attempt } from \"./attempt.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\nimport type { MarkdownlintConfig } from \"./types.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 { Array as Arr, Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport type { TextlintConfig } from \"./types.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: `${name}/${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 = {}, ...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 { attempt } from \"./attempt.ts\";\nimport { toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\nimport { presetRulesOf, rawConfigOf } from \"./textlint-presets.ts\";\nimport type { TextlintConfig } from \"./types.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, pipe } from \"effect\";\n\nimport { lintCommitMessages } from \"./commitlint.ts\";\nimport { listCommitMessages, listGitFiles } from \"./git.ts\";\nimport { lintMarkdown } from \"./markdownlint.ts\";\nimport { withSection } from \"./section-check.ts\";\nimport { lintTexts } from \"./textlint.ts\";\n\nconst MARKDOWN = \"*.md\";\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\n/** @internal */\nexport const textlintCheck = withSection(\"textlint\", (config, { root }) =>\n markdownFiles(root, config.ignores).pipe(\n Effect.flatMap((files) => lintTexts(config, root, files)),\n ),\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 { Config, Effect, FileSystem, Option, Path, pipe } from \"effect\";\n\nimport { ACTIONLINT, ZIZMOR } from \"./binaries.ts\";\nimport type { Binary } from \"./binaries.ts\";\nimport type { Check } from \"./check.ts\";\nimport { runVendored } from \"./vendored.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 type { NamedCheck } from \"./check.ts\";\nimport { fallowCheck } from \"./fallow-check.ts\";\nimport { dependenciesCheck, steigerCheck } from \"./repository-checks.ts\";\nimport { betterleaksCheck } from \"./secret-checks.ts\";\nimport { commitlintCheck, markdownlintCheck, textlintCheck } from \"./text-checks.ts\";\nimport { actionlintCheck, zizmorCheck } from \"./workflow-checks.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 { CheckContext, CheckError, CheckServices, NamedCheck } from \"./check.ts\";\nimport { CHECKS } from \"./checks.ts\";\nimport { loadViteConfig } from \"./config.ts\";\nimport { checksFailed } from \"./errors.ts\";\nimport { writeTo } from \"./output.ts\";\nimport type { Report } from \"./report.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 Option,\n Array as Arr,\n Record as Rec,\n pipe,\n Function as Fn,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\n\nimport type { CommandEffect } from \"./command.ts\";\nimport { lintCommitMessages } from \"./commitlint.ts\";\nimport { loadSection } from \"./config.ts\";\nimport { checksFailed } from \"./errors.ts\";\nimport { finish } from \"./output.ts\";\nimport { runAllChecks } from \"./run-checks.ts\";\nimport { scanStagedSecrets } from \"./secret-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 --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 HOOKS: Readonly<Record<string, (root: string, rest: readonly string[]) => CommandEffect>> = {\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,MAAM,IAAI,CAAC,GACvC,OAAO,QAAQ,SAAS,GAAG,OAAO,IAAI,CAAC,CAAC,KAAK,OAAO,oBAAoB,KAAK,CAAC,CAAC,CACjF;CACA,OAAO,OAAO,OAAO,WAAWA,MAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAClD,OAAO,eAAe,cAAc,0BAA0B,MAAM,CAAC,CACvE;AACF,CAAC;;AAGH,MAAa,kBACX,SAEA,eAAe,IAAI,CAAC,CAAC,KACnB,OAAO,SAAS,SAAS,QAAQ,aAAa,CAAC,OAAO,sBAAsB,IAAI,CAAC,CAAC,CACpF;AAEF,MAAM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