@r_masseater/vite-plus-adopt 0.4.1 → 0.5.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/README.md +1 -69
- package/dist/attempt-B93fjWiJ.mjs.map +1 -1
- package/dist/attw.mjs.map +1 -1
- package/dist/cli.mjs +45 -17
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BdAPwzCc.mjs → config-BR_LIdmG.mjs} +3 -1
- package/dist/config-BR_LIdmG.mjs.map +1 -0
- package/dist/fsd.d.mts +3 -3
- package/dist/fsd.mjs.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +1 -1
- package/dist/{install-C-6lZ_z7.mjs → install-D6kuA6Oe.mjs} +7 -2
- package/dist/install-D6kuA6Oe.mjs.map +1 -0
- package/dist/json-D-rhjlSM.mjs.map +1 -1
- package/dist/postinstall.mjs +1 -1
- package/dist/{types-LygeEwCK.d.mts → types-D-w4yqEn.d.mts} +2 -1
- package/package.json +2 -2
- package/dist/config-BdAPwzCc.mjs.map +0 -1
- package/dist/install-C-6lZ_z7.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as ZIZMOR, c as writeTo, i as BETTERLEAKS, n as locateBinary, o as runCli, r as ACTIONLINT, s as finish } from "./install-
|
|
2
|
+
import { a as ZIZMOR, c as writeTo, i as BETTERLEAKS, n as locateBinary, o as runCli, r as ACTIONLINT, s as finish } from "./install-D6kuA6Oe.mjs";
|
|
3
3
|
import { a as toolFailed, r as checksFailed, t as attempt } from "./attempt-B93fjWiJ.mjs";
|
|
4
|
-
import { n as loadViteConfig, t as loadSection } from "./config-
|
|
4
|
+
import { n as loadViteConfig, t as loadSection } from "./config-BR_LIdmG.mjs";
|
|
5
5
|
import { n as toJson } from "./json-D-rhjlSM.mjs";
|
|
6
6
|
import { Array, Config, Effect, FileSystem, Function, Option, Path, Predicate, Record, Schema, Stdio, Stream, String, pipe } from "effect";
|
|
7
7
|
import format from "@commitlint/format";
|
|
@@ -33,6 +33,7 @@ const lintOptionsOf = (loaded) => ({
|
|
|
33
33
|
ignores: loaded.ignores ?? [],
|
|
34
34
|
defaultIgnores: loaded.defaultIgnores ?? true
|
|
35
35
|
});
|
|
36
|
+
/** @internal */
|
|
36
37
|
const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$3, (config, root, messages) => Effect.gen(function* lintMessages() {
|
|
37
38
|
const loaded = yield* attempt("commitlint")(() => load(config, { cwd: root }));
|
|
38
39
|
const results = yield* pipe(messages, Effect.forEach((message) => attempt("commitlint")(() => lint(message, loaded.rules, lintOptionsOf(loaded)))));
|
|
@@ -41,7 +42,7 @@ const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$3, (config, root, me
|
|
|
41
42
|
output: format({ results }, { color: false })
|
|
42
43
|
};
|
|
43
44
|
}));
|
|
44
|
-
|
|
45
|
+
Function.dual(DATA_FIRST_ARITY_3$3, (config, root, messageFile) => Effect.gen(function* read() {
|
|
45
46
|
const message = yield* (yield* FileSystem.FileSystem).readFileString(messageFile);
|
|
46
47
|
return yield* lintCommitMessages(config, root, [message]);
|
|
47
48
|
}));
|
|
@@ -51,6 +52,7 @@ const stdinOf = (input) => pipe(Option.fromNullishOr(input), Option.match({
|
|
|
51
52
|
onNone: () => "ignore",
|
|
52
53
|
onSome: (text) => Stream.make(new TextEncoder().encode(text))
|
|
53
54
|
}));
|
|
55
|
+
/** @internal */
|
|
54
56
|
const runCaptured = ({ root, file, args, env = {}, input, output = "all" }) => Effect.gen(function* run() {
|
|
55
57
|
const handle = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).spawn(ChildProcess.make(file, args, {
|
|
56
58
|
cwd: root,
|
|
@@ -64,7 +66,7 @@ const runCaptured = ({ root, file, args, env = {}, input, output = "all" }) => E
|
|
|
64
66
|
output: text
|
|
65
67
|
};
|
|
66
68
|
}).pipe(Effect.scoped);
|
|
67
|
-
|
|
69
|
+
/** @internal */
|
|
68
70
|
const withSection = Function.dual(2, (key, run) => (context) => pipe(Option.fromNullishOr(context.config[key]), Option.match({
|
|
69
71
|
onNone: () => Effect.succeedNone,
|
|
70
72
|
onSome: (section) => Effect.asSome(run(section, context))
|
|
@@ -148,9 +150,10 @@ const runFallow = (config, root) => Effect.gen(function* fallow() {
|
|
|
148
150
|
output: pipe(all, Array.filter((report) => !report.valid), Array.map((report) => report.output), Array.join("\n"))
|
|
149
151
|
};
|
|
150
152
|
}).pipe(Effect.scoped);
|
|
153
|
+
/** @internal */
|
|
151
154
|
const fallowCheck = withSection("fallow", (config, { root }) => runFallow(config, root));
|
|
152
155
|
// src/dependency-rules.ts
|
|
153
|
-
const DATA_FIRST_ARITY$
|
|
156
|
+
const DATA_FIRST_ARITY$4 = 2;
|
|
154
157
|
const SINGLE = 1;
|
|
155
158
|
const bannedBy = (dependencies) => ([reason, globs]) => {
|
|
156
159
|
const isBanned = (name) => pipe(globs, Array.some((glob) => minimatch(name, glob)));
|
|
@@ -195,14 +198,15 @@ const comparedDependencies = (rules, dependencies) => {
|
|
|
195
198
|
const isExact = inWorkspaces(exactGlobs(rules));
|
|
196
199
|
return pipe(dependencies, Array.filter(({ specifier }) => !String.startsWith("workspace:")(specifier)), Array.filter(Predicate.not(isExact)));
|
|
197
200
|
};
|
|
198
|
-
const checkDependencies = Function.dual(DATA_FIRST_ARITY$
|
|
201
|
+
const checkDependencies = Function.dual(DATA_FIRST_ARITY$4, (rules, dependencies) => [
|
|
199
202
|
...bannedProblems(rules, dependencies),
|
|
200
203
|
...exactProblems(rules, dependencies),
|
|
201
204
|
...versionProblems(rules, comparedDependencies(rules, dependencies))
|
|
202
205
|
]);
|
|
203
206
|
// src/git.ts
|
|
204
|
-
const DATA_FIRST_ARITY$
|
|
205
|
-
|
|
207
|
+
const DATA_FIRST_ARITY$3 = 2;
|
|
208
|
+
/** @internal */
|
|
209
|
+
const listGitFiles = Function.dual(DATA_FIRST_ARITY$3, (root, pathspecs) => Effect.gen(function* list() {
|
|
206
210
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
207
211
|
"-c",
|
|
208
212
|
"core.quotePath=false",
|
|
@@ -215,7 +219,8 @@ const listGitFiles = Function.dual(DATA_FIRST_ARITY$2, (root, pathspecs) => Effe
|
|
|
215
219
|
], { cwd: root }));
|
|
216
220
|
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
217
221
|
}));
|
|
218
|
-
|
|
222
|
+
/** @internal */
|
|
223
|
+
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$3, (root, range) => Effect.gen(function* messages() {
|
|
219
224
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
220
225
|
"log",
|
|
221
226
|
"-z",
|
|
@@ -233,6 +238,7 @@ const reportOf = (diagnostics, relative) => ({
|
|
|
233
238
|
valid: pipe(diagnostics, Array.every((diagnostic) => diagnostic.severity !== "error")),
|
|
234
239
|
output: pipe(diagnostics, Array.map(formatDiagnostic(relative)), Array.join("\n"))
|
|
235
240
|
});
|
|
241
|
+
/** @internal */
|
|
236
242
|
const checkSlices = Function.dual(DATA_FIRST_ARITY_3$2, (config, root, targets) => Effect.gen(function* check() {
|
|
237
243
|
const path = yield* Path.Path;
|
|
238
244
|
processConfiguration([...config], root);
|
|
@@ -271,6 +277,7 @@ const dependenciesOf = (manifest) => (fields) => pipe(DEPENDENCY_FIELDS, Effect.
|
|
|
271
277
|
name,
|
|
272
278
|
specifier
|
|
273
279
|
})))))), Effect.map(Array.flatten));
|
|
280
|
+
/** @internal */
|
|
274
281
|
const listDependencies = (root) => Effect.gen(function* list() {
|
|
275
282
|
const fs = yield* FileSystem.FileSystem;
|
|
276
283
|
const path = yield* Path.Path;
|
|
@@ -279,9 +286,11 @@ const listDependencies = (root) => Effect.gen(function* list() {
|
|
|
279
286
|
return Array.flatten(parsed);
|
|
280
287
|
});
|
|
281
288
|
// src/repository-checks.ts
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
|
|
289
|
+
const LAYER_FOLDER = /\/(?:app|pages|widgets|features|entities|shared)\//gu;
|
|
290
|
+
const layeredDirectories = (root, patterns) => listGitFiles(root, []).pipe(Effect.map((files) => pipe(files, Array.flatMap((file) => Array.map(Array.fromIterable(String.matchAll(LAYER_FOLDER)(file)), ({ index }) => String.takeLeft(file, index ?? file.length))), Array.dedupe, Array.filter((directory) => pipe(patterns, Array.some((pattern) => minimatch(directory, pattern)))))));
|
|
291
|
+
/** @internal */
|
|
292
|
+
const steigerCheck = withSection("steiger", (section, { root }) => layeredDirectories(root, section.paths).pipe(Effect.flatMap((targets) => checkSlices(section.rules, root, targets))));
|
|
293
|
+
/** @internal */
|
|
285
294
|
const dependenciesCheck = withSection("dependencyRules", (rules, { root }) => listDependencies(root).pipe(Effect.map((dependencies) => {
|
|
286
295
|
const problems = checkDependencies(rules, dependencies);
|
|
287
296
|
return {
|
|
@@ -295,7 +304,7 @@ const toBetterleaksToml = (config) => {
|
|
|
295
304
|
return stringify(rest);
|
|
296
305
|
};
|
|
297
306
|
const toIgnoreFile = (config) => pipe(config.ignoredSecrets ?? [], Array.map((digest) => `${digest}\n`), Array.join(""));
|
|
298
|
-
|
|
307
|
+
/** @internal */
|
|
299
308
|
const runVendored = Function.dual(2, (binary, invocation) => locateBinary(binary).pipe(Effect.flatMap((file) => runCaptured({
|
|
300
309
|
...invocation,
|
|
301
310
|
file
|
|
@@ -364,6 +373,7 @@ const scanCommittedTree = (config, root) => Effect.gen(function* tree() {
|
|
|
364
373
|
args: [directory]
|
|
365
374
|
});
|
|
366
375
|
}).pipe(Effect.scoped);
|
|
376
|
+
/** @internal */
|
|
367
377
|
const betterleaksCheck = withSection("betterleaks", (config, { root, base }) => lacksHistory(root).pipe(Effect.flatMap((partial) => {
|
|
368
378
|
if (partial) return scanCommittedTree(config, root);
|
|
369
379
|
return scanSecrets({
|
|
@@ -385,6 +395,7 @@ const STAGED_DIFF = [
|
|
|
385
395
|
"--src-prefix=a/",
|
|
386
396
|
"--dst-prefix=b/"
|
|
387
397
|
];
|
|
398
|
+
/** @internal */
|
|
388
399
|
const scanStagedSecrets = Function.dual(DATA_FIRST_ARITY$1, (config, root) => Effect.gen(function* staged() {
|
|
389
400
|
const diff = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", STAGED_DIFF, { cwd: root }));
|
|
390
401
|
return yield* scanSecrets({
|
|
@@ -411,6 +422,7 @@ const optionsOf = (config, files) => ({
|
|
|
411
422
|
onSome: (rules) => ({ customRules: [...rules] })
|
|
412
423
|
}))
|
|
413
424
|
});
|
|
425
|
+
/** @internal */
|
|
414
426
|
const lintMarkdown = Function.dual(DATA_FIRST_ARITY_3$1, (config, root, files) => Effect.gen(function* markdown() {
|
|
415
427
|
const path = yield* Path.Path;
|
|
416
428
|
const absolute = pipe(files, Array.map((file) => path.join(root, file)));
|
|
@@ -436,6 +448,7 @@ const descriptorOf = (loaded, root) => {
|
|
|
436
448
|
configBaseDir: root
|
|
437
449
|
}));
|
|
438
450
|
};
|
|
451
|
+
/** @internal */
|
|
439
452
|
const lintTexts = Function.dual(DATA_FIRST_ARITY_3, (config, root, files) => Effect.gen(function* lint() {
|
|
440
453
|
const path = yield* Path.Path;
|
|
441
454
|
const { ignores: _ignores, ...rawConfig } = config;
|
|
@@ -459,8 +472,11 @@ const lintTexts = Function.dual(DATA_FIRST_ARITY_3, (config, root, files) => Eff
|
|
|
459
472
|
// src/text-checks.ts
|
|
460
473
|
const MARKDOWN = "*.md";
|
|
461
474
|
const markdownFiles = (root, ignores = []) => listGitFiles(root, [MARKDOWN, ...pipe(ignores, Array.map((glob) => `:(glob,exclude)${glob}`))]);
|
|
475
|
+
/** @internal */
|
|
462
476
|
const textlintCheck = withSection("textlint", (config, { root }) => markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintTexts(config, root, files))));
|
|
477
|
+
/** @internal */
|
|
463
478
|
const markdownlintCheck = withSection("markdownlint", (config, { root }) => markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintMarkdown(config, root, files))));
|
|
479
|
+
/** @internal */
|
|
464
480
|
const commitlintCheck = withSection("commitlint", (config, { root, base }) => listCommitMessages(root, `${base}..HEAD`).pipe(Effect.flatMap((messages) => lintCommitMessages(config, root, messages))));
|
|
465
481
|
// src/workflow-checks.ts
|
|
466
482
|
const WORKFLOWS = ".github/workflows";
|
|
@@ -475,6 +491,7 @@ const onWorkflows = (binary, args) => ({ root }) => Effect.gen(function* workflo
|
|
|
475
491
|
});
|
|
476
492
|
return Option.some(ran);
|
|
477
493
|
});
|
|
494
|
+
/** @internal */
|
|
478
495
|
const actionlintCheck = onWorkflows(ACTIONLINT, Effect.succeed([]));
|
|
479
496
|
const zizmorArgs = Effect.gen(function* zizmorArgs() {
|
|
480
497
|
const remote = yield* Config.option(Config.String("CLAUDE_CODE_REMOTE")).pipe(Effect.orDie);
|
|
@@ -483,6 +500,7 @@ const zizmorArgs = Effect.gen(function* zizmorArgs() {
|
|
|
483
500
|
onSome: () => ["--no-online-audits", ".github"]
|
|
484
501
|
}));
|
|
485
502
|
});
|
|
503
|
+
/** @internal */
|
|
486
504
|
const zizmorCheck = onWorkflows(ZIZMOR, zizmorArgs);
|
|
487
505
|
// src/checks.ts
|
|
488
506
|
const CHECKS = [
|
|
@@ -547,6 +565,7 @@ const runCheck = (context) => ({ name, run }) => run(context).pipe(Effect.map(Op
|
|
|
547
565
|
name,
|
|
548
566
|
report
|
|
549
567
|
}))));
|
|
568
|
+
/** @internal */
|
|
550
569
|
const runAllChecks = (root) => Effect.gen(function* all() {
|
|
551
570
|
const config = yield* loadViteConfig(root);
|
|
552
571
|
const base = yield* resolveBase(root);
|
|
@@ -566,18 +585,27 @@ const DATA_FIRST_ARITY = 2;
|
|
|
566
585
|
const USAGE = pipe([
|
|
567
586
|
"Usage: vpa run every check configured in vite.config.ts",
|
|
568
587
|
" vpa --staged scan the staged changes for secrets (pre-commit)",
|
|
569
|
-
" vpa --commit-msg <file> lint a commit message (commit-msg)"
|
|
588
|
+
" vpa --commit-msg <file> lint a commit message (commit-msg)",
|
|
589
|
+
" vpa --message <text> lint a message"
|
|
570
590
|
], Array.join("\n"));
|
|
571
591
|
const usage = Effect.fail(checksFailed(USAGE));
|
|
572
592
|
const stagedSecrets = (root) => loadSection(root, "betterleaks").pipe(Effect.flatMap((config) => scanStagedSecrets(config, root)), Effect.flatMap(finish));
|
|
573
|
-
const
|
|
593
|
+
const lintMessage = (toMessage) => (root, rest) => pipe(Array.head(rest), Option.match({
|
|
574
594
|
onNone: () => usage,
|
|
575
|
-
onSome: (
|
|
595
|
+
onSome: (argument) => Effect.gen(function* lintGiven() {
|
|
596
|
+
const message = yield* toMessage(argument);
|
|
597
|
+
const config = yield* loadSection(root, "commitlint");
|
|
598
|
+
const report = yield* lintCommitMessages(config, root, [message]);
|
|
599
|
+
return yield* finish(report);
|
|
600
|
+
})
|
|
576
601
|
}));
|
|
602
|
+
const readMessage = (file) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)));
|
|
577
603
|
const HOOKS = {
|
|
578
604
|
"--staged": stagedSecrets,
|
|
579
|
-
"--commit-msg":
|
|
605
|
+
"--commit-msg": lintMessage(readMessage),
|
|
606
|
+
"--message": lintMessage(Effect.succeed)
|
|
580
607
|
};
|
|
608
|
+
/** @internal */
|
|
581
609
|
const runVpa = Function.dual(DATA_FIRST_ARITY, (root, args) => pipe(args, Array.match({
|
|
582
610
|
onEmpty: () => runAllChecks(root),
|
|
583
611
|
onNonEmpty: ([flag, ...rest]) => pipe(Record.get(HOOKS, flag), Option.match({
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["DATA_FIRST_ARITY_3","Fn","Arr","SUCCESS","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","Str","Arr","Arr","Fn","DATA_FIRST_ARITY","Str","Fn","DATA_FIRST_ARITY_3","Arr","Fn","lint","Rec","Fn","Arr","Arr","Arr","Arr","Fn","Rec"],"sources":["../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","../src/cli.ts"],"sourcesContent":["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\nconst 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\nconst 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\n/** @internal */\nexport { lintCommitMessageFile, lintCommitMessages };\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\ninterface 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\nconst 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\n/** @internal */\nexport { runCaptured };\n/** @internal */\nexport type { Invocation };\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\ntype 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\nconst 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\n/** @internal */\nexport { withSection };\n/** @internal */\nexport type { SectionRun };\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\nconst fallowCheck = withSection(\"fallow\", (config, { root }) => runFallow(config, root));\n\n/** @internal */\nexport { fallowCheck };\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\nconst 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\nexport { checkDependencies };\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\nconst 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\nconst 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\n/** @internal */\nexport { listCommitMessages, listGitFiles };\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\nconst 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\n/** @internal */\nexport { checkSlices };\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\ntype DependencyField = (typeof DEPENDENCY_FIELDS)[number];\n\ninterface Dependency {\n readonly manifest: string;\n readonly field: DependencyField;\n readonly name: string;\n readonly specifier: string;\n}\n\ntype 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\nconst 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\n/** @internal */\nexport { listDependencies };\n/** @internal */\nexport type { Dependency, DependencyField, WorkspaceServices };\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 ancestorsOf = (file: string): readonly string[] =>\n pipe(\n Str.split(file, \"/\"),\n Arr.initNonEmpty,\n Arr.scan(\"\", (parent, segment) => Arr.join(Arr.filter([parent, segment], Str.isNonEmpty), \"/\")),\n Arr.filter(Str.isNonEmpty),\n );\n\nconst matchingDirectories = (\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(ancestorsOf),\n Arr.dedupe,\n Arr.filter((directory) =>\n pipe(\n patterns,\n Arr.some((pattern) => minimatch(directory, pattern)),\n ),\n ),\n ),\n ),\n );\n\nconst steigerCheck = withSection(\"steiger\", (section, { root }) =>\n matchingDirectories(root, section.paths).pipe(\n Effect.flatMap((targets) => checkSlices(section.rules, root, targets)),\n ),\n);\n\nconst 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\n/** @internal */\nexport { dependenciesCheck, steigerCheck };\n","import { Array as Arr, pipe } from \"effect\";\nimport { stringify } from \"smol-toml\";\n\nimport type { BetterleaksConfig } from \"./types.ts\";\n\nconst toBetterleaksToml = (config: BetterleaksConfig): string => {\n const { ignoredSecrets: _ignoredSecrets, ...rest } = config;\n return stringify(rest);\n};\n\nconst toIgnoreFile = (config: BetterleaksConfig): string =>\n pipe(\n config.ignoredSecrets ?? [],\n Arr.map((digest) => `${digest}\\n`),\n Arr.join(\"\"),\n );\n\nexport { toBetterleaksToml, toIgnoreFile };\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\nconst 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\n/** @internal */\nexport { runVendored };\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\nconst 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\nconst 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\n/** @internal */\nexport { betterleaksCheck, scanStagedSecrets };\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\nconst 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\n/** @internal */\nexport { lintMarkdown };\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\nconst 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\n/** @internal */\nexport { lintTexts };\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\nconst textlintCheck = withSection(\"textlint\", (config, { root }) =>\n markdownFiles(root, config.ignores).pipe(\n Effect.flatMap((files) => lintTexts(config, root, files)),\n ),\n);\n\nconst markdownlintCheck = withSection(\"markdownlint\", (config, { root }) =>\n markdownFiles(root, config.ignores).pipe(\n Effect.flatMap((files) => lintMarkdown(config, root, files)),\n ),\n);\n\nconst commitlintCheck = withSection(\"commitlint\", (config, { root, base }) =>\n listCommitMessages(root, `${base}..HEAD`).pipe(\n Effect.flatMap((messages) => lintCommitMessages(config, root, messages)),\n ),\n);\n\n/** @internal */\nexport { commitlintCheck, markdownlintCheck, textlintCheck };\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\nconst 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\nconst zizmorCheck = onWorkflows(ZIZMOR, zizmorArgs);\n\n/** @internal */\nexport { actionlintCheck, zizmorCheck };\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\nconst 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\nexport { CHECKS };\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\nconst runAllChecks = (root: string): 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\n/** @internal */\nexport { runAllChecks };\n","import { Effect, Option, Array as Arr, Record as Rec, pipe, Function as Fn } from \"effect\";\n\nimport type { CommandEffect } from \"./command.ts\";\nimport { lintCommitMessageFile } 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 ],\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 commitMessage = (root: string, rest: readonly string[]): CommandEffect =>\n pipe(\n Arr.head(rest),\n Option.match({\n onNone: () => usage,\n onSome: (file) =>\n loadSection(root, \"commitlint\").pipe(\n Effect.flatMap((config) => lintCommitMessageFile(config, root, file)),\n Effect.flatMap(finish),\n ),\n }),\n );\n\nconst HOOKS: Readonly<Record<string, (root: string, rest: readonly string[]) => CommandEffect>> = {\n \"--staged\": stagedSecrets,\n \"--commit-msg\": commitMessage,\n};\n\nconst 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\n/** @internal */\nexport { runVpa };\n","import { Effect, Path, Stdio } from \"effect\";\n\nimport { runCli } from \"./run-cli.ts\";\nimport { runVpa } from \"./vpa.ts\";\n\nrunCli(\n Effect.gen(function* main() {\n const stdio = yield* Stdio.Stdio;\n const path = yield* Path.Path;\n const args = yield* stdio.args;\n return yield* runVpa(path.resolve(\".\"), args);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,uBAAqB;AAE3B,MAAM,eAAe;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/B,OAAO,SAAS,WAAW,kBAAkB,QAAQ,IAAI,CAAC,GAC1D,OAAO,QAAQ,MAAM,CACvB;AAEF,MAAM,iBAAiB,MAAc,SACnC,KACEA,MAAI,KAAK,IAAI,GACb,OAAO,MAAM;CACX,cAAc;CACd,SAAS,SACP,YAAY,MAAM,YAAY,CAAC,CAAC,KAC9B,OAAO,SAAS,WAAW,sBAAsB,QAAQ,MAAM,IAAI,CAAC,GACpE,OAAO,QAAQ,MAAM,CACvB;AACJ,CAAC,CACH;AAEF,MAAM,QAA4F;CAChG,YAAY;CACZ,gBAAgB;AAClB;AAEA,MAAM,SAGFC,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;;ACzDA,OACE,OAAO,IAAI,UAAU,OAAO;CAC1B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,OAAO,OAAO,MAAM;CAC1B,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,GAAG,IAAI;AAC9C,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["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/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","../src/cli.ts"],"sourcesContent":["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","import { Effect, Path, Stdio } from \"effect\";\n\nimport { runCli } from \"./run-cli.ts\";\nimport { runVpa } from \"./vpa.ts\";\n\nrunCli(\n Effect.gen(function* main() {\n const stdio = yield* Stdio.Stdio;\n const path = yield* Path.Path;\n const args = yield* stdio.args;\n return yield* runVpa(path.resolve(\".\"), args);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,uBAAqB;AAE3B,MAAM,eAAe;AAErB,MAAM,mBAAmB,WAAoE;CAO3F,OAAO;EAAE,GANM,KACb,OAAO,cAAc,OAAO,YAAY,GACxC,OAAO,KAAK,EAAE,iBAAiB,UAAU,GACzC,OAAO,OAAO,UAAU,QAAQ,GAChC,OAAO,iBAAiB,CAAC,EAAE,CAEZ;EAAG,aAAa;CAAa;AAChD;AAEA,MAAM,iBAAiB,YAA0C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,SAAS,OAAO,mBAAmB,QAAQ,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;;AClFA,OACE,OAAO,IAAI,UAAU,OAAO;CAC1B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,OAAO,OAAO,MAAM;CAC1B,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,GAAG,IAAI;AAC9C,CAAC,CACH"}
|
|
@@ -14,9 +14,11 @@ const findConfigFile = (root) => Effect.gen(function* find() {
|
|
|
14
14
|
const existing = yield* pipe(CONFIG_FILES, Array.map((name) => path.join(root, name)), Effect.filter((file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false))));
|
|
15
15
|
return yield* Effect.fromOption(Array.head(existing)).pipe(Effect.mapError(() => configMissing(`No vite.config file in ${root}`)));
|
|
16
16
|
});
|
|
17
|
+
/** @internal */
|
|
17
18
|
const loadViteConfig = (root) => findConfigFile(root).pipe(Effect.flatMap((file) => attempt("vite.config")(() => resolveConfigFromFile(file))));
|
|
18
19
|
const requireSection = (key) => (config) => Effect.fromOption(Option.fromNullishOr(config[key])).pipe(Effect.mapError(() => configMissing(`vite.config has no "${key}" section`)));
|
|
20
|
+
/** @internal */
|
|
19
21
|
const loadSection = Function.dual(2, (root, key) => loadViteConfig(root).pipe(Effect.flatMap(requireSection(key))));
|
|
20
22
|
export { loadViteConfig as n, loadSection as t };
|
|
21
23
|
|
|
22
|
-
//# sourceMappingURL=config-
|
|
24
|
+
//# sourceMappingURL=config-BR_LIdmG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-BR_LIdmG.mjs","names":["Arr","Fn"],"sources":["../src/config.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"],"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,cAQTC,SAAG,KACL,IAEE,MACA,QAEA,eAAe,IAAI,CAAC,CAAC,KAAK,OAAO,QAAQ,eAAe,GAAG,CAAC,CAAC,CACjE"}
|
package/dist/fsd.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { s as SteigerConfig } from "./types-
|
|
2
|
-
interface FsdPlugin {
|
|
1
|
+
import { s as SteigerConfig } from "./types-D-w4yqEn.mjs";
|
|
2
|
+
export interface FsdPlugin {
|
|
3
3
|
readonly plugin: SteigerConfig[number];
|
|
4
4
|
readonly configs: {
|
|
5
5
|
readonly recommended: SteigerConfig;
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
8
|
declare const plugin: FsdPlugin;
|
|
9
|
-
export {
|
|
9
|
+
export { plugin as default };
|
|
10
10
|
//# sourceMappingURL=fsd.d.mts.map
|