@r_masseater/vite-plus-adopt 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -12
- package/dist/attw.mjs +5 -11
- package/dist/attw.mjs.map +1 -1
- package/dist/cli.mjs +21 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/fsd.d.mts +1 -1
- package/dist/fsd.mjs +3 -5
- package/dist/fsd.mjs.map +1 -1
- package/dist/{index-HXyQUvp_.d.mts → index-DyvYt7R0.d.mts} +4 -33
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -3
- package/dist/{vpa--jth0aBQ.mjs → vpa-MRYbih3E.mjs} +149 -156
- package/dist/vpa-MRYbih3E.mjs.map +1 -0
- package/package.json +39 -42
- package/skills/configure-checks/SKILL.md +12 -16
- package/dist/output-CeQIa6e5.mjs +0 -223
- package/dist/output-CeQIa6e5.mjs.map +0 -1
- package/dist/postinstall.d.mts +0 -1
- package/dist/postinstall.mjs +0 -19
- package/dist/postinstall.mjs.map +0 -1
- package/dist/run-cli-DIrqPoTy.mjs +0 -24
- package/dist/run-cli-DIrqPoTy.mjs.map +0 -1
- package/dist/vpa--jth0aBQ.mjs.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as ACTIONLINT, c as readTarGz, f as checksFailed, l as runCaptured, m as toolFailed, n as writeTo, o as BETTERLEAKS, p as configMissing, r as runVendored, s as ZIZMOR, t as finish, u as attempt } from "./output-CeQIa6e5.mjs";
|
|
2
1
|
import { n as toJson } from "./json-QtVKpodH.mjs";
|
|
3
2
|
import { n as processConfiguration, t as linter } from "./steiger-CbusAzht.mjs";
|
|
4
|
-
import { Array, Config, Context, Effect, Exit, FileSystem, Function, Layer, Option, Order, Path, Predicate, Record, Redacted, Schema, String, pipe } from "effect";
|
|
3
|
+
import { Array, Boolean as Boolean$1, Config, Context, Effect, Exit, FileSystem, Function, Layer, Option, Order, Path, Predicate, Record, Redacted, Schedule, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
5
4
|
import { resolveConfigFromFile } from "vite-plus";
|
|
6
5
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
|
|
7
6
|
import format from "@commitlint/format";
|
|
@@ -11,14 +10,42 @@ import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
|
11
10
|
import { loadPackagesFromRawConfig } from "@textlint/config-loader";
|
|
12
11
|
import { TextlintKernelDescriptor } from "@textlint/kernel";
|
|
13
12
|
import { createLinter, loadLinterFormatter } from "textlint";
|
|
14
|
-
import {
|
|
13
|
+
import { loadBuiltinPlugins } from "textlint/lib/src/loader/TextlintrcLoader.js";
|
|
15
14
|
import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils";
|
|
16
15
|
import { parse } from "yaml";
|
|
17
|
-
import {
|
|
16
|
+
import { Tar } from "effect/encoding";
|
|
17
|
+
import { format as format$1, makeDetector } from "@r_masseater/h56m";
|
|
18
18
|
import { minimatch } from "minimatch";
|
|
19
19
|
import { findWorkspaceProjectsNoCheck } from "@pnpm/workspace.projects-reader";
|
|
20
20
|
import { readWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-reader";
|
|
21
21
|
import { intersects, valid, validRange } from "semver";
|
|
22
|
+
// src/shared/lib/errors.ts
|
|
23
|
+
const taggedError = Schema.TaggedError;
|
|
24
|
+
var VpToolsError = class extends taggedError()("VpToolsError", {
|
|
25
|
+
kind: Schema.Literals([
|
|
26
|
+
"config-missing",
|
|
27
|
+
"tool-failed",
|
|
28
|
+
"checks-failed"
|
|
29
|
+
]),
|
|
30
|
+
message: Schema.String
|
|
31
|
+
}) {};
|
|
32
|
+
const configMissing = (message) => VpToolsError.make({
|
|
33
|
+
kind: "config-missing",
|
|
34
|
+
message
|
|
35
|
+
});
|
|
36
|
+
const checksFailed = (message) => VpToolsError.make({
|
|
37
|
+
kind: "checks-failed",
|
|
38
|
+
message
|
|
39
|
+
});
|
|
40
|
+
const toolFailed = (tool) => (cause) => VpToolsError.make({
|
|
41
|
+
kind: "tool-failed",
|
|
42
|
+
message: `${tool} failed: ${String(cause)}`
|
|
43
|
+
});
|
|
44
|
+
// src/shared/lib/attempt.ts
|
|
45
|
+
const attempt = (tool) => (run) => Effect.tryPromise({
|
|
46
|
+
try: run,
|
|
47
|
+
catch: toolFailed(tool)
|
|
48
|
+
});
|
|
22
49
|
// src/entities/vite-config/model/config.ts
|
|
23
50
|
const CONFIG_FILES = [
|
|
24
51
|
"vite.config.ts",
|
|
@@ -71,9 +98,9 @@ const withSection = Function.dual(2, (key, run) => (context) => pipe(Option.from
|
|
|
71
98
|
onSome: (section) => Effect.asSome(run(section, context))
|
|
72
99
|
})));
|
|
73
100
|
// src/shared/lib/git.ts
|
|
74
|
-
const DATA_FIRST_ARITY$
|
|
101
|
+
const DATA_FIRST_ARITY$4 = 2;
|
|
75
102
|
/** @internal */
|
|
76
|
-
const listGitFiles = Function.dual(DATA_FIRST_ARITY$
|
|
103
|
+
const listGitFiles = Function.dual(DATA_FIRST_ARITY$4, (root, pathspecs) => Effect.gen(function* list() {
|
|
77
104
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
78
105
|
"-c",
|
|
79
106
|
"core.quotePath=false",
|
|
@@ -84,10 +111,10 @@ const listGitFiles = Function.dual(DATA_FIRST_ARITY$3, (root, pathspecs) => Effe
|
|
|
84
111
|
"--",
|
|
85
112
|
...pathspecs
|
|
86
113
|
], { cwd: root }));
|
|
87
|
-
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
114
|
+
return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
|
|
88
115
|
}));
|
|
89
116
|
/** @internal */
|
|
90
|
-
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$
|
|
117
|
+
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$4, (root, range) => Effect.gen(function* messages() {
|
|
91
118
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
92
119
|
"log",
|
|
93
120
|
"-z",
|
|
@@ -96,7 +123,7 @@ const listCommitMessages = Function.dual(DATA_FIRST_ARITY$3, (root, range) => Ef
|
|
|
96
123
|
range,
|
|
97
124
|
"--"
|
|
98
125
|
], { cwd: root }));
|
|
99
|
-
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
126
|
+
return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
|
|
100
127
|
}));
|
|
101
128
|
// src/features/check-text/model/textlint-presets.ts
|
|
102
129
|
const NO_OPTIONS = {};
|
|
@@ -128,10 +155,11 @@ const rawConfigOf = (config) => {
|
|
|
128
155
|
const DATA_FIRST_ARITY_3$1 = 3;
|
|
129
156
|
const descriptorOf = (loaded, root, config) => {
|
|
130
157
|
if (!loaded.ok) return Effect.fail(toolFailed("textlint")(loaded.error.message));
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
158
|
+
const { rules, filterRules, plugins } = loaded.config;
|
|
159
|
+
return Effect.map(attempt("textlint")(loadBuiltinPlugins), (builtIn) => new TextlintKernelDescriptor({
|
|
160
|
+
rules: [...rules, ...presetRulesOf(config)],
|
|
161
|
+
filterRules,
|
|
162
|
+
plugins: [...builtIn.plugin.toKernelPluginsFormat(), ...plugins],
|
|
135
163
|
configBaseDir: root
|
|
136
164
|
}));
|
|
137
165
|
};
|
|
@@ -162,7 +190,7 @@ const markdownFiles = (root, ignores = []) => listGitFiles(root, [MARKDOWN, ...p
|
|
|
162
190
|
const sourceFiles = (root, files) => listGitFiles(root, pipe(files, Array.map((glob) => `${GLOB_PATHSPEC}${glob}`)));
|
|
163
191
|
const mergeReports = (reports) => ({
|
|
164
192
|
valid: pipe(reports, Array.every((report) => report.valid)),
|
|
165
|
-
output: pipe(reports, Array.map((report) => report.output), Array.filter(String.isNonEmpty), Array.join("\n"))
|
|
193
|
+
output: pipe(reports, Array.map((report) => report.output), Array.filter(String$1.isNonEmpty), Array.join("\n"))
|
|
166
194
|
});
|
|
167
195
|
/** @internal */
|
|
168
196
|
const textlintCheck = withSection("textlint", (config, { root }) => {
|
|
@@ -211,6 +239,26 @@ const skillCacheDirectory = Effect.gen(function* skillCache() {
|
|
|
211
239
|
const base = yield* baseDirectory;
|
|
212
240
|
return path.join(base, ...SUBDIRECTORY);
|
|
213
241
|
});
|
|
242
|
+
// src/shared/lib/process.ts
|
|
243
|
+
const SUCCESS$1 = 0;
|
|
244
|
+
const stdinOf = (input) => pipe(Option.fromNullishOr(input), Option.match({
|
|
245
|
+
onNone: () => "ignore",
|
|
246
|
+
onSome: (text) => Stream.make(new TextEncoder().encode(text))
|
|
247
|
+
}));
|
|
248
|
+
/** @internal */
|
|
249
|
+
const runCaptured = ({ root, file, args, env = {}, input, output = "all" }) => Effect.gen(function* run() {
|
|
250
|
+
const handle = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).spawn(ChildProcess.make(file, args, {
|
|
251
|
+
cwd: root,
|
|
252
|
+
env,
|
|
253
|
+
extendEnv: true,
|
|
254
|
+
stdin: stdinOf(input)
|
|
255
|
+
}));
|
|
256
|
+
const [text, exitCode] = yield* Effect.all([handle[output].pipe(Stream.decodeText, Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
257
|
+
return {
|
|
258
|
+
valid: exitCode === SUCCESS$1,
|
|
259
|
+
output: text
|
|
260
|
+
};
|
|
261
|
+
}).pipe(Effect.scoped);
|
|
214
262
|
// src/features/install-skills/model/link.ts
|
|
215
263
|
const KEEP = ".gitkeep";
|
|
216
264
|
const junction = (target, link) => runCaptured({
|
|
@@ -280,6 +328,17 @@ const linkSkills = (root) => (links) => Effect.gen(function* link() {
|
|
|
280
328
|
const next = yield* buildNext(agents, skills, links);
|
|
281
329
|
yield* swapIn(agents, skills, next);
|
|
282
330
|
});
|
|
331
|
+
// src/shared/lib/tar-gz.ts
|
|
332
|
+
const gunzipped = (data) => {
|
|
333
|
+
const compressed = new Blob([new Uint8Array(data)]).stream();
|
|
334
|
+
return attempt("gunzip")(() => new Response(compressed.pipeThrough(new DecompressionStream("gzip"))).arrayBuffer());
|
|
335
|
+
};
|
|
336
|
+
const untarred = (archive) => Stream.make(new Uint8Array(archive)).pipe(Stream.pipeThroughChannel(Tar.decode()), Stream.mapEffect(({ header, body }) => Effect.map(Stream.mkUint8Array(body), (bytes) => ({
|
|
337
|
+
header,
|
|
338
|
+
bytes
|
|
339
|
+
}))), Stream.runCollect, Effect.mapError(toolFailed("untar")));
|
|
340
|
+
/** @internal */
|
|
341
|
+
const readTarGz = (data) => Effect.flatMap(gunzipped(data), untarred);
|
|
283
342
|
const SKILL_FILE$1 = "SKILL.md";
|
|
284
343
|
const FRONTMATTER = /^---\r?\n(?<yaml>[\s\S]*?)\r?\n---/u;
|
|
285
344
|
const NEXT = 1;
|
|
@@ -290,9 +349,9 @@ const Frontmatter = Schema.Struct({ name: Schema.String });
|
|
|
290
349
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
291
350
|
const parseYaml = Option.liftThrowable((yaml) => parse(yaml));
|
|
292
351
|
const nameOf = (markdown) => pipe(Option.fromNullishOr(FRONTMATTER.exec(markdown)), Option.flatMap((found) => Option.fromNullishOr(found.groups)), Option.flatMap((groups) => Record.get(groups, "yaml")), Option.flatMap(parseYaml), Option.flatMap(decodeFrontmatter), Option.map(({ name }) => name));
|
|
293
|
-
const afterFirstSegment = (path) => pipe(path, String.indexOf("/"), Option.match({
|
|
352
|
+
const afterFirstSegment = (path) => pipe(path, String$1.indexOf("/"), Option.match({
|
|
294
353
|
onNone: () => path,
|
|
295
|
-
onSome: (at) => String.slice(at + NEXT)(path)
|
|
354
|
+
onSome: (at) => String$1.slice(at + NEXT)(path)
|
|
296
355
|
}));
|
|
297
356
|
const withoutTopDirectory = ({ header, bytes }) => ({
|
|
298
357
|
header: {
|
|
@@ -302,17 +361,17 @@ const withoutTopDirectory = ({ header, bytes }) => ({
|
|
|
302
361
|
bytes
|
|
303
362
|
});
|
|
304
363
|
/** @internal */
|
|
305
|
-
const isUnder = (directory) => (path) => directory === "" || String.startsWith(`${directory}/`)(path);
|
|
364
|
+
const isUnder = (directory) => (path) => directory === "" || String$1.startsWith(`${directory}/`)(path);
|
|
306
365
|
/** @internal */
|
|
307
366
|
const relativeTo = (directory) => (path) => {
|
|
308
367
|
if (directory === "") return path;
|
|
309
|
-
return String.slice(directory.length + NEXT)(path);
|
|
368
|
+
return String$1.slice(directory.length + NEXT)(path);
|
|
310
369
|
};
|
|
311
|
-
const parentOf = (path) => pipe(path, String.lastIndexOf("/"), Option.match({
|
|
370
|
+
const parentOf = (path) => pipe(path, String$1.lastIndexOf("/"), Option.match({
|
|
312
371
|
onNone: () => "",
|
|
313
|
-
onSome: (at) => String.slice(START, at)(path)
|
|
372
|
+
onSome: (at) => String$1.slice(START, at)(path)
|
|
314
373
|
}));
|
|
315
|
-
const isSkillFile = (root) => (entry) => entry.header.type === "File" && (entry.header.path === SKILL_FILE$1 || String.endsWith(`/${SKILL_FILE$1}`)(entry.header.path)) && isUnder(root)(entry.header.path);
|
|
374
|
+
const isSkillFile = (root) => (entry) => entry.header.type === "File" && (entry.header.path === SKILL_FILE$1 || String$1.endsWith(`/${SKILL_FILE$1}`)(entry.header.path)) && isUnder(root)(entry.header.path);
|
|
316
375
|
const isOutermost = (candidates) => ({ directory }) => !pipe(candidates, Array.some((other) => other.directory !== directory && isUnder(other.directory)(directory)));
|
|
317
376
|
const toFound = ({ directory, name }) => pipe(name, Option.map((found) => ({
|
|
318
377
|
name: found,
|
|
@@ -333,12 +392,16 @@ const skillsIn = ({ repository, source }) => (entries) => {
|
|
|
333
392
|
return Effect.succeed(found);
|
|
334
393
|
};
|
|
335
394
|
/** @internal */
|
|
336
|
-
const labelOf = ({ repository, source }) => `${repository}@${String.slice(START, SHORT_COMMIT)(source.commit)}`;
|
|
395
|
+
const labelOf = ({ repository, source }) => `${repository}@${String$1.slice(START, SHORT_COMMIT)(source.commit)}`;
|
|
396
|
+
const RETRY_DELAY = "1 second";
|
|
397
|
+
const RETRIES = 4;
|
|
337
398
|
const codeload = ({ repository, source }) => HttpClientRequest.get(`https://codeload.github.com/${repository}/tar.gz/${source.commit}`);
|
|
338
399
|
const api = ({ repository, source }) => (token) => HttpClientRequest.get(`https://api.github.com/repos/${repository}/tarball/${source.commit}`).pipe(HttpClientRequest.bearerToken(Redacted.value(token)));
|
|
339
400
|
const fetchBytes = (request) => Effect.gen(function* fetchArchive() {
|
|
340
|
-
const
|
|
341
|
-
|
|
401
|
+
const body = yield* (yield* (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk, HttpClient.retryTransient({
|
|
402
|
+
schedule: Schedule.exponential(RETRY_DELAY),
|
|
403
|
+
times: RETRIES
|
|
404
|
+
})).execute(request)).arrayBuffer;
|
|
342
405
|
return new Uint8Array(body);
|
|
343
406
|
});
|
|
344
407
|
const githubToken = Config.option(Config.Redacted("GITHUB_TOKEN")).pipe(Effect.orElseSucceed(Option.none));
|
|
@@ -368,9 +431,9 @@ const hasSkillFile = (base) => (name) => Effect.gen(function* checkSkillFile() {
|
|
|
368
431
|
/** @internal */
|
|
369
432
|
const resolveLocal = (root) => ({ directory, skills }) => Effect.gen(function* resolveLocalSource() {
|
|
370
433
|
const fs = yield* FileSystem.FileSystem;
|
|
371
|
-
const base = (yield* Path.Path).join(root, ...String.split("/")(directory));
|
|
434
|
+
const base = (yield* Path.Path).join(root, ...String$1.split("/")(directory));
|
|
372
435
|
const entries = yield* fs.readDirectory(base).pipe(Effect.mapError(() => checksFailed(`${directory} is not a folder`)));
|
|
373
|
-
const available = yield* pipe(Array.sort(entries, String.Order), Effect.filter(hasSkillFile(base)));
|
|
436
|
+
const available = yield* pipe(Array.sort(entries, String$1.Order), Effect.filter(hasSkillFile(base)));
|
|
374
437
|
return {
|
|
375
438
|
repository: directory,
|
|
376
439
|
names: yield* selectSkills({
|
|
@@ -413,7 +476,7 @@ const writeEntry = (staging, skill) => ({ header, bytes }) => Effect.gen(functio
|
|
|
413
476
|
const fs = yield* FileSystem.FileSystem;
|
|
414
477
|
const path = yield* Path.Path;
|
|
415
478
|
const relative = relativeTo(skill.directory)(header.path);
|
|
416
|
-
const file = path.join(staging, ...String.split("/")(relative));
|
|
479
|
+
const file = path.join(staging, ...String$1.split("/")(relative));
|
|
417
480
|
yield* fs.makeDirectory(path.dirname(file), { recursive: true });
|
|
418
481
|
yield* fs.writeFile(file, bytes);
|
|
419
482
|
yield* fs.chmod(file, modeOf(header.mode));
|
|
@@ -485,7 +548,7 @@ const fetchNames = (declared, directory) => Effect.gen(function* fromArchive() {
|
|
|
485
548
|
});
|
|
486
549
|
/** @internal */
|
|
487
550
|
const resolveSource = (cache) => (declared) => Effect.gen(function* resolve() {
|
|
488
|
-
const directory = (yield* Path.Path).join(cache, ...String.split("/")(declared.repository), declared.source.commit);
|
|
551
|
+
const directory = (yield* Path.Path).join(cache, ...String$1.split("/")(declared.repository), declared.source.commit);
|
|
489
552
|
const cached = yield* cachedNames(declared, directory);
|
|
490
553
|
const names = yield* Option.match(cached, {
|
|
491
554
|
onNone: () => fetchNames(declared, directory),
|
|
@@ -519,7 +582,7 @@ const linksOf = (resolved) => Effect.gen(function* collectLinks() {
|
|
|
519
582
|
})));
|
|
520
583
|
});
|
|
521
584
|
const resolveEntry = (root, cache) => ([key, source]) => {
|
|
522
|
-
const local = String.startsWith(LOCAL_PREFIX)(key);
|
|
585
|
+
const local = String$1.startsWith(LOCAL_PREFIX)(key);
|
|
523
586
|
if (isRemote(source)) {
|
|
524
587
|
if (local) return Effect.fail(checksFailed(`vite.config "skills": ${key} is a folder in this repository and takes no commit`));
|
|
525
588
|
return resolveSource(cache)({
|
|
@@ -545,37 +608,11 @@ const installSkills = (root) => Effect.gen(function* install() {
|
|
|
545
608
|
yield* linkSkills(root)(links);
|
|
546
609
|
return Option.some(links.length);
|
|
547
610
|
});
|
|
548
|
-
// src/features/scan-secrets/model/betterleaks.ts
|
|
549
|
-
const toBetterleaksToml = (config) => {
|
|
550
|
-
const { ignoredSecrets: _ignoredSecrets, ...rest } = config;
|
|
551
|
-
return stringify(rest);
|
|
552
|
-
};
|
|
553
|
-
const toIgnoreFile = (config) => pipe(config.ignoredSecrets ?? [], Array.map((digest) => `${digest}\n`), Array.join(""));
|
|
554
611
|
// src/features/scan-secrets/model/secret-checks.ts
|
|
555
|
-
const DATA_FIRST_ARITY$
|
|
556
|
-
const ignoreFileArgs = (config) => Effect.gen(function* ignoreFile() {
|
|
557
|
-
const digests = toIgnoreFile(config);
|
|
558
|
-
if (digests === "") return [];
|
|
559
|
-
const fs = yield* FileSystem.FileSystem;
|
|
560
|
-
const file = yield* fs.makeTempFileScoped({ prefix: "betterleaksignore-" });
|
|
561
|
-
yield* fs.writeFileString(file, digests);
|
|
562
|
-
return ["--ignore-file", file];
|
|
563
|
-
});
|
|
564
|
-
const scanSecrets = ({ config, root, args, input }) => Effect.gen(function* scan() {
|
|
565
|
-
const ignore = yield* ignoreFileArgs(config);
|
|
566
|
-
return yield* runVendored(BETTERLEAKS, {
|
|
567
|
-
root,
|
|
568
|
-
args: [
|
|
569
|
-
...args,
|
|
570
|
-
"--redact",
|
|
571
|
-
"--no-banner",
|
|
572
|
-
...ignore
|
|
573
|
-
],
|
|
574
|
-
env: { BETTERLEAKS_CONFIG_TOML: toBetterleaksToml(config) },
|
|
575
|
-
input
|
|
576
|
-
});
|
|
577
|
-
}).pipe(Effect.scoped);
|
|
612
|
+
const DATA_FIRST_ARITY$3 = 2;
|
|
578
613
|
const SUCCESS = 0;
|
|
614
|
+
const RANGE = "..";
|
|
615
|
+
const HEAD = "HEAD";
|
|
579
616
|
const lacksHistory = (root) => Effect.gen(function* history() {
|
|
580
617
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
581
618
|
const shallow = yield* spawner.string(ChildProcess.make("git", ["rev-parse", "--is-shallow-repository"], { cwd: root }));
|
|
@@ -584,69 +621,57 @@ const lacksHistory = (root) => Effect.gen(function* history() {
|
|
|
584
621
|
"--get",
|
|
585
622
|
"remote.origin.promisor"
|
|
586
623
|
], { cwd: root }));
|
|
587
|
-
return String.trim(shallow) === "true" || promisor === SUCCESS;
|
|
588
|
-
});
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
624
|
+
return String$1.trim(shallow) === "true" || promisor === SUCCESS;
|
|
625
|
+
});
|
|
626
|
+
const historyOf = (range) => pipe(String$1.split(range, RANGE), Array.match({
|
|
627
|
+
onEmpty: () => ({
|
|
628
|
+
type: "history",
|
|
629
|
+
head: HEAD
|
|
630
|
+
}),
|
|
631
|
+
onNonEmpty: ([base, ...rest]) => Array.match(rest, {
|
|
632
|
+
onEmpty: () => ({
|
|
633
|
+
type: "history",
|
|
634
|
+
head: range
|
|
635
|
+
}),
|
|
636
|
+
onNonEmpty: ([head]) => ({
|
|
637
|
+
type: "history",
|
|
638
|
+
bases: [base],
|
|
639
|
+
head
|
|
640
|
+
})
|
|
641
|
+
})
|
|
592
642
|
}));
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
archive,
|
|
603
|
-
"HEAD"
|
|
604
|
-
], { cwd: root })));
|
|
605
|
-
yield* succeeded("tar", spawner.exitCode(ChildProcess.make("tar", [
|
|
606
|
-
"-xf",
|
|
607
|
-
archive,
|
|
608
|
-
"-C",
|
|
609
|
-
directory
|
|
610
|
-
])));
|
|
611
|
-
yield* fs.remove(archive);
|
|
612
|
-
return yield* scanSecrets({
|
|
613
|
-
config,
|
|
643
|
+
const sourceOf = (partial, range) => Boolean$1.match(partial, {
|
|
644
|
+
onTrue: () => ({
|
|
645
|
+
type: "snapshot",
|
|
646
|
+
revision: HEAD
|
|
647
|
+
}),
|
|
648
|
+
onFalse: () => historyOf(range)
|
|
649
|
+
});
|
|
650
|
+
const scan = (config, root, source) => Effect.gen(function* scanSource() {
|
|
651
|
+
const found = yield* (yield* makeDetector(config)).scanGit({
|
|
614
652
|
root,
|
|
615
|
-
|
|
653
|
+
source
|
|
616
654
|
});
|
|
617
|
-
|
|
655
|
+
return {
|
|
656
|
+
valid: Array.isReadonlyArrayEmpty(found),
|
|
657
|
+
output: pipe(found, Array.map(format$1), Array.join("\n"))
|
|
658
|
+
};
|
|
659
|
+
}).pipe(Effect.mapError(toolFailed("h56m")));
|
|
618
660
|
/** @internal */
|
|
619
|
-
const
|
|
620
|
-
if (partial) return scanCommittedTree(config, root);
|
|
621
|
-
return scanSecrets({
|
|
622
|
-
config,
|
|
623
|
-
root,
|
|
624
|
-
args: [
|
|
625
|
-
"git",
|
|
626
|
-
".",
|
|
627
|
-
`--revision=${range}`
|
|
628
|
-
]
|
|
629
|
-
});
|
|
630
|
-
})));
|
|
631
|
-
const STAGED_DIFF = [
|
|
632
|
-
"diff",
|
|
633
|
-
"--cached",
|
|
634
|
-
"--no-ext-diff",
|
|
635
|
-
"--no-textconv",
|
|
636
|
-
"--no-color",
|
|
637
|
-
"--src-prefix=a/",
|
|
638
|
-
"--dst-prefix=b/"
|
|
639
|
-
];
|
|
661
|
+
const h56mCheck = withSection("h56m", (config, { root, range }) => lacksHistory(root).pipe(Effect.flatMap((partial) => scan(config, root, sourceOf(partial, range)))));
|
|
640
662
|
/** @internal */
|
|
641
|
-
const scanStagedSecrets = Function.dual(DATA_FIRST_ARITY$
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
args: ["stdin", "--git-diff"],
|
|
647
|
-
input: diff
|
|
648
|
-
});
|
|
663
|
+
const scanStagedSecrets = Function.dual(DATA_FIRST_ARITY$3, (config, root) => scan(config, root, { type: "staged" }));
|
|
664
|
+
/** @internal */
|
|
665
|
+
const writeTo = Function.dual(2, (sink, text) => Effect.gen(function* write() {
|
|
666
|
+
const stdio = yield* Stdio.Stdio;
|
|
667
|
+
yield* Stream.make(text).pipe(Stream.run(stdio[sink]()), Effect.orDie);
|
|
649
668
|
}));
|
|
669
|
+
/** @internal */
|
|
670
|
+
const finish = (report) => {
|
|
671
|
+
if (!report.valid) return Effect.fail(checksFailed(report.output));
|
|
672
|
+
if (report.output === "") return Effect.void;
|
|
673
|
+
return writeTo("stdout", `${report.output}\n`);
|
|
674
|
+
};
|
|
650
675
|
// src/shared/lib/workspace.ts
|
|
651
676
|
const DEPENDENCY_FIELDS = [
|
|
652
677
|
"dependencies",
|
|
@@ -656,8 +681,8 @@ const DEPENDENCY_FIELDS = [
|
|
|
656
681
|
];
|
|
657
682
|
const MANIFEST_FILE = "package.json";
|
|
658
683
|
const pnpm = attempt("pnpm");
|
|
659
|
-
const byFile = Order.mapInput(String.Order, ({ file }) => file);
|
|
660
|
-
const manifestIn = (directory) => pipe(Option.liftPredicate(directory, String.isNonEmpty), Option.map((own) => `${own}/${MANIFEST_FILE}`), Option.getOrElse(() => MANIFEST_FILE));
|
|
684
|
+
const byFile = Order.mapInput(String$1.Order, ({ file }) => file);
|
|
685
|
+
const manifestIn = (directory) => pipe(Option.liftPredicate(directory, String$1.isNonEmpty), Option.map((own) => `${own}/${MANIFEST_FILE}`), Option.getOrElse(() => MANIFEST_FILE));
|
|
661
686
|
const dependenciesIn = (file, declared) => pipe(DEPENDENCY_FIELDS, Array.flatMap((field) => {
|
|
662
687
|
const entries = Record.toEntries(Option.getOrElse(Option.fromUndefinedOr(declared[field]), () => ({})));
|
|
663
688
|
return pipe(entries, Array.map(([name, specifier]) => ({
|
|
@@ -726,7 +751,7 @@ const versionProblems = (rules, pinned) => {
|
|
|
726
751
|
};
|
|
727
752
|
const comparedDependencies = (rules, dependencies) => {
|
|
728
753
|
const isExact = inWorkspaces(exactGlobs(rules));
|
|
729
|
-
return pipe(dependencies, Array.filter(({ specifier }) => !String.startsWith("workspace:")(specifier)), Array.filter(Predicate.not(isExact)));
|
|
754
|
+
return pipe(dependencies, Array.filter(({ specifier }) => !String$1.startsWith("workspace:")(specifier)), Array.filter(Predicate.not(isExact)));
|
|
730
755
|
};
|
|
731
756
|
const checkDependencies = Function.dual(DATA_FIRST_ARITY$1, (rules, dependencies) => [
|
|
732
757
|
...bannedProblems(rules, dependencies),
|
|
@@ -749,7 +774,7 @@ const checkSlices = Function.dual(DATA_FIRST_ARITY_3, (config, root, targets) =>
|
|
|
749
774
|
}));
|
|
750
775
|
// src/features/check-repository/model/repository-checks.ts
|
|
751
776
|
const LAYER_FOLDER = /\/(?:app|pages|widgets|features|entities|shared)\//gu;
|
|
752
|
-
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)))))));
|
|
777
|
+
const layeredDirectories = (root, patterns) => listGitFiles(root, []).pipe(Effect.map((files) => pipe(files, Array.flatMap((file) => Array.map(Array.fromIterable(String$1.matchAll(LAYER_FOLDER)(file)), ({ index }) => String$1.takeLeft(file, index ?? file.length))), Array.dedupe, Array.filter((directory) => pipe(patterns, Array.some((pattern) => minimatch(directory, pattern)))))));
|
|
753
778
|
/** @internal */
|
|
754
779
|
const steigerCheck = withSection("steiger", (section, { root }) => layeredDirectories(root, section.paths).pipe(Effect.flatMap((targets) => checkSlices(section.rules, root, targets))));
|
|
755
780
|
/** @internal */
|
|
@@ -760,30 +785,6 @@ const dependenciesCheck = withSection("dependencyRules", (rules, { root }) => li
|
|
|
760
785
|
output: Array.join(problems, "\n")
|
|
761
786
|
};
|
|
762
787
|
})));
|
|
763
|
-
// src/features/check-workflows/model/workflow-checks.ts
|
|
764
|
-
const WORKFLOWS = ".github/workflows";
|
|
765
|
-
const onWorkflows = (binary, args) => ({ root }) => Effect.gen(function* workflows() {
|
|
766
|
-
const fs = yield* FileSystem.FileSystem;
|
|
767
|
-
const path = yield* Path.Path;
|
|
768
|
-
if (!(yield* fs.exists(path.join(root, WORKFLOWS)))) return Option.none();
|
|
769
|
-
const resolvedArgs = yield* args;
|
|
770
|
-
const ran = yield* runVendored(binary, {
|
|
771
|
-
root,
|
|
772
|
-
args: resolvedArgs
|
|
773
|
-
});
|
|
774
|
-
return Option.some(ran);
|
|
775
|
-
});
|
|
776
|
-
/** @internal */
|
|
777
|
-
const actionlintCheck = onWorkflows(ACTIONLINT, Effect.succeed([]));
|
|
778
|
-
const zizmorArgs = Effect.gen(function* zizmorArgs() {
|
|
779
|
-
const remote = yield* Config.option(Config.String("CLAUDE_CODE_REMOTE")).pipe(Effect.orDie);
|
|
780
|
-
return pipe(remote, Option.match({
|
|
781
|
-
onNone: () => [".github"],
|
|
782
|
-
onSome: () => ["--no-online-audits", ".github"]
|
|
783
|
-
}));
|
|
784
|
-
});
|
|
785
|
-
/** @internal */
|
|
786
|
-
const zizmorCheck = onWorkflows(ZIZMOR, zizmorArgs);
|
|
787
788
|
// src/features/run-fallow/model/fallow-check.ts
|
|
788
789
|
const QUIET = [
|
|
789
790
|
"--fail-on-issues",
|
|
@@ -868,21 +869,13 @@ const fallowCheck = withSection("fallow", (config, { root }) => runFallow(config
|
|
|
868
869
|
// src/app/checks.ts
|
|
869
870
|
const CHECKS = [
|
|
870
871
|
{
|
|
871
|
-
name: "
|
|
872
|
-
run:
|
|
872
|
+
name: "h56m",
|
|
873
|
+
run: h56mCheck
|
|
873
874
|
},
|
|
874
875
|
{
|
|
875
876
|
name: "commitlint",
|
|
876
877
|
run: commitlintCheck
|
|
877
878
|
},
|
|
878
|
-
{
|
|
879
|
-
name: "actionlint",
|
|
880
|
-
run: actionlintCheck
|
|
881
|
-
},
|
|
882
|
-
{
|
|
883
|
-
name: "zizmor",
|
|
884
|
-
run: zizmorCheck
|
|
885
|
-
},
|
|
886
879
|
{
|
|
887
880
|
name: "dependencies",
|
|
888
881
|
run: dependenciesCheck
|
|
@@ -958,7 +951,7 @@ const USAGE = pipe([
|
|
|
958
951
|
" vpa --message <text> lint a message"
|
|
959
952
|
], Array.join("\n"));
|
|
960
953
|
const usage = Effect.fail(checksFailed(USAGE));
|
|
961
|
-
const stagedSecrets = (root) => loadSection(root, "
|
|
954
|
+
const stagedSecrets = (root) => loadSection(root, "h56m").pipe(Effect.flatMap((config) => scanStagedSecrets(config, root)), Effect.flatMap(finish));
|
|
962
955
|
const lintMessage = (toMessage) => (root, rest) => pipe(Array.head(rest), Option.match({
|
|
963
956
|
onNone: () => usage,
|
|
964
957
|
onSome: (argument) => Effect.gen(function* lintGiven() {
|
|
@@ -988,6 +981,6 @@ const runVpa = Function.dual(DATA_FIRST_ARITY, (root, args) => pipe(args, Array.
|
|
|
988
981
|
onSome: (hook) => hook(root, rest)
|
|
989
982
|
}))
|
|
990
983
|
})));
|
|
991
|
-
export {
|
|
984
|
+
export { VpToolsError as i, writeTo as n, loadViteConfig as r, runVpa as t };
|
|
992
985
|
|
|
993
|
-
//# sourceMappingURL=vpa
|
|
986
|
+
//# sourceMappingURL=vpa-MRYbih3E.mjs.map
|