@r_masseater/vite-plus-adopt 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as runCli } from "./run-cli-CSEt6b4a.mjs";
3
- import { t as runVpa } from "./vpa-DvIGHBf6.mjs";
3
+ import { t as runVpa } from "./vpa-Cq7jIoC7.mjs";
4
4
  import { Effect, Path, Stdio } from "effect";
5
5
  // src/cli.ts
6
6
  runCli(Effect.gen(function* main() {
package/dist/fsd.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { s as SteigerConfig } from "./types-Cxh9JcmN.mjs";
1
+ import { s as SteigerConfig } from "./types-roDZO7vm.mjs";
2
2
  export interface FsdPlugin {
3
3
  readonly plugin: SteigerConfig[number];
4
4
  readonly configs: {
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as FallowConfig, c as SteigerSection, i as DependencyRules, l as TextlintConfig, n as BetterleaksRule, o as MarkdownlintConfig, r as CommitlintConfig, s as SteigerConfig, t as BetterleaksConfig, u as ToolSections } from "./types-Cxh9JcmN.mjs";
1
+ import { a as FallowConfig, c as SteigerSection, i as DependencyRules, l as TextlintConfig, n as BetterleaksRule, o as MarkdownlintConfig, r as CommitlintConfig, s as SteigerConfig, t as BetterleaksConfig, u as ToolSections } from "./types-roDZO7vm.mjs";
2
2
  import { Effect, FileSystem, Path, PlatformError, Schema, Stdio } from "effect";
3
3
  import { ChildProcessSpawner } from "effect/process";
4
4
  declare const VpToolsError_base: Schema.Class<VpToolsError, Schema.TaggedStruct<"VpToolsError", {
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as loadViteConfig, t as runVpa } from "./vpa-DvIGHBf6.mjs";
1
+ import { n as loadViteConfig, t as runVpa } from "./vpa-Cq7jIoC7.mjs";
2
2
  import { l as VpToolsError } from "./install-Cj_2weFd.mjs";
3
3
  export { VpToolsError, loadViteConfig, runVpa };
@@ -2,6 +2,7 @@ import { Effect, FileSystem, Path, PlatformError, Schema } from "effect";
2
2
  import { ChildProcessSpawner } from "effect/process";
3
3
  import { defineConfig } from "steiger";
4
4
  import { TextlintRcConfig } from "@textlint/config-loader";
5
+ import { TextlintKernelRule } from "@textlint/kernel";
5
6
  import { UserConfig } from "@commitlint/types";
6
7
  import { Configuration, Rule } from "markdownlint";
7
8
  declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
@@ -39,8 +40,14 @@ interface BetterleaksConfig {
39
40
  readonly rules?: readonly BetterleaksRule[];
40
41
  readonly ignoredSecrets?: readonly string[];
41
42
  }
43
+ type TextlintRuleOptions = NonNullable<TextlintKernelRule["options"]>;
44
+ interface TextlintPreset {
45
+ readonly rules: Readonly<Record<string, TextlintKernelRule["rule"]>>;
46
+ readonly rulesConfig: Readonly<Record<string, TextlintRuleOptions>>;
47
+ }
42
48
  interface TextlintConfig extends TextlintRcConfig {
43
49
  readonly ignores?: readonly string[];
50
+ readonly presets?: Readonly<Record<string, TextlintPreset>>;
44
51
  }
45
52
  interface MarkdownlintConfig {
46
53
  readonly config?: Configuration;
@@ -77,4 +84,4 @@ declare module "vite" {
77
84
  interface UserConfig extends ToolSections {}
78
85
  }
79
86
  export { FallowConfig as a, SteigerSection as c, DependencyRules as i, TextlintConfig as l, BetterleaksRule as n, MarkdownlintConfig as o, CommitlintConfig as r, SteigerConfig as s, BetterleaksConfig as t, ToolSections as u };
80
- //# sourceMappingURL=types-Cxh9JcmN.d.mts.map
87
+ //# sourceMappingURL=types-roDZO7vm.d.mts.map
@@ -453,12 +453,35 @@ const lintMarkdown = Function.dual(DATA_FIRST_ARITY_3$1, (config, root, files) =
453
453
  output: Array.join(lines, "\n")
454
454
  };
455
455
  }));
456
+ // src/textlint-presets.ts
457
+ const NO_OPTIONS = {};
458
+ const isRuleOptions = Predicate.or(Predicate.isBoolean, Predicate.isReadonlyObject);
459
+ /** @internal */
460
+ const presetRulesOf = (config) => {
461
+ const settings = config.rules ?? {};
462
+ return pipe(Record.toEntries(config.presets ?? {}), Array.filter(([name]) => Boolean(settings[name])), Array.flatMap(([name, preset]) => {
463
+ const userOptions = pipe(Option.liftPredicate(settings[name], Predicate.isReadonlyObject), Option.getOrElse(() => NO_OPTIONS));
464
+ return pipe(Record.toEntries(preset.rules), Array.map(([key, rule]) => ({
465
+ ruleId: `${name}/${key}`,
466
+ rule,
467
+ options: pipe(Record.get(userOptions, key), Option.filter((value) => value !== true), Option.filter(isRuleOptions), Option.getOrElse(() => preset.rulesConfig[key] ?? true))
468
+ })), Array.filter(({ options }) => options !== false));
469
+ }));
470
+ };
471
+ /** @internal */
472
+ const rawConfigOf = (config) => {
473
+ const { ignores: _ignores, presets = {}, ...rawConfig } = config;
474
+ return {
475
+ ...rawConfig,
476
+ rules: pipe(rawConfig.rules ?? {}, Record.filter((_setting, name) => !Record.has(presets, name)))
477
+ };
478
+ };
456
479
  // src/textlint.ts
457
480
  const DATA_FIRST_ARITY_3 = 3;
458
- const descriptorOf = (loaded, root) => {
481
+ const descriptorOf = (loaded, root, config) => {
459
482
  if (!loaded.ok) return Effect.fail(toolFailed("textlint")(loaded.error.message));
460
483
  return Effect.succeed(new TextlintKernelDescriptor({
461
- rules: loaded.config.rules,
484
+ rules: [...loaded.config.rules, ...presetRulesOf(config)],
462
485
  filterRules: loaded.config.filterRules,
463
486
  plugins: [...builtInPlugins, ...loaded.config.plugins],
464
487
  configBaseDir: root
@@ -467,13 +490,12 @@ const descriptorOf = (loaded, root) => {
467
490
  /** @internal */
468
491
  const lintTexts = Function.dual(DATA_FIRST_ARITY_3, (config, root, files) => Effect.gen(function* lint() {
469
492
  const path = yield* Path.Path;
470
- const { ignores: _ignores, ...rawConfig } = config;
471
493
  yield* attempt("textlint")(() => import("vite-plus/register"));
472
494
  const loaded = yield* attempt("textlint")(() => loadPackagesFromRawConfig({
473
- rawConfig,
495
+ rawConfig: rawConfigOf(config),
474
496
  node_moduleDir: path.join(root, "node_modules")
475
497
  }));
476
- const descriptor = yield* descriptorOf(loaded, root);
498
+ const descriptor = yield* descriptorOf(loaded, root, config);
477
499
  const absolute = pipe(files, Array.map((file) => path.join(root, file)));
478
500
  const results = yield* attempt("textlint")(() => createLinter({ descriptor }).lintFiles([...absolute]));
479
501
  const formatter = yield* attempt("textlint")(() => loadLinterFormatter({
@@ -631,4 +653,4 @@ const runVpa = Function.dual(DATA_FIRST_ARITY, (root, args) => pipe(args, Array.
631
653
  })));
632
654
  export { loadViteConfig as n, runVpa as t };
633
655
 
634
- //# sourceMappingURL=vpa-DvIGHBf6.mjs.map
656
+ //# sourceMappingURL=vpa-Cq7jIoC7.mjs.map
@@ -0,0 +1 @@
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,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,uBAAqB;AAE3B,MAAM,eAAe;AAErB,MAAM,mBAAmB,WAAoE;CAO3F,OAAO;EAAE,G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,MAAM,CAAC,OAAO,CAAC;EAChE,OAAO,OAAO,OAAO,MAAM;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.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Adopt Betterleaks, actionlint, zizmor, commitlint, textlint, Steiger and dependency checks into Vite+ through the settings in vite.config.ts, and ship the Feature-Sliced Design Steiger plugin and @arethetypeswrong/core for TypeScript 7.",
5
5
  "keywords": [
6
6
  "actionlint",
@@ -108,7 +108,7 @@
108
108
  "!dist/fsd.mjs",
109
109
  "!dist/attw.mjs"
110
110
  ],
111
- "limit": "11045 B"
111
+ "limit": "11233 B"
112
112
  },
113
113
  {
114
114
  "name": "fsd",
@@ -1 +0,0 @@
1
- {"version":3,"file":"vpa-DvIGHBf6.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","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.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 { 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 type { TextlintConfig } from \"./types.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst descriptorOf = (\n loaded: TextlintLoadPackagesFromRawConfigResult,\n root: string,\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,\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 const { ignores: _ignores, ...rawConfig } = config;\n yield* attempt(\"textlint\")(() => import(\"vite-plus/register\"));\n const loaded = yield* attempt(\"textlint\")(() =>\n loadPackagesFromRawConfig({ rawConfig, node_moduleDir: path.join(root, \"node_modules\") }),\n );\n const descriptor = yield* descriptorOf(loaded, root);\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,C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