@r_masseater/h56m 0.3.0 → 0.3.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/dist/cli-Ckk5Jwbk.mjs +51 -0
- package/dist/cli-Ckk5Jwbk.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{section-DHEBsrR8.mjs → section-Bnbx6uOH.mjs} +21 -7
- package/dist/section-Bnbx6uOH.mjs.map +1 -0
- package/package.json +6 -6
- package/skills/scan-secrets/SKILL.md +0 -1
- package/skills/use-h56m-presets/SKILL.md +0 -1
- package/dist/cli-DTqDhoxm.mjs +0 -38
- package/dist/cli-DTqDhoxm.mjs.map +0 -1
- package/dist/section-DHEBsrR8.mjs.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { a as failedWith, n as format, o as runTool, r as makeDetector, t as h56mSection } from "./section-Bnbx6uOH.mjs";
|
|
2
|
+
import { Array, Boolean, Effect } from "effect";
|
|
3
|
+
// package.json
|
|
4
|
+
var version = "0.3.1";
|
|
5
|
+
var description = "A secret scanner engine written in Rust that scans git history, the staged changes or any text with Betterleaks-format rules from a preset, configured from vite.config.ts.";
|
|
6
|
+
// src/app/cli.ts
|
|
7
|
+
const STAGED = "staged";
|
|
8
|
+
const BASES = [
|
|
9
|
+
"origin/HEAD",
|
|
10
|
+
"origin/main",
|
|
11
|
+
"origin/master"
|
|
12
|
+
];
|
|
13
|
+
const HEAD = "HEAD";
|
|
14
|
+
const candidatesOf = (requested) => Array.match(requested, {
|
|
15
|
+
onEmpty: () => BASES,
|
|
16
|
+
onNonEmpty: (given) => given
|
|
17
|
+
});
|
|
18
|
+
const sourceOf = ({ flags, args }) => Boolean.match(flags.has(STAGED), {
|
|
19
|
+
onTrue: () => ({ type: "staged" }),
|
|
20
|
+
onFalse: () => ({
|
|
21
|
+
type: "history",
|
|
22
|
+
bases: candidatesOf(args),
|
|
23
|
+
head: HEAD
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
const scan = ({ root, config, input }) => makeDetector(config).pipe(Effect.flatMap((detector) => detector.scanGit({
|
|
27
|
+
root,
|
|
28
|
+
source: sourceOf(input)
|
|
29
|
+
})));
|
|
30
|
+
const runCli = () => {
|
|
31
|
+
runTool({
|
|
32
|
+
name: "h56m",
|
|
33
|
+
version,
|
|
34
|
+
description,
|
|
35
|
+
flags: [{
|
|
36
|
+
name: STAGED,
|
|
37
|
+
description: "Scan the staged changes instead of the history"
|
|
38
|
+
}],
|
|
39
|
+
argument: {
|
|
40
|
+
name: "base",
|
|
41
|
+
description: "Refs to scan the history from, the first one that exists winning (default: origin/HEAD, origin/main, origin/master)"
|
|
42
|
+
},
|
|
43
|
+
section: h56mSection,
|
|
44
|
+
failWith: failedWith,
|
|
45
|
+
scan,
|
|
46
|
+
format
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export { runCli };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=cli-Ckk5Jwbk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-Ckk5Jwbk.mjs","names":["Arr","Bool","manifest.version","manifest.description"],"sources":["../package.json","../src/app/cli.ts"],"sourcesContent":["","import { runTool } from \"@masseater.dev/lint-host\";\nimport type { ToolCall, ToolInput } from \"@masseater.dev/lint-host\";\nimport manifest from \"@r_masseater/h56m/package.json\" with { type: \"json\" };\nimport { Array as Arr, Boolean as Bool, Effect } from \"effect\";\n\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nimport { makeDetector } from \"./detector.ts\";\nimport { format } from \"./format.ts\";\nimport { h56mSection } from \"./section.ts\";\n\nconst STAGED = \"staged\";\nconst BASES = [\"origin/HEAD\", \"origin/main\", \"origin/master\"];\nconst HEAD = \"HEAD\";\n\nconst candidatesOf = (requested: readonly string[]): readonly string[] =>\n Arr.match(requested, { onEmpty: () => BASES, onNonEmpty: (given) => given });\n\nconst sourceOf = ({ flags, args }: ToolInput): GitSource =>\n Bool.match(flags.has(STAGED), {\n onTrue: (): GitSource => ({ type: \"staged\" }),\n onFalse: (): GitSource => ({ type: \"history\", bases: candidatesOf(args), head: HEAD }),\n });\n\nconst scan = ({\n root,\n config,\n input,\n}: ToolCall<H56mConfig>): Effect.Effect<readonly Finding[], H56mError> =>\n makeDetector(config).pipe(\n Effect.flatMap((detector) => detector.scanGit({ root, source: sourceOf(input) })),\n );\n\nexport const runCli = (): void => {\n runTool({\n name: \"h56m\",\n version: manifest.version,\n description: manifest.description,\n flags: [{ name: STAGED, description: \"Scan the staged changes instead of the history\" }],\n argument: {\n name: \"base\",\n description:\n \"Refs to scan the history from, the first one that exists winning (default: origin/HEAD, origin/main, origin/master)\",\n },\n section: h56mSection,\n failWith: failedWith,\n scan,\n format,\n });\n};\n"],"mappings":";;;;;;ACaA,MAAM,SAAS;AACf,MAAM,QAAQ;CAAC;CAAe;CAAe;AAAe;AAC5D,MAAM,OAAO;AAEb,MAAM,gBAAgB,cACpBA,MAAI,MAAM,WAAW;CAAE,eAAe;CAAO,aAAa,UAAU;AAAM,CAAC;AAE7E,MAAM,YAAY,EAAE,OAAO,WACzBC,QAAK,MAAM,MAAM,IAAI,MAAM,GAAG;CAC5B,eAA0B,EAAE,MAAM,SAAS;CAC3C,gBAA2B;EAAE,MAAM;EAAW,OAAO,aAAa,IAAI;EAAG,MAAM;CAAK;AACtF,CAAC;AAEH,MAAM,QAAQ,EACZ,MACA,QACA,YAEA,aAAa,MAAM,CAAC,CAAC,KACnB,OAAO,SAAS,aAAa,SAAS,QAAQ;CAAE;CAAM,QAAQ,SAAS,KAAK;AAAE,CAAC,CAAC,CAClF;AAEF,MAAa,eAAqB;CAChC,QAAQ;EACN,MAAM;EACGC;EACIC;EACb,OAAO,CAAC;GAAE,MAAM;GAAQ,aAAa;EAAiD,CAAC;EACvF,UAAU;GACR,MAAM;GACN,aACE;EACJ;EACA,SAAS;EACT,UAAU;EACV;EACA;CACF,CAAC;AACH"}
|
package/dist/cli.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as H56mError, n as format, t as h56mSection, r as makeDetector } from "./section-
|
|
1
|
+
export { i as H56mError, n as format, t as h56mSection, r as makeDetector } from "./section-Bnbx6uOH.mjs";
|
|
@@ -3,6 +3,7 @@ import { Array, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Op
|
|
|
3
3
|
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
4
4
|
import { layer } from "@effect/platform-node/NodeServices";
|
|
5
5
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
+
import { Argument, Command, Flag } from "effect/cli";
|
|
6
7
|
import { FetchHttpClient } from "effect/http";
|
|
7
8
|
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
8
9
|
import { resolveConfigFromFile } from "vite-plus";
|
|
@@ -11,8 +12,8 @@ const abiOf = (platform) => Match.value(platform).pipe(Match.when("linux", () =>
|
|
|
11
12
|
const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;
|
|
12
13
|
const addonFileOf = (binary) => `${binary}.${platformTarget}.node`;
|
|
13
14
|
// ../lint-host/src/features/build-addon/model/build.ts
|
|
14
|
-
const taggedError$
|
|
15
|
-
var AddonBuildFailed = class extends taggedError$
|
|
15
|
+
const taggedError$2 = Schema.TaggedError;
|
|
16
|
+
var AddonBuildFailed = class extends taggedError$2()("AddonBuildFailed", { message: Schema.String }) {};
|
|
16
17
|
const LIBRARY = {
|
|
17
18
|
linux: (name) => `lib${name}.so`,
|
|
18
19
|
darwin: (name) => `lib${name}.dylib`,
|
|
@@ -57,6 +58,9 @@ const callAddon = ({ addon, name, files, call, failWith }) => addon.pipe(Effect.
|
|
|
57
58
|
try: () => call(loaded),
|
|
58
59
|
catch: failWith(`${name} could not lint`)
|
|
59
60
|
}).pipe(Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())))), Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }));
|
|
61
|
+
// ../lint-host/src/shared/lib/fail.ts
|
|
62
|
+
const taggedError$1 = Schema.TaggedError;
|
|
63
|
+
taggedError$1()("NotUtf8Error", { path: Schema.String });
|
|
60
64
|
// ../lint-host/src/features/run-cli/model/cli.ts
|
|
61
65
|
const CONFIG_FILES = [
|
|
62
66
|
"vite.config.ts",
|
|
@@ -66,7 +70,7 @@ const CONFIG_FILES = [
|
|
|
66
70
|
];
|
|
67
71
|
const FAILED = 1;
|
|
68
72
|
const DATA_FIRST_ARITY$1 = 2;
|
|
69
|
-
|
|
73
|
+
new TextDecoder("utf-8", { fatal: true });
|
|
70
74
|
const readSectionIn = (source, root) => Effect.gen(function* readConfig() {
|
|
71
75
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
72
76
|
const path = yield* Path.Path;
|
|
@@ -88,13 +92,13 @@ const printAll = (found, format) => Array.match(found, {
|
|
|
88
92
|
onEmpty: () => Effect.void,
|
|
89
93
|
onNonEmpty: (all) => Console.log(pipe(all, Array.map(format), Array.join("\n")))
|
|
90
94
|
});
|
|
91
|
-
const toolMainOf = (tool) => Effect.gen(function* main() {
|
|
95
|
+
const toolMainOf = (tool) => (input) => Effect.gen(function* main() {
|
|
92
96
|
const root = process.cwd();
|
|
93
97
|
const config = yield* readSectionIn(tool, root);
|
|
94
98
|
const found = yield* tool.scan({
|
|
95
99
|
root,
|
|
96
100
|
config,
|
|
97
|
-
|
|
101
|
+
input
|
|
98
102
|
});
|
|
99
103
|
yield* printAll(found, tool.format);
|
|
100
104
|
yield* failWhen(Array.isReadonlyArrayNonEmpty(found));
|
|
@@ -103,8 +107,18 @@ const runTraced = (name, program) => {
|
|
|
103
107
|
const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(layer));
|
|
104
108
|
runMain(program.pipe(Effect.provide(services)));
|
|
105
109
|
};
|
|
110
|
+
const variadicOf = ({ name, description }) => Argument.String(name).pipe(Argument.withDescription(description), Argument.variadic());
|
|
111
|
+
const flagsOf$1 = (flags) => Record.fromEntries(pipe(flags, Array.map(({ name, description }) => [name, Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.withDefault(false))])));
|
|
112
|
+
const setFlags = (values) => new Set(pipe(values, Record.filter(Function.identity), Record.keys));
|
|
106
113
|
const runTool = (tool) => {
|
|
107
|
-
|
|
114
|
+
const command = Command.make(tool.name, {
|
|
115
|
+
args: variadicOf(tool.argument),
|
|
116
|
+
flags: flagsOf$1(tool.flags)
|
|
117
|
+
}, ({ args, flags }) => toolMainOf(tool)({
|
|
118
|
+
args,
|
|
119
|
+
flags: setFlags(flags)
|
|
120
|
+
})).pipe(Command.withDescription(tool.description));
|
|
121
|
+
runTraced(tool.name, Command.run(command, { version: tool.version }));
|
|
108
122
|
};
|
|
109
123
|
Function.dual(2, (value, build) => Option.match(value, {
|
|
110
124
|
onNone: () => ({}),
|
|
@@ -214,4 +228,4 @@ const h56mSection = sectionOf({
|
|
|
214
228
|
});
|
|
215
229
|
export { failedWith as a, H56mError as i, format as n, runTool as o, makeDetector as r, h56mSection as t };
|
|
216
230
|
|
|
217
|
-
//# sourceMappingURL=section-
|
|
231
|
+
//# sourceMappingURL=section-Bnbx6uOH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-Bnbx6uOH.mjs","names":["taggedError","Rec","Str","taggedError","DATA_FIRST_ARITY","Arr","Fn","nodeServices","flagsOf","Rec","Fn","Bool","Fn","Str"],"sources":["../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/shared/lib/fail.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../../lint-host/src/shared/lib/section.ts","../src/shared/config/types.ts","../src/shared/lib/errors.ts","../src/shared/native/index.ts","../src/app/detector.ts","../src/app/format.ts","../src/app/section.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(nodeServices)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class NotUtf8Error extends taggedError<NotUtf8Error, { readonly brand: unique symbol }>()(\n \"NotUtf8Error\",\n { path: Schema.String },\n) {}\n\nexport type FailWith<Failure> = (message: string) => (cause: unknown) => Failure;\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { NotUtf8Error } from \"#/shared/lib/fail.ts\";\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst STRICT_UTF8 = new TextDecoder(\"utf-8\", { fatal: true });\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure | NotUtf8Error>;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly version: string;\n readonly description: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolParameter {\n readonly name: string;\n readonly description: string;\n}\n\nexport interface ToolInput {\n readonly flags: ReadonlySet<string>;\n readonly args: readonly string[];\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly input: ToolInput;\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly flags: readonly ToolParameter[];\n readonly argument: ToolParameter;\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure | NotUtf8Error>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure | NotUtf8Error> =>\n fileSystem.readFile(path.resolve(root, file)).pipe(\n Effect.mapError(failWith(`could not read ${file}`)),\n Effect.flatMap((bytes) =>\n Effect.try({\n try: () => STRICT_UTF8.decode(bytes),\n catch: () => NotUtf8Error.make({ path: file }),\n }),\n ),\n );\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n patterns: readonly string[],\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf =\n <Config, Found, Failure>(tool: Tool<Config, Found, Failure>) =>\n (input: ToolInput): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, input });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices | Command.Environment>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(nodeServices),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nconst variadicOf = ({ name, description }: ToolParameter): Argument.Argument<readonly string[]> =>\n Argument.String(name).pipe(Argument.withDescription(description), Argument.variadic());\n\nconst flagsOf = (flags: readonly ToolParameter[]): Readonly<Record<string, Flag.Flag<boolean>>> =>\n Rec.fromEntries(\n pipe(\n flags,\n Arr.map(({ name, description }) => [\n name,\n Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.withDefault(false)),\n ]),\n ),\n );\n\nconst setFlags = (values: Readonly<Record<string, boolean>>): ReadonlySet<string> =>\n new Set(pipe(values, Rec.filter(Fn.identity), Rec.keys));\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n const command = Command.make(\n tool.name,\n { args: variadicOf(tool.argument), flags: flagsOf(tool.flags) },\n ({ args, flags }) => toolMainOf(tool)({ args, flags: setFlags(flags) }),\n ).pipe(Command.withDescription(tool.description));\n runTraced(tool.name, Command.run(command, { version: tool.version }));\n};\n\nconst pathspecArgument = (): Argument.Argument<readonly string[]> =>\n variadicOf({\n name: \"pathspec\",\n description: \"Git pathspecs of the files to lint, in place of the configured ones\",\n });\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n const command = Command.make(cli.name, { pathspecs: pathspecArgument() }, ({ pathspecs }) =>\n mainOf(cli, pathspecs),\n ).pipe(Command.withDescription(cli.description));\n runTraced(cli.name, Command.run(command, { version: cli.version }));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n readonly column?: number;\n}\n\nconst LINE_START = 0;\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.combine(\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n Order.mapInput(Order.Number, (found: Positioned) => found.column ?? LINE_START),\n ),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Array as Arr, Function as Fn, Option, Predicate, pipe } from \"effect\";\n\nexport interface SectionRequest<Config extends object> {\n readonly name: string;\n readonly fallback: Config;\n readonly prepare?: (section: Config) => Config;\n}\n\nexport const sectionOf = <Config extends object>({\n name,\n fallback,\n prepare = Fn.identity,\n}: SectionRequest<Config>): ((config: unknown) => Config) => {\n const hasSection = (value: unknown): value is Readonly<Record<string, Config>> =>\n Predicate.hasProperty(value, name) && Predicate.isObject(value[name]);\n return (config) =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.flatMapNullishOr((value) => value[name]),\n Option.map(prepare),\n Option.getOrElse(() => fallback),\n );\n};\n\nexport interface Ignoring {\n readonly ignores?: readonly string[] | undefined;\n}\n\nexport interface Pathspecs {\n readonly defaults: readonly string[];\n readonly unowned?: readonly string[];\n}\n\nexport const pathspecsOf =\n ({ defaults, unowned = [] }: Pathspecs) =>\n ({\n config,\n patterns = [],\n }: {\n readonly config: Ignoring;\n readonly patterns?: readonly string[];\n }): readonly string[] => [\n ...Arr.match(patterns, { onEmpty: () => defaults, onNonEmpty: Fn.identity }),\n ...unowned,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n ];\n","import { Schema } from \"effect\";\n\nexport interface H56mRule {\n readonly id: string;\n readonly description?: string;\n readonly keywords?: readonly string[];\n readonly regex?: string;\n readonly path?: string;\n readonly valueGroup?: number;\n readonly specificity?: number;\n readonly tags?: readonly string[];\n readonly skipReport?: boolean;\n readonly filter?: string;\n readonly confidence?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface H56mExtend {\n readonly path?: string;\n readonly disabledRules?: readonly string[];\n}\n\nexport interface H56mConfig {\n readonly extend?: H56mExtend;\n readonly maxDecodeDepth?: number;\n readonly prefilter?: string;\n readonly filter?: string;\n readonly rules?: readonly H56mRule[];\n readonly ignoredSecrets?: readonly string[];\n}\n\nexport const FindingSchema = Schema.Struct({\n rule: Schema.String,\n description: Schema.String,\n confidence: Schema.Literals([\"low\", \"medium\", \"high\"]),\n path: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n endLine: Schema.Int,\n endColumn: Schema.Int,\n secret: Schema.String,\n digest: Schema.String,\n commit: Schema.optionalKey(Schema.String),\n encoded: Schema.Boolean,\n});\n\nexport type Finding = typeof FindingSchema.Type;\n\nexport type GitSource =\n | { readonly type: \"history\"; readonly bases?: readonly string[]; readonly head: string }\n | { readonly type: \"staged\" }\n | { readonly type: \"snapshot\"; readonly revision: string };\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class H56mError extends taggedError<H56mError, { readonly brand: unique symbol }>()(\n \"H56mError\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): H56mError =>\n H56mError.make({ message: `${message}: ${String(cause)}` });\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nexport interface DetectorInput {\n readonly config: Omit<H56mConfig, \"ignoredSecrets\">;\n readonly ignored: readonly string[];\n readonly traceparent?: string;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly traceparent?: string;\n}\n\nexport interface GitInput {\n readonly root: string;\n readonly source: unknown;\n readonly traceparent?: string;\n}\n\nexport interface NativeDetector {\n readonly scan: (input: TextInput) => unknown;\n readonly scanGit: (input: GitInput) => unknown;\n}\n\nexport interface Native {\n readonly SecretDetector: new (input: DetectorInput) => NativeDetector;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"SecretDetector\") &&\n Predicate.isFunction(value.SecretDetector) &&\n Predicate.hasProperty(value, \"flushTelemetry\") &&\n Predicate.isFunction(value.flushTelemetry);\n\nexport const native: Effect.Effect<Native, H56mError> = loadAddon({\n packageName: \"@r_masseater/h56m\",\n binary: \"h56m\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { callAddon, traceparent } from \"@masseater.dev/lint-host\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { FindingSchema } from \"#/shared/config/index.ts\";\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\nimport type { NativeDetector } from \"#/shared/native/index.ts\";\n\nconst ONE_FILE = 1;\nconst WHOLE_REPOSITORY = 0;\n\nconst decodeFindings = Schema.decodeUnknownEffect(Schema.Array(FindingSchema));\n\nexport interface TextScan {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface GitScan {\n readonly root: string;\n readonly source: GitSource;\n}\n\nexport interface Detector {\n readonly scanText: (scan: TextScan) => Effect.Effect<readonly Finding[], H56mError>;\n readonly scanGit: (scan: GitScan) => Effect.Effect<readonly Finding[], H56mError>;\n}\n\ntype Traced<Input> = Input | (Input & { readonly traceparent: string });\n\nconst withParent = <Input extends object>(input: Input): Effect.Effect<Traced<Input>> =>\n traceparent.pipe(\n Effect.map(\n Option.match({\n onNone: (): Traced<Input> => input,\n onSome: (value): Traced<Input> => ({ ...input, traceparent: value }),\n }),\n ),\n );\n\ninterface NativeScan {\n readonly name: string;\n readonly files: number;\n readonly call: () => unknown;\n}\n\nconst run = ({ name, files, call }: NativeScan): Effect.Effect<readonly Finding[], H56mError> =>\n callAddon({ addon: native, name, files, call, failWith: failedWith }).pipe(\n Effect.flatMap((found) =>\n decodeFindings(found).pipe(Effect.mapError(failedWith(\"h56m returned an unknown shape\"))),\n ),\n );\n\nconst scannerOf = (detector: NativeDetector): Detector => ({\n scanText: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.text\", files: ONE_FILE, call: () => detector.scan(input) }),\n ),\n Effect.withSpan(\"h56m.scan_text\"),\n ),\n scanGit: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.git\", files: WHOLE_REPOSITORY, call: () => detector.scanGit(input) }),\n ),\n Effect.withSpan(\"h56m.scan_git\", { attributes: { \"h56m.source\": scan.source.type } }),\n ),\n});\n\nexport const makeDetector = Effect.fn(\"h56m.detector\")(function* makeDetector(\n config: H56mConfig = {},\n) {\n const { ignoredSecrets = [], ...rest } = config;\n const input = yield* withParent({ config: rest, ignored: ignoredSecrets });\n const detector = yield* callAddon({\n addon: native,\n name: \"h56m\",\n files: WHOLE_REPOSITORY,\n call: (addon) => new addon.SecretDetector(input),\n failWith: failedWith,\n });\n return scannerOf(detector);\n});\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport type { Finding } from \"#/shared/config/index.ts\";\n\nconst START = 0;\nconst SHORT_COMMIT = 12;\n\nconst commitOf = (finding: Finding): string =>\n pipe(\n Option.fromNullishOr(finding.commit),\n Option.map((commit) => ` (${Str.slice(START, SHORT_COMMIT)(commit)})`),\n Option.getOrElse(() => \"\"),\n );\n\nexport const format = (finding: Finding): string =>\n `${finding.path}:${String(finding.line)}:${String(finding.column)} ${finding.rule} ${finding.description} sha256:${finding.digest}${commitOf(finding)}`;\n","import { sectionOf } from \"@masseater.dev/lint-host\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\n\nexport const h56mSection = sectionOf<H56mConfig>({ name: \"h56m\", fallback: {} });\n"],"mappings":";;;;;;;;;;AAEA,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,UAA8D;CAClE,QAAQ,SAAS,MAAM,KAAK;CAC5B,SAAS,SAAS,MAAM,KAAK;CAC7B,QAAQ,SAAS,GAAG,KAAK;AAC3B;AAEA,MAAM,UAAU;AAShB,MAAM,QAAQ,OAAO,GAAG,OAAO,CAAC,CAAC,UAAU,MAAM,OAAe,WAAmB;CAEjF,MAAM,WAAW,QAAO,OADD,oBAAoB,oBAAA,CACX,SAC9B,aAAa,KAAK,SAAS;EAAC;EAAS;EAAa;EAAY;EAAM;CAAK,GAAG;EAC1E,KAAK;EACL,QAAQ;EACR,QAAQ;CACV,CAAC,CACH;CACA,MAAM,UAAU,iBAAiB,KAAK,EAAE,SAAS,qBAAqB,OAAO,QAAQ,IAAI,CAAC;CAC1F,OAAO,OAAO,KACZ,OAAO,KAAK,OAAO,GACnB,OAAO,WAAW,OAAO,QAA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C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/h56m",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A secret scanner engine written in Rust that scans git history, the staged changes or any text with Betterleaks-format rules from a preset, configured from vite.config.ts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"betterleaks",
|
|
@@ -64,8 +64,9 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@effect/vitest": "4.1.5",
|
|
66
66
|
"@masseater.dev/lint-host": "0.0.0",
|
|
67
|
+
"@pnpm/workspace.workspace-manifest-reader": "1100.3.4",
|
|
67
68
|
"@r_masseater/vitest-otlp": "0.2.2",
|
|
68
|
-
"@types/node": "26.6.
|
|
69
|
+
"@types/node": "26.6.10",
|
|
69
70
|
"betterleaks": "github:betterleaks/betterleaks#e07e69ba6a441313529b3e72be43ffdcc62bdf86",
|
|
70
71
|
"effect": "4.1.5",
|
|
71
72
|
"smol-toml": "1.9.1",
|
|
@@ -93,8 +94,7 @@
|
|
|
93
94
|
]
|
|
94
95
|
},
|
|
95
96
|
"optionalDependencies": {
|
|
96
|
-
"@r_masseater/h56m-linux-x64-gnu": "0.3.
|
|
97
|
-
"@r_masseater/h56m-win32-x64-msvc": "0.3.
|
|
98
|
-
}
|
|
99
|
-
"scripts": {}
|
|
97
|
+
"@r_masseater/h56m-linux-x64-gnu": "0.3.1",
|
|
98
|
+
"@r_masseater/h56m-win32-x64-msvc": "0.3.1"
|
|
99
|
+
}
|
|
100
100
|
}
|
package/dist/cli-DTqDhoxm.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { a as failedWith, n as format, o as runTool, r as makeDetector, t as h56mSection } from "./section-DHEBsrR8.mjs";
|
|
2
|
-
import { Array, Boolean, Effect } from "effect";
|
|
3
|
-
// src/app/cli.ts
|
|
4
|
-
const STAGED = "--staged";
|
|
5
|
-
const BASES = [
|
|
6
|
-
"origin/HEAD",
|
|
7
|
-
"origin/main",
|
|
8
|
-
"origin/master"
|
|
9
|
-
];
|
|
10
|
-
const HEAD = "HEAD";
|
|
11
|
-
const candidatesOf = (requested) => Array.match(requested, {
|
|
12
|
-
onEmpty: () => BASES,
|
|
13
|
-
onNonEmpty: (given) => given
|
|
14
|
-
});
|
|
15
|
-
const sourceOf = (requested) => Boolean.match(Array.contains(requested, STAGED), {
|
|
16
|
-
onTrue: () => ({ type: "staged" }),
|
|
17
|
-
onFalse: () => ({
|
|
18
|
-
type: "history",
|
|
19
|
-
bases: candidatesOf(requested),
|
|
20
|
-
head: HEAD
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
const scan = ({ root, config, args }) => makeDetector(config).pipe(Effect.flatMap((detector) => detector.scanGit({
|
|
24
|
-
root,
|
|
25
|
-
source: sourceOf(args)
|
|
26
|
-
})));
|
|
27
|
-
const runCli = () => {
|
|
28
|
-
runTool({
|
|
29
|
-
name: "h56m",
|
|
30
|
-
section: h56mSection,
|
|
31
|
-
failWith: failedWith,
|
|
32
|
-
scan,
|
|
33
|
-
format
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
export { runCli };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=cli-DTqDhoxm.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-DTqDhoxm.mjs","names":["Arr","Bool"],"sources":["../src/app/cli.ts"],"sourcesContent":["import { runTool } from \"@masseater.dev/lint-host\";\nimport type { ToolCall } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Boolean as Bool, Effect } from \"effect\";\n\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nimport { makeDetector } from \"./detector.ts\";\nimport { format } from \"./format.ts\";\nimport { h56mSection } from \"./section.ts\";\n\nconst STAGED = \"--staged\";\nconst BASES = [\"origin/HEAD\", \"origin/main\", \"origin/master\"];\nconst HEAD = \"HEAD\";\n\nconst candidatesOf = (requested: readonly string[]): readonly string[] =>\n Arr.match(requested, { onEmpty: () => BASES, onNonEmpty: (given) => given });\n\nconst sourceOf = (requested: readonly string[]): GitSource =>\n Bool.match(Arr.contains(requested, STAGED), {\n onTrue: (): GitSource => ({ type: \"staged\" }),\n onFalse: (): GitSource => ({ type: \"history\", bases: candidatesOf(requested), head: HEAD }),\n });\n\nconst scan = ({\n root,\n config,\n args,\n}: ToolCall<H56mConfig>): Effect.Effect<readonly Finding[], H56mError> =>\n makeDetector(config).pipe(\n Effect.flatMap((detector) => detector.scanGit({ root, source: sourceOf(args) })),\n );\n\nexport const runCli = (): void => {\n runTool({ name: \"h56m\", section: h56mSection, failWith: failedWith, scan, format });\n};\n"],"mappings":";;;AAYA,MAAM,SAAS;AACf,MAAM,QAAQ;CAAC;CAAe;CAAe;AAAe;AAC5D,MAAM,OAAO;AAEb,MAAM,gBAAgB,cACpBA,MAAI,MAAM,WAAW;CAAE,eAAe;CAAO,aAAa,UAAU;AAAM,CAAC;AAE7E,MAAM,YAAY,cAChBC,QAAK,MAAMD,MAAI,SAAS,WAAW,MAAM,GAAG;CAC1C,eAA0B,EAAE,MAAM,SAAS;CAC3C,gBAA2B;EAAE,MAAM;EAAW,OAAO,aAAa,SAAS;EAAG,MAAM;CAAK;AAC3F,CAAC;AAEH,MAAM,QAAQ,EACZ,MACA,QACA,WAEA,aAAa,MAAM,CAAC,CAAC,KACnB,OAAO,SAAS,aAAa,SAAS,QAAQ;CAAE;CAAM,QAAQ,SAAS,IAAI;AAAE,CAAC,CAAC,CACjF;AAEF,MAAa,eAAqB;CAChC,QAAQ;EAAE,MAAM;EAAQ,SAAS;EAAa,UAAU;EAAY;EAAM;CAAO,CAAC;AACpF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"section-DHEBsrR8.mjs","names":["taggedError","Rec","Str","DATA_FIRST_ARITY","Arr","Fn","nodeServices","Fn","Bool","Fn","Str"],"sources":["../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../../lint-host/src/shared/lib/section.ts","../src/shared/config/types.ts","../src/shared/lib/errors.ts","../src/shared/native/index.ts","../src/app/detector.ts","../src/app/format.ts","../src/app/section.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(nodeServices)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure>;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly args: readonly string[];\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure> =>\n fileSystem\n .readFileString(path.resolve(root, file))\n .pipe(Effect.mapError(failWith(`could not read ${file}`)));\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf = <Config, Found, Failure>(\n tool: Tool<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, args: process.argv.slice(ARGUMENTS_START) });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(nodeServices),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n runTraced(cli.name, mainOf(cli));\n};\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n runTraced(tool.name, toolMainOf(tool));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n readonly column?: number;\n}\n\nconst LINE_START = 0;\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.combine(\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n Order.mapInput(Order.Number, (found: Positioned) => found.column ?? LINE_START),\n ),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Array as Arr, Function as Fn, Option, Predicate, pipe } from \"effect\";\n\nexport interface SectionRequest<Config extends object> {\n readonly name: string;\n readonly fallback: Config;\n readonly prepare?: (section: Config) => Config;\n}\n\nexport const sectionOf = <Config extends object>({\n name,\n fallback,\n prepare = Fn.identity,\n}: SectionRequest<Config>): ((config: unknown) => Config) => {\n const hasSection = (value: unknown): value is Readonly<Record<string, Config>> =>\n Predicate.hasProperty(value, name) && Predicate.isObject(value[name]);\n return (config) =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.flatMapNullishOr((value) => value[name]),\n Option.map(prepare),\n Option.getOrElse(() => fallback),\n );\n};\n\nexport interface Ignoring {\n readonly ignores?: readonly string[] | undefined;\n}\n\nexport interface Pathspecs {\n readonly defaults: readonly string[];\n readonly unowned?: readonly string[];\n}\n\nexport const pathspecsOf =\n ({ defaults, unowned = [] }: Pathspecs) =>\n ({\n config,\n patterns = [],\n }: {\n readonly config: Ignoring;\n readonly patterns?: readonly string[];\n }): readonly string[] => [\n ...Arr.match(patterns, { onEmpty: () => defaults, onNonEmpty: Fn.identity }),\n ...unowned,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n ];\n","import { Schema } from \"effect\";\n\nexport interface H56mRule {\n readonly id: string;\n readonly description?: string;\n readonly keywords?: readonly string[];\n readonly regex?: string;\n readonly path?: string;\n readonly valueGroup?: number;\n readonly specificity?: number;\n readonly tags?: readonly string[];\n readonly skipReport?: boolean;\n readonly filter?: string;\n readonly confidence?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface H56mExtend {\n readonly path?: string;\n readonly disabledRules?: readonly string[];\n}\n\nexport interface H56mConfig {\n readonly extend?: H56mExtend;\n readonly maxDecodeDepth?: number;\n readonly prefilter?: string;\n readonly filter?: string;\n readonly rules?: readonly H56mRule[];\n readonly ignoredSecrets?: readonly string[];\n}\n\nexport const FindingSchema = Schema.Struct({\n rule: Schema.String,\n description: Schema.String,\n confidence: Schema.Literals([\"low\", \"medium\", \"high\"]),\n path: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n endLine: Schema.Int,\n endColumn: Schema.Int,\n secret: Schema.String,\n digest: Schema.String,\n commit: Schema.optionalKey(Schema.String),\n encoded: Schema.Boolean,\n});\n\nexport type Finding = typeof FindingSchema.Type;\n\nexport type GitSource =\n | { readonly type: \"history\"; readonly bases?: readonly string[]; readonly head: string }\n | { readonly type: \"staged\" }\n | { readonly type: \"snapshot\"; readonly revision: string };\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class H56mError extends taggedError<H56mError, { readonly brand: unique symbol }>()(\n \"H56mError\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): H56mError =>\n H56mError.make({ message: `${message}: ${String(cause)}` });\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nexport interface DetectorInput {\n readonly config: Omit<H56mConfig, \"ignoredSecrets\">;\n readonly ignored: readonly string[];\n readonly traceparent?: string;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly traceparent?: string;\n}\n\nexport interface GitInput {\n readonly root: string;\n readonly source: unknown;\n readonly traceparent?: string;\n}\n\nexport interface NativeDetector {\n readonly scan: (input: TextInput) => unknown;\n readonly scanGit: (input: GitInput) => unknown;\n}\n\nexport interface Native {\n readonly SecretDetector: new (input: DetectorInput) => NativeDetector;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"SecretDetector\") &&\n Predicate.isFunction(value.SecretDetector) &&\n Predicate.hasProperty(value, \"flushTelemetry\") &&\n Predicate.isFunction(value.flushTelemetry);\n\nexport const native: Effect.Effect<Native, H56mError> = loadAddon({\n packageName: \"@r_masseater/h56m\",\n binary: \"h56m\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { callAddon, traceparent } from \"@masseater.dev/lint-host\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { FindingSchema } from \"#/shared/config/index.ts\";\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\nimport type { NativeDetector } from \"#/shared/native/index.ts\";\n\nconst ONE_FILE = 1;\nconst WHOLE_REPOSITORY = 0;\n\nconst decodeFindings = Schema.decodeUnknownEffect(Schema.Array(FindingSchema));\n\nexport interface TextScan {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface GitScan {\n readonly root: string;\n readonly source: GitSource;\n}\n\nexport interface Detector {\n readonly scanText: (scan: TextScan) => Effect.Effect<readonly Finding[], H56mError>;\n readonly scanGit: (scan: GitScan) => Effect.Effect<readonly Finding[], H56mError>;\n}\n\ntype Traced<Input> = Input | (Input & { readonly traceparent: string });\n\nconst withParent = <Input extends object>(input: Input): Effect.Effect<Traced<Input>> =>\n traceparent.pipe(\n Effect.map(\n Option.match({\n onNone: (): Traced<Input> => input,\n onSome: (value): Traced<Input> => ({ ...input, traceparent: value }),\n }),\n ),\n );\n\ninterface NativeScan {\n readonly name: string;\n readonly files: number;\n readonly call: () => unknown;\n}\n\nconst run = ({ name, files, call }: NativeScan): Effect.Effect<readonly Finding[], H56mError> =>\n callAddon({ addon: native, name, files, call, failWith: failedWith }).pipe(\n Effect.flatMap((found) =>\n decodeFindings(found).pipe(Effect.mapError(failedWith(\"h56m returned an unknown shape\"))),\n ),\n );\n\nconst scannerOf = (detector: NativeDetector): Detector => ({\n scanText: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.text\", files: ONE_FILE, call: () => detector.scan(input) }),\n ),\n Effect.withSpan(\"h56m.scan_text\"),\n ),\n scanGit: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.git\", files: WHOLE_REPOSITORY, call: () => detector.scanGit(input) }),\n ),\n Effect.withSpan(\"h56m.scan_git\", { attributes: { \"h56m.source\": scan.source.type } }),\n ),\n});\n\nexport const makeDetector = Effect.fn(\"h56m.detector\")(function* makeDetector(\n config: H56mConfig = {},\n) {\n const { ignoredSecrets = [], ...rest } = config;\n const input = yield* withParent({ config: rest, ignored: ignoredSecrets });\n const detector = yield* callAddon({\n addon: native,\n name: \"h56m\",\n files: WHOLE_REPOSITORY,\n call: (addon) => new addon.SecretDetector(input),\n failWith: failedWith,\n });\n return scannerOf(detector);\n});\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport type { Finding } from \"#/shared/config/index.ts\";\n\nconst START = 0;\nconst SHORT_COMMIT = 12;\n\nconst commitOf = (finding: Finding): string =>\n pipe(\n Option.fromNullishOr(finding.commit),\n Option.map((commit) => ` (${Str.slice(START, SHORT_COMMIT)(commit)})`),\n Option.getOrElse(() => \"\"),\n );\n\nexport const format = (finding: Finding): string =>\n `${finding.path}:${String(finding.line)}:${String(finding.column)} ${finding.rule} ${finding.description} sha256:${finding.digest}${commitOf(finding)}`;\n","import { sectionOf } from \"@masseater.dev/lint-host\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\n\nexport const h56mSection = sectionOf<H56mConfig>({ name: \"h56m\", fallback: {} });\n"],"mappings":";;;;;;;;;AAEA,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,UAA8D;CAClE,QAAQ,SAAS,MAAM,KAAK;CAC5B,SAAS,SAAS,MAAM,KAAK;CAC7B,QAAQ,SAAS,GAAG,KAAK;AAC3B;AAEA,MAAM,UAAU;AAShB,MAAM,QAAQ,OAAO,GAAG,OAAO,CAAC,CAAC,UAAU,MAAM,OAAe,WAAmB;CAEjF,MAAM,WAAW,QAAO,OADD,oBAAoB,oBAAA,CACX,SAC9B,aAAa,KAAK,SAAS;EAAC;EAAS;EAAa;EAAY;EAAM;CAAK,GAAG;EAC1E,KAAK;EACL,QAAQ;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