@r_masseater/fu4 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,16 +7,16 @@ The engine of a GitHub Actions linter, configured from `vite.config.ts`.
7
7
  fu4 parses workflows, `action.yml` files, the Dependabot config and pre-commit configs in Rust,
8
8
  hands the YAML and tree-sitter trees to TypeScript rules without copying them, and runs those
9
9
  rules. It ships no rules of its own. Take the official ones from
10
- [`@r_masseater/fu4-presets`](https://www.npmjs.com/package/@r_masseater/fu4-presets): actionlint's
10
+ the `@r_masseater/fu4/presets` subpath: actionlint's
11
11
  checks and zizmor's audits.
12
12
 
13
13
  ```sh
14
- npm install -D @r_masseater/fu4 @r_masseater/fu4-presets effect
14
+ npm install -D @r_masseater/fu4 effect
15
15
  ```
16
16
 
17
17
  ```ts
18
18
  import "@r_masseater/fu4/vite";
19
- import { recommended } from "@r_masseater/fu4-presets";
19
+ import { recommended } from "@r_masseater/fu4/presets";
20
20
  import { defineConfig } from "vite-plus";
21
21
 
22
22
  export default defineConfig({
@@ -49,9 +49,42 @@ Write your own rules with `defineRule` and group them with `definePlugin`. A rul
49
49
  parsed source, can parse a `run:` script with `parseScript`, and reports positions with
50
50
  `report`.
51
51
 
52
+ ## Presets
53
+
54
+ List the presets you want in `extends`, or take both with `recommended()`. Every rule of a chosen
55
+ preset is an error. Override one in `rules`, such as `"zizmor/stale-action-refs": "warn"`.
56
+
57
+ | Preset | Rules |
58
+ | ------------ | ---------------------------------------------------------------------------------------------------------- |
59
+ | `actionlint` | `actionlint/*`: what [actionlint](https://github.com/rhysd/actionlint) reports, with its shellcheck checks |
60
+ | `zizmor` | `zizmor/*`: the audits of [zizmor](https://github.com/zizmorcore/zizmor), with its findings and positions |
61
+
62
+ `actionlint()` takes the options of actionlint's `actionlint.yaml`.
63
+
64
+ `zizmor()` takes these options.
65
+
66
+ | Option | Meaning |
67
+ | --------------- | ------------------------------------------------------------------------------------------------- |
68
+ | `concerns` | `injection`, `supply-chain`, `references`, `credentials`, `workflow` and `config`; all by default |
69
+ | `persona` | `regular`, `pedantic` or `auditor`, as zizmor's `--persona` |
70
+ | `minSeverity` | The lowest severity to report |
71
+ | `minConfidence` | The lowest confidence to report |
72
+ | `rules` | The `rules` section of a zizmor config |
73
+ | `online` | `false` skips the audits that query GitHub |
74
+ | `githubHost` | The GitHub host to query, such as a GitHub Enterprise Server host; `github.com` by default |
75
+
76
+ The audits that query GitHub read a token from `ZIZMOR_GITHUB_TOKEN`, `GH_TOKEN` or
77
+ `GITHUB_TOKEN`, in that order, and are skipped without one. They list a repository's branches and
78
+ tags through git's protocol, and list a public repository anonymously when GitHub rejects the token there.
79
+ Commits found to be reachable are remembered in
80
+ `node_modules/.cache/fu4/zizmor-reachable-commits.txt`, so later runs do not ask GitHub again.
81
+ zizmor's auto-fixes are not included.
82
+
83
+ The preset rules use only the rule API of fu4, so they need no native build of their own.
84
+
52
85
  ## Comparison
53
86
 
54
- Measured on 2026-11-19 on linux x64, 4 CPUs with [lint-bench](https://github.com/masseater/masseater.dev/tree/main/tools/lint-bench), which keeps the full results in [results.md](https://github.com/masseater/masseater.dev/blob/main/tools/lint-bench/results/results.md). Cold runs drop the page cache and the tools' caches first. "Same as ours", "Only ours" and "Only theirs" compare findings by file, line and rule where both tools use the same rules.
87
+ Measured on 2026-11-19 on linux x64, 4 CPUs with [lint-bench](https://github.com/masseater/ecosystems/tree/main/tools/lint-bench), which keeps the full results in [results.md](https://github.com/masseater/ecosystems/blob/main/tools/lint-bench/results/results.md). Cold runs drop the page cache and the tools' caches first. "Same as ours", "Only ours" and "Only theirs" compare findings by file, line and rule where both tools use the same rules.
55
88
 
56
89
  On the same files in nodejs/node, fu4 reports 74 of the 86 findings of actionlint and zizmor together and none of its own. The other 12 are actionlint 1.7.12 errors on `$/` paths in `uses:`, GitHub's syntax for an action or reusable workflow in the same repository, which actionlint does not accept yet. fu4 is slower, mostly in starting Node and loading the presets.
57
90
 
@@ -97,4 +130,4 @@ On the same files in nodejs/node, fu4 reports 74 of the 86 findings of actionlin
97
130
 
98
131
  ## Agent skills
99
132
 
100
- The package ships TanStack Intent skills for coding agents. Load one with `vp exec intent load @r_masseater/fu4#<skill>`.
133
+ The package ships agent skills in `skills/`. Add `permissions: { "@r_masseater/fu4": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links them into the skill directories of your agents.
@@ -1,3 +1,4 @@
1
+ import { a as baseName, n as matcher, r as selects } from "./types-CsheTVso.mjs";
1
2
  import { createRequire } from "node:module";
2
3
  import { Array as Array$1, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, Schema, String as String$1, pipe } from "effect";
3
4
  import { runMain } from "@effect/platform-node/NodeRuntime";
@@ -6,7 +7,6 @@ import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
7
  import { FetchHttpClient } from "effect/http";
7
8
  import { Otlp, OtlpSerialization } from "effect/observability";
8
9
  import { resolveConfigFromFile } from "vite-plus";
9
- import { minimatch } from "minimatch";
10
10
  // src/app/format.ts
11
11
  const format = (diagnostic) => `${diagnostic.path}:${String(diagnostic.line)}:${String(diagnostic.column)}: ${diagnostic.message} [${diagnostic.rule}]`;
12
12
  // ../lint-host/src/entities/rule/model/setting.ts
@@ -180,17 +180,40 @@ const mergedLayers = (layers) => ({
180
180
  ignores: pipe(layers, Array$1.flatMap((layer) => layer.ignores ?? [])),
181
181
  overrides: pipe(layers, Array$1.flatMap((layer) => layer.overrides ?? []))
182
182
  });
183
- // ../lint-host/src/shared/lib/words.ts
184
- const WORD$1 = 4;
185
183
  const EMPTY$1 = 0;
186
- const aligned = (buffer) => Option.match(Option.liftPredicate(buffer, ({ byteOffset }) => byteOffset % WORD$1 === EMPTY$1), {
184
+ const LENGTH = 1;
185
+ const aligned = (buffer) => Option.match(Option.liftPredicate(buffer, ({ byteOffset }) => byteOffset % 4 === EMPTY$1), {
187
186
  onNone: () => Uint8Array.from(buffer),
188
187
  onSome: (value) => value
189
188
  });
190
189
  const wordAt = (words) => (index) => words[index] ?? EMPTY$1;
191
- // src/entities/rule/model/define.ts
192
- const defineRule = (rule) => rule;
193
- const definePlugin = (plugin) => plugin;
190
+ const fieldsOf = (header) => (fields) => pipe(fields, Record.map((index) => wordAt(header)(index)));
191
+ const wordsOf = (buffer) => (at, count) => new Uint32Array(buffer.buffer, buffer.byteOffset + at * 4, count);
192
+ const spanText = (words) => (blob, encoding) => (spansAt, unit) => {
193
+ const decoder = new TextDecoder(encoding);
194
+ const cache = /* @__PURE__ */ new Map();
195
+ const read = (index) => {
196
+ const at = spansAt + index * 2;
197
+ const offset = wordAt(words)(at) * unit;
198
+ const value = decoder.decode(blob.subarray(offset, offset + wordAt(words)(at + LENGTH) * unit));
199
+ cache.set(index, value);
200
+ return value;
201
+ };
202
+ return (index) => Option.getOrElse(Option.fromNullishOr(cache.get(index)), () => read(index));
203
+ };
204
+ // ../lint-host/src/shared/lib/section.ts
205
+ const sectionOf = ({ name, fallback, prepare = Function.identity }) => {
206
+ const hasSection = (value) => Predicate.hasProperty(value, name) && Predicate.isObject(value[name]);
207
+ return (config) => pipe(Option.liftPredicate(config, hasSection), Option.flatMapNullishOr((value) => value[name]), Option.map(prepare), Option.getOrElse(() => fallback));
208
+ };
209
+ const pathspecsOf = ({ defaults, unowned = [] }) => ({ config, patterns = [] }) => [
210
+ ...Array$1.match(patterns, {
211
+ onEmpty: () => defaults,
212
+ onNonEmpty: Function.identity
213
+ }),
214
+ ...unowned,
215
+ ...pipe(config.ignores ?? [], Array$1.map((glob) => `:(glob,exclude)${glob}`))
216
+ ];
194
217
  // src/entities/rule/model/extend.ts
195
218
  const flattenConfig = (config) => {
196
219
  const layers = layersOf(config);
@@ -200,9 +223,8 @@ const flattenConfig = (config) => {
200
223
  };
201
224
  };
202
225
  // src/entities/rule/model/resolve.ts
203
- const NEGATION = "!";
204
- const SEPARATOR$1 = "/";
205
- const START = 0;
226
+ const SEPARATOR = "/";
227
+ const START$1 = 0;
206
228
  const enabled = ([id, entry]) => {
207
229
  const { severity, options } = settingOf(entry);
208
230
  if (severity === "off") return [];
@@ -212,34 +234,30 @@ const enabled = ([id, entry]) => {
212
234
  options
213
235
  }];
214
236
  };
215
- const matches = (path) => (pattern) => minimatch(path, pattern, { dot: true });
216
- const negated = String$1.startsWith(NEGATION);
217
- const applies = (path) => (override) => pipe(override.files, Array$1.filter((pattern) => !negated(pattern)), Array$1.some(matches(path))) && !pipe(override.files, Array$1.filter(negated), Array$1.map(String$1.slice(1)), Array$1.some(matches(path)));
218
- const isIgnored = (config) => (path) => pipe(config.ignores ?? [], Array$1.some(matches(path)));
237
+ const applies = (path) => (override) => selects(override.files)(path);
238
+ const isIgnored = (config) => (path) => matcher(config.ignores ?? [])(path);
219
239
  const entriesFor = (config) => (path) => {
220
240
  const merged = { ...config.rules };
221
241
  for (const override of pipe(config.overrides ?? [], Array$1.filter(applies(path)))) Object.assign(merged, override.rules);
222
242
  return merged;
223
243
  };
224
- const ruleOf = (config) => (id) => pipe(String$1.indexOf(SEPARATOR$1)(id), Option.flatMap((at) => pipe(Record.get(config.plugins ?? {}, String$1.slice(START, at)(id)), Option.flatMap((plugin) => Record.get(plugin.rules, String$1.slice(at + 1)(id))))));
244
+ const ruleOf = (config) => (id) => pipe(String$1.indexOf(SEPARATOR)(id), Option.flatMap((at) => pipe(Record.get(config.plugins ?? {}, String$1.slice(START$1, at)(id)), Option.flatMap((plugin) => Record.get(plugin.rules, String$1.slice(at + 1)(id))))));
225
245
  const activate = (config) => (entry) => pipe(ruleOf(config)(entry.id), Option.map((rule) => ({
226
246
  ...entry,
227
247
  rule
228
248
  })), Option.toArray);
229
249
  const activeRules = (config) => (path) => pipe(Record.toEntries(entriesFor(config)(path)), Array$1.flatMap(enabled), Array$1.flatMap(activate(config)));
230
250
  // src/entities/source/model/kind.ts
231
- const SEPARATOR = "/";
232
- const WORKFLOWS$1 = ".github/workflows/";
251
+ const WORKFLOWS = ".github/workflows/";
233
252
  const YAML = /\.ya?ml$/u;
234
253
  const ACTION = /^action\.ya?ml$/u;
235
254
  const DEPENDABOT = /^\.github\/dependabot\.ya?ml$/u;
236
255
  const PRE_COMMIT = /^\.pre-commit-(?:config|hooks)\.yaml$/u;
237
- const baseName = (path) => pipe(String$1.split(SEPARATOR)(path), Array$1.last, Option.getOrElse(() => path));
238
256
  const kindOf = (path) => {
239
257
  if (DEPENDABOT.test(path)) return Option.some("dependabot");
240
258
  if (PRE_COMMIT.test(path)) return Option.some("pre-commit");
241
259
  if (ACTION.test(baseName(path))) return Option.some("action");
242
- if (String$1.includes(WORKFLOWS$1)(path) && YAML.test(path)) return Option.some("workflow");
260
+ if (String$1.includes(WORKFLOWS)(path) && YAML.test(path)) return Option.some("workflow");
243
261
  return Option.none();
244
262
  };
245
263
  // src/shared/lib/errors.ts
@@ -247,10 +265,8 @@ const taggedError = Schema.TaggedError;
247
265
  var Fu4Error = class extends taggedError()("Fu4Error", { message: Schema.String }) {};
248
266
  const failedWith = (message) => (cause) => Fu4Error.make({ message: `${message}: ${String(cause)}` });
249
267
  // src/shared/native/source.ts
250
- const WORD = 4;
251
268
  const EMPTY = 0;
252
- const NEXT = 1;
253
- const STRING_WORDS = 2;
269
+ const START = 0;
254
270
  const NONE = 4294967295;
255
271
  const HEADER = {
256
272
  version: 0,
@@ -288,16 +304,15 @@ const FLAG = {
288
304
  missing: 4,
289
305
  extra: 8
290
306
  };
291
- const utf16 = new TextDecoder("utf-16le");
307
+ const UTF16 = "utf-16le";
292
308
  const rootOf = (value) => Option.liftPredicate(value, (id) => id !== NONE);
293
309
  const layoutOf = (header) => {
294
- const semanticCount = wordAt(header)(HEADER.semanticCount);
295
- const concreteCount = wordAt(header)(HEADER.concreteCount);
296
- const errorCount = wordAt(header)(HEADER.errorCount);
310
+ const fields = fieldsOf(header)(HEADER);
311
+ const { semanticCount, concreteCount, errorCount } = fields;
297
312
  const semanticAt = 8;
298
313
  const concreteAt = semanticAt + semanticCount * 8;
299
314
  const childAt = concreteAt + concreteCount * 8;
300
- const errorAt = childAt + wordAt(header)(HEADER.childCount);
315
+ const errorAt = childAt + fields.childCount;
301
316
  const spanAt = errorAt + errorCount * 3;
302
317
  return {
303
318
  semanticCount,
@@ -308,26 +323,15 @@ const layoutOf = (header) => {
308
323
  childAt,
309
324
  errorAt,
310
325
  spanAt,
311
- blobAt: (spanAt + wordAt(header)(HEADER.stringCount) * STRING_WORDS) * WORD
326
+ blobAt: (spanAt + fields.stringCount * 2) * 4
312
327
  };
313
328
  };
314
- const stringsOf = (words, blob, spanAt) => {
315
- const cache = /* @__PURE__ */ new Map();
316
- const decode = (index) => {
317
- const offset = wordAt(words)(spanAt + index * STRING_WORDS) * STRING_WORDS;
318
- const length = wordAt(words)(spanAt + index * STRING_WORDS + NEXT) * STRING_WORDS;
319
- const value = utf16.decode(blob.subarray(offset, offset + length));
320
- cache.set(index, value);
321
- return value;
322
- };
323
- return (index) => Option.getOrElse(Option.fromNullishOr(cache.get(index)), () => decode(index));
324
- };
325
329
  const sourceView = (raw) => {
326
330
  const buffer = aligned(raw);
327
- const header = new Uint32Array(buffer.buffer, buffer.byteOffset, 8);
331
+ const header = wordsOf(buffer)(START, 8);
328
332
  const layout = layoutOf(header);
329
- const words = new Uint32Array(buffer.buffer, buffer.byteOffset, layout.blobAt / WORD);
330
- const stringAt = stringsOf(words, buffer.subarray(layout.blobAt), layout.spanAt);
333
+ const words = wordsOf(buffer)(START, layout.blobAt / 4);
334
+ const stringAt = spanText(words)(buffer.subarray(layout.blobAt), UTF16)(layout.spanAt, 2);
331
335
  return {
332
336
  semanticCount: layout.semanticCount,
333
337
  semanticRoot: rootOf(wordAt(header)(HEADER.semanticRoot)),
@@ -532,7 +536,7 @@ const runRule = (input) => (active) => {
532
536
  reports.push(report);
533
537
  }
534
538
  };
535
- return checked(active, context).pipe(Effect.catchCause((cause) => Effect.fail(failedWith(`fu4 rule ${active.id} failed on ${input.path}`)(cause))), Effect.map(() => pipe(reports, Array$1.map(diagnosticOf(input, active)))), Effect.withSpan("fu4.rule", { attributes: {
539
+ return checked(active, context).pipe(Effect.catchCause((cause) => cause.pipe(failedWith(`fu4 rule ${active.id} failed on ${input.path}`), Effect.fail)), Effect.map(() => pipe(reports, Array$1.map(diagnosticOf(input, active)))), Effect.withSpan("fu4.rule", { attributes: {
536
540
  "fu4.rule.id": active.id,
537
541
  "code.file.path": input.path
538
542
  } }));
@@ -605,31 +609,24 @@ const lintText = Effect.fn("fu4.lintText")(function* lintText(input) {
605
609
  return ordered(results);
606
610
  });
607
611
  // src/app/section.ts
608
- const WORKFLOWS = [
609
- ".github/workflows/*.yml",
610
- ".github/workflows/*.yaml",
611
- ":(glob)**/action.yml",
612
- ":(glob)**/action.yaml",
613
- ".github/dependabot.yml",
614
- ".github/dependabot.yaml",
615
- ".pre-commit-config.yaml",
616
- ".pre-commit-hooks.yaml"
617
- ];
618
- const NOT_OWNED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
619
- const hasSection = (value) => Predicate.hasProperty(value, "fu4") && Predicate.isObject(value.fu4);
620
- const fu4Section = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => flattenConfig(value.fu4)), Option.getOrElse(() => ({})));
621
- const workflowPathspecs = ({ config, patterns = WORKFLOWS }) => [
622
- ...patterns,
623
- ...NOT_OWNED,
624
- ...pipe(config.ignores ?? [], Array$1.map((glob) => `:(glob,exclude)${glob}`))
625
- ];
626
- // src/shared/config/types.ts
627
- const INPUT_KINDS = [
628
- "workflow",
629
- "action",
630
- "dependabot",
631
- "pre-commit"
632
- ];
633
- export { lintText as a, definePlugin as c, format as d, lint as i, defineRule as l, fu4Section as n, Fu4Error as o, workflowPathspecs as r, failedWith as s, INPUT_KINDS as t, runCli as u };
612
+ const fu4Section = sectionOf({
613
+ name: "fu4",
614
+ prepare: flattenConfig,
615
+ fallback: {}
616
+ });
617
+ const workflowPathspecs = pathspecsOf({
618
+ defaults: [
619
+ ".github/workflows/*.yml",
620
+ ".github/workflows/*.yaml",
621
+ ":(glob)**/action.yml",
622
+ ":(glob)**/action.yaml",
623
+ ".github/dependabot.yml",
624
+ ".github/dependabot.yaml",
625
+ ".pre-commit-config.yaml",
626
+ ".pre-commit-hooks.yaml"
627
+ ],
628
+ unowned: [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"]
629
+ });
630
+ export { Fu4Error as a, format as c, lintText as i, workflowPathspecs as n, failedWith as o, lint as r, runCli as s, fu4Section as t };
634
631
 
635
- //# sourceMappingURL=app-DheTFmZd.mjs.map
632
+ //# sourceMappingURL=app-KgCbMsJa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-KgCbMsJa.mjs","names":["taggedError","Rec","Str","Arr","DATA_FIRST_ARITY","Arr","Fn","Str","nodeServices","present","Fn","Bool","byPosition","Arr","Rec","EMPTY","Rec","Fn","Arr","Arr","START","Arr","Str","Rec","Str","Arr","Str","Arr","CONCURRENT","Arr","Arr"],"sources":["../src/app/format.ts","../../lint-host/src/entities/rule/model/setting.ts","../../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/load-addon/model/guard.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/layers.ts","../../lint-host/src/shared/lib/words.ts","../../lint-host/src/shared/lib/section.ts","../src/entities/rule/model/extend.ts","../src/entities/rule/model/resolve.ts","../src/entities/source/model/kind.ts","../src/shared/lib/errors.ts","../src/shared/native/source.ts","../src/shared/native/index.ts","../src/entities/source/model/source.ts","../src/features/run-rules/model/order.ts","../src/features/run-rules/model/run.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["import type { Diagnostic } from \"#/shared/config/index.ts\";\n\nexport const format = (diagnostic: Diagnostic): string =>\n `${diagnostic.path}:${String(diagnostic.line)}:${String(diagnostic.column)}: ${diagnostic.message} [${diagnostic.rule}]`;\n","import { Array as Arr, Match, Option, Record as Rec, pipe } from \"effect\";\n\nexport type Severity = \"off\" | \"warn\" | \"error\";\n\nexport type RuleOptions = Readonly<Record<string, unknown>>;\n\nexport type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];\n\nexport interface Setting {\n readonly severity: Severity;\n readonly options: RuleOptions;\n}\n\nconst NO_OPTIONS: RuleOptions = {};\n\nexport const settingOf = (entry: RuleEntry): Setting =>\n Match.value(entry).pipe(\n Match.when(Match.string, (severity): Setting => ({ severity, options: NO_OPTIONS })),\n Match.orElse(([severity, options]): Setting => ({\n severity,\n options: options ?? NO_OPTIONS,\n })),\n );\n\nconst optionsOf = (entry: RuleEntry): Option.Option<RuleOptions> =>\n Match.value(entry).pipe(\n Match.when(Match.string, () => Option.none()),\n Match.orElse(([, options]) => Option.fromUndefinedOr(options)),\n );\n\nconst overridden = (earlier: RuleEntry, later: RuleEntry): RuleEntry =>\n pipe(\n optionsOf(later),\n Option.orElse(() => optionsOf(earlier)),\n Option.match({\n onNone: () => later,\n onSome: (options): RuleEntry => [settingOf(later).severity, options],\n }),\n );\n\nexport const mergedRules = (\n layers: readonly (Readonly<Record<string, RuleEntry>> | undefined)[],\n): Readonly<Record<string, RuleEntry>> => {\n const merged: Record<string, RuleEntry> = {};\n for (const [name, later] of pipe(\n layers,\n Arr.flatMap((layer) => Rec.toEntries(layer ?? {})),\n )) {\n merged[name] = pipe(\n Rec.get(merged, name),\n Option.match({\n onNone: () => later,\n onSome: (earlier) => overridden(earlier, later),\n }),\n );\n }\n return merged;\n};\n","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 { Array as Arr, Predicate, pipe } from \"effect\";\n\nconst hasFunction =\n (value: unknown) =>\n (name: string): boolean =>\n Predicate.hasProperty(value, name) && Predicate.isFunction(value[name]);\n\nexport const exposes =\n <Addon>(names: readonly Extract<keyof Addon, string>[]) =>\n (value: unknown): value is Addon =>\n pipe(names, Arr.every(hasFunction(value)));\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, Record as Rec, pipe } from \"effect\";\n\nexport interface Layer<Plugin, Entry, Override> {\n readonly plugins?: Readonly<Record<string, Plugin>>;\n readonly rules?: Readonly<Record<string, Entry>>;\n readonly ignores?: readonly string[];\n readonly overrides?: readonly Override[];\n}\n\nexport interface Merged<Plugin, Entry, Override> {\n readonly plugins: Readonly<Record<string, Plugin>>;\n readonly rules: Readonly<Record<string, Entry>>;\n readonly ignores: readonly string[];\n readonly overrides: readonly Override[];\n}\n\nexport const mergedRecords = <Value>(\n records: readonly (Readonly<Record<string, Value>> | undefined)[],\n): Readonly<Record<string, Value>> =>\n pipe(\n records,\n Arr.flatMap((record) => Rec.toEntries(record ?? {})),\n Rec.fromEntries,\n );\n\nexport const layersOf = <Config extends { readonly extends?: readonly Config[] }>(\n config: Config,\n): readonly Omit<Config, \"extends\">[] => {\n const { extends: bases = [], ...own } = config;\n return [...pipe(bases, Arr.flatMap(layersOf)), own];\n};\n\nexport const mergedLayers = <Plugin, Entry, Override>(\n layers: readonly Layer<Plugin, Entry, Override>[],\n): Merged<Plugin, Entry, Override> => ({\n plugins: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.plugins),\n ),\n ),\n rules: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.rules),\n ),\n ),\n ignores: pipe(\n layers,\n Arr.flatMap((layer) => layer.ignores ?? []),\n ),\n overrides: pipe(\n layers,\n Arr.flatMap((layer) => layer.overrides ?? []),\n ),\n});\n","import { Option, Record as Rec, pipe } from \"effect\";\n\nexport const WORD = 4;\nexport const STRING_WORDS = 2;\nconst EMPTY = 0;\nconst LENGTH = 1;\n\nexport const aligned = (buffer: Uint8Array): Uint8Array =>\n Option.match(\n Option.liftPredicate(buffer, ({ byteOffset }) => byteOffset % WORD === EMPTY),\n {\n onNone: () => Uint8Array.from(buffer),\n onSome: (value) => value,\n },\n );\n\nexport const wordAt =\n (words: Uint32Array) =>\n (index: number): number =>\n words[index] ?? EMPTY;\n\nexport const fieldsOf =\n (header: Uint32Array) =>\n <Name extends string>(fields: Readonly<Record<Name, number>>): Readonly<Record<Name, number>> =>\n pipe(\n fields,\n Rec.map((index) => wordAt(header)(index)),\n );\n\nexport const wordsOf =\n (buffer: Uint8Array) =>\n (at: number, count: number): Uint32Array =>\n new Uint32Array(buffer.buffer, buffer.byteOffset + at * WORD, count);\n\nexport const spanText =\n (words: Uint32Array) =>\n (blob: Uint8Array, encoding: string) =>\n (spansAt: number, unit: number): ((index: number) => string) => {\n const decoder = new TextDecoder(encoding);\n const cache = new Map<number, string>();\n const read = (index: number): string => {\n const at = spansAt + index * STRING_WORDS;\n const offset = wordAt(words)(at) * unit;\n const value = decoder.decode(\n blob.subarray(offset, offset + wordAt(words)(at + LENGTH) * unit),\n );\n cache.set(index, value);\n return value;\n };\n return (index) => Option.getOrElse(Option.fromNullishOr(cache.get(index)), () => read(index));\n };\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 { layersOf, mergedLayers, mergedRecords } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport type { Fu4Config } from \"#/shared/config/index.ts\";\n\nexport const flattenConfig = (config: Fu4Config): Fu4Config => {\n const layers = layersOf(config);\n return {\n ...mergedLayers(layers),\n settings: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.settings),\n ),\n ),\n };\n};\n","import { settingOf } from \"@masseater.dev/lint-host\";\nimport { matcher, selects } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type {\n Fu4Config,\n Override,\n Rule,\n RuleEntry,\n RuleOptions,\n Severity,\n} from \"#/shared/config/index.ts\";\n\nconst SEPARATOR = \"/\";\nconst START = 0;\n\nexport interface ActiveRule {\n readonly id: string;\n readonly rule: Rule;\n readonly severity: Exclude<Severity, \"off\">;\n readonly options: RuleOptions;\n}\n\ninterface Enabled {\n readonly id: string;\n readonly severity: Exclude<Severity, \"off\">;\n readonly options: RuleOptions;\n}\n\nconst enabled = ([id, entry]: readonly [string, RuleEntry]): readonly Enabled[] => {\n const { severity, options } = settingOf(entry);\n if (severity === \"off\") {\n return [];\n }\n return [{ id, severity, options }];\n};\n\nconst applies =\n (path: string) =>\n (override: Override): boolean =>\n selects(override.files)(path);\n\nexport const isIgnored =\n (config: Fu4Config) =>\n (path: string): boolean =>\n matcher(config.ignores ?? [])(path);\n\nexport const entriesFor =\n (config: Fu4Config) =>\n (path: string): Readonly<Record<string, RuleEntry>> => {\n const merged: Record<string, RuleEntry> = { ...config.rules };\n for (const override of pipe(config.overrides ?? [], Arr.filter(applies(path)))) {\n Object.assign(merged, override.rules);\n }\n return merged;\n };\n\nconst ruleOf =\n (config: Fu4Config) =>\n (id: string): Option.Option<Rule> =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.flatMap((at) =>\n pipe(\n Rec.get(config.plugins ?? {}, Str.slice(START, at)(id)),\n Option.flatMap((plugin) => Rec.get(plugin.rules, Str.slice(at + SEPARATOR.length)(id))),\n ),\n ),\n );\n\nconst activate =\n (config: Fu4Config) =>\n (entry: Enabled): readonly ActiveRule[] =>\n pipe(\n ruleOf(config)(entry.id),\n Option.map((rule): ActiveRule => ({ ...entry, rule })),\n Option.toArray,\n );\n\nexport const activeRules =\n (config: Fu4Config) =>\n (path: string): readonly ActiveRule[] =>\n pipe(\n Rec.toEntries(entriesFor(config)(path)),\n Arr.flatMap(enabled),\n Arr.flatMap(activate(config)),\n );\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Option, String as Str } from \"effect\";\n\nimport type { InputKind } from \"#/shared/config/index.ts\";\n\nconst WORKFLOWS = \".github/workflows/\";\nconst YAML = /\\.ya?ml$/u;\nconst ACTION = /^action\\.ya?ml$/u;\nconst DEPENDABOT = /^\\.github\\/dependabot\\.ya?ml$/u;\nconst PRE_COMMIT = /^\\.pre-commit-(?:config|hooks)\\.yaml$/u;\n\nexport const kindOf = (path: string): Option.Option<InputKind> => {\n if (DEPENDABOT.test(path)) {\n return Option.some(\"dependabot\");\n }\n if (PRE_COMMIT.test(path)) {\n return Option.some(\"pre-commit\");\n }\n if (ACTION.test(baseName(path))) {\n return Option.some(\"action\");\n }\n if (Str.includes(WORKFLOWS)(path) && YAML.test(path)) {\n return Option.some(\"workflow\");\n }\n return Option.none();\n};\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class Fu4Error extends taggedError<Fu4Error, { readonly brand: unique symbol }>()(\n \"Fu4Error\",\n {\n message: Schema.String,\n },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): Fu4Error =>\n Fu4Error.make({ message: `${message}: ${String(cause)}` });\n","import {\n STRING_WORDS,\n WORD,\n aligned,\n fieldsOf,\n spanText,\n wordAt,\n wordsOf,\n} from \"@masseater.dev/lint-host\";\nimport { Option } from \"effect\";\n\nconst EMPTY = 0;\nconst START = 0;\nexport const NONE = 4_294_967_295;\nexport const HEADER_WORDS = 8;\nexport const SEMANTIC_WORDS = 8;\nexport const CONCRETE_WORDS = 8;\nexport const ERROR_WORDS = 3;\n\nexport const HEADER = {\n version: 0,\n semanticCount: 1,\n semanticRoot: 2,\n concreteCount: 3,\n concreteRoot: 4,\n childCount: 5,\n errorCount: 6,\n stringCount: 7,\n} as const;\n\nexport const SEMANTIC = {\n kind: 0,\n tag: 1,\n value: 2,\n style: 3,\n line: 4,\n column: 5,\n childStart: 6,\n childCount: 7,\n} as const;\n\nexport const CONCRETE = {\n kind: 0,\n flags: 1,\n start: 2,\n end: 3,\n field: 4,\n parent: 5,\n childStart: 6,\n childCount: 7,\n} as const;\n\nexport const FLAG = { named: 1, error: 2, missing: 4, extra: 8 } as const;\n\nexport interface SourceView {\n readonly semanticCount: number;\n readonly semanticRoot: Option.Option<number>;\n readonly concreteCount: number;\n readonly concreteRoot: Option.Option<number>;\n readonly errorCount: number;\n readonly semantic: (id: number, field: number) => number;\n readonly concrete: (id: number, field: number) => number;\n readonly child: (index: number) => number;\n readonly error: (index: number, field: number) => number;\n readonly stringAt: (index: number) => string;\n readonly text: string;\n}\n\nconst UTF16 = \"utf-16le\";\n\nconst rootOf = (value: number): Option.Option<number> =>\n Option.liftPredicate(value, (id) => id !== NONE);\n\ninterface Layout {\n readonly semanticCount: number;\n readonly concreteCount: number;\n readonly errorCount: number;\n readonly semanticAt: number;\n readonly concreteAt: number;\n readonly childAt: number;\n readonly errorAt: number;\n readonly spanAt: number;\n readonly blobAt: number;\n}\n\nconst layoutOf = (header: Uint32Array): Layout => {\n const fields = fieldsOf(header)(HEADER);\n const { semanticCount, concreteCount, errorCount } = fields;\n const semanticAt = HEADER_WORDS;\n const concreteAt = semanticAt + semanticCount * SEMANTIC_WORDS;\n const childAt = concreteAt + concreteCount * CONCRETE_WORDS;\n const errorAt = childAt + fields.childCount;\n const spanAt = errorAt + errorCount * ERROR_WORDS;\n const blobAt = (spanAt + fields.stringCount * STRING_WORDS) * WORD;\n return {\n semanticCount,\n concreteCount,\n errorCount,\n semanticAt,\n concreteAt,\n childAt,\n errorAt,\n spanAt,\n blobAt,\n };\n};\n\nexport const sourceView = (raw: Uint8Array): SourceView => {\n const buffer = aligned(raw);\n const header = wordsOf(buffer)(START, HEADER_WORDS);\n const layout = layoutOf(header);\n const words = wordsOf(buffer)(START, layout.blobAt / WORD);\n const stringAt = spanText(words)(buffer.subarray(layout.blobAt), UTF16)(\n layout.spanAt,\n STRING_WORDS,\n );\n return {\n semanticCount: layout.semanticCount,\n semanticRoot: rootOf(wordAt(header)(HEADER.semanticRoot)),\n concreteCount: layout.concreteCount,\n concreteRoot: rootOf(wordAt(header)(HEADER.concreteRoot)),\n errorCount: layout.errorCount,\n semantic: (id, field) => wordAt(words)(layout.semanticAt + id * SEMANTIC_WORDS + field),\n concrete: (id, field) => wordAt(words)(layout.concreteAt + id * CONCRETE_WORDS + field),\n child: (index) => wordAt(words)(layout.childAt + index),\n error: (index, field) => wordAt(words)(layout.errorAt + index * ERROR_WORDS + field),\n stringAt,\n text: stringAt(EMPTY),\n };\n};\n","import { exposes, loadAddon } from \"@masseater.dev/lint-host\";\nimport type { Effect } from \"effect\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { Fu4Error } from \"#/shared/lib/errors.ts\";\n\nexport { CONCRETE, FLAG, NONE, SEMANTIC, sourceView } from \"./source.ts\";\nexport type { SourceView } from \"./source.ts\";\n\nexport interface ParsedFile {\n readonly path: string;\n readonly source: Uint8Array;\n}\n\nexport interface Native {\n readonly parsePaths: (\n root: string,\n paths: readonly string[],\n options: { readonly traceparent: string | undefined },\n ) => readonly ParsedFile[];\n readonly parseText: (text: string) => Uint8Array;\n readonly parseScript: (language: string, text: string) => Uint8Array;\n readonly readText: (root: string, path: string) => string | null;\n readonly pathExists: (root: string, path: string) => boolean;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst NATIVE_FUNCTIONS = [\n \"parsePaths\",\n \"parseText\",\n \"parseScript\",\n \"readText\",\n \"pathExists\",\n \"flushTelemetry\",\n] as const;\n\nconst isNative = exposes<Native>(NATIVE_FUNCTIONS);\n\nexport const native: Effect.Effect<Native, Fu4Error> = loadAddon({\n packageName: \"@r_masseater/fu4\",\n binary: \"fu4\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type {\n ParseError,\n Position,\n Source,\n SyntaxNode,\n YamlKind,\n YamlNode,\n YamlStyle,\n} from \"#/shared/config/index.ts\";\nimport { CONCRETE, FLAG, NONE, SEMANTIC } from \"#/shared/native/index.ts\";\nimport type { SourceView } from \"#/shared/native/index.ts\";\n\nconst FIRST = 1;\nconst FIRST_LINE = 0;\nconst HALF = 2;\nconst BIT = 2;\nconst SET = 1;\nconst ERROR_FIELD = { line: 0, column: 1, message: 2 } as const;\nconst LINE_BREAK = /\\r\\n|\\r|\\n/u;\nconst NEWLINES = /\\n/gu;\n\nconst KINDS: readonly YamlKind[] = [\"scalar\", \"sequence\", \"mapping\", \"alias\"];\nconst STYLES: readonly YamlStyle[] = [\n \"plain\",\n \"single-quoted\",\n \"double-quoted\",\n \"literal\",\n \"folded\",\n];\n\nconst pick = <Value>(values: readonly Value[], index: number, fallback: Value): Value =>\n pipe(\n Arr.get(values, index),\n Option.getOrElse(() => fallback),\n );\n\nconst lazy = <Value>(make: () => Value): (() => Value) => {\n let made: Option.Option<Value> = Option.none();\n return () =>\n pipe(\n made,\n Option.getOrElse(() => {\n const value = make();\n made = Option.some(value);\n return value;\n }),\n );\n};\n\nconst memo = <Node>(make: (id: number) => Node): ((id: number) => Node) => {\n const made = new Map<number, Node>();\n return (id) => made.getOrInsertComputed(id, () => make(id));\n};\n\nconst times = <Value>(count: number, make: (index: number) => Value): readonly Value[] =>\n Array.from({ length: count }, (_empty, index) => make(index));\n\nconst childrenOf =\n <Node>(view: SourceView, at: (id: number) => Node) =>\n (start: number, count: number): readonly Node[] =>\n times(count, (offset) => at(view.child(start + offset)));\n\nconst yamlTree = (view: SourceView): ((id: number) => YamlNode) => {\n const at: (id: number) => YamlNode = memo((id) => {\n const field = (name: keyof typeof SEMANTIC): number => view.semantic(id, SEMANTIC[name]);\n const children = lazy(() => childrenOf(view, at)(field(\"childStart\"), field(\"childCount\")));\n return {\n id,\n kind: pick(KINDS, field(\"kind\"), \"scalar\"),\n tag: view.stringAt(field(\"tag\")),\n value: view.stringAt(field(\"value\")),\n style: pick(STYLES, field(\"style\"), \"plain\"),\n line: field(\"line\"),\n column: field(\"column\"),\n get children(): readonly YamlNode[] {\n return children();\n },\n };\n });\n return at;\n};\n\nconst hasFlag = (flags: number, flag: number): boolean => Math.floor(flags / flag) % BIT === SET;\n\nconst present = (index: number): Option.Option<number> =>\n Option.liftPredicate(index, (value) => value !== NONE);\n\nconst syntaxNode =\n (view: SourceView, at: (id: number) => SyntaxNode) =>\n (id: number): SyntaxNode => {\n const field = (name: keyof typeof CONCRETE): number => view.concrete(id, CONCRETE[name]);\n const flags = field(\"flags\");\n const start = field(\"start\");\n const end = field(\"end\");\n const children = lazy(() => childrenOf(view, at)(field(\"childStart\"), field(\"childCount\")));\n return {\n id,\n type: view.stringAt(field(\"kind\")),\n named: hasFlag(flags, FLAG.named),\n isError: hasFlag(flags, FLAG.error),\n isMissing: hasFlag(flags, FLAG.missing),\n isExtra: hasFlag(flags, FLAG.extra),\n start,\n end,\n field: pipe(present(field(\"field\")), Option.map(view.stringAt), Option.getOrUndefined),\n get parent(): SyntaxNode | undefined {\n return pipe(present(field(\"parent\")), Option.map(at), Option.getOrUndefined);\n },\n get children(): readonly SyntaxNode[] {\n return children();\n },\n get namedChildren(): readonly SyntaxNode[] {\n return pipe(\n children(),\n Arr.filter((child) => child.named),\n );\n },\n get text(): string {\n return Str.slice(start, end)(view.text);\n },\n };\n };\n\nconst syntaxTree = (view: SourceView): ((id: number) => SyntaxNode) => {\n const at: (id: number) => SyntaxNode = memo((id) => syntaxNode(view, at)(id));\n return at;\n};\n\nconst lineStartsOf = (text: string): readonly number[] => [\n FIRST_LINE,\n ...Array.from(Str.matchAll(NEWLINES)(text), (match) => (match.index ?? FIRST_LINE) + FIRST),\n];\n\nconst lineAt = (starts: readonly number[], offset: number): number => {\n let low = FIRST_LINE;\n let high = starts.length - FIRST;\n while (low < high) {\n const middle = Math.ceil((low + high) / HALF);\n if ((starts[middle] ?? FIRST_LINE) <= offset) {\n low = middle;\n } else {\n high = middle - FIRST;\n }\n }\n return low;\n};\n\nconst positionIn = (text: string): ((offset: number) => Position) => {\n const starts = lineStartsOf(text);\n return (offset) => {\n const line = lineAt(starts, offset);\n return { line: line + FIRST, column: offset - (starts[line] ?? FIRST_LINE) + FIRST };\n };\n};\n\nconst errorsOf = (view: SourceView): readonly ParseError[] =>\n times(view.errorCount, (index) => ({\n line: view.error(index, ERROR_FIELD.line),\n column: view.error(index, ERROR_FIELD.column),\n message: view.stringAt(view.error(index, ERROR_FIELD.message)),\n }));\n\nexport const sourceOf = (view: SourceView): Source => {\n const yaml = yamlTree(view);\n const syntax = syntaxTree(view);\n const lines = lazy(() => Str.split(LINE_BREAK)(view.text));\n return {\n text: view.text,\n yaml: pipe(view.semanticRoot, Option.map(yaml), Option.getOrUndefined),\n syntax: pipe(view.concreteRoot, Option.map(syntax), Option.getOrUndefined),\n errors: errorsOf(view),\n get lines(): readonly string[] {\n return lines();\n },\n positionOf: positionIn(view.text),\n };\n};\n","import { Array as Arr, Order } from \"effect\";\n\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\n\nconst byPosition: Order.Order<Diagnostic> = Order.combineAll([\n Order.mapInput(Order.String, (found: Diagnostic) => found.path),\n Order.mapInput(Order.Number, (found: Diagnostic) => found.line),\n Order.mapInput(Order.Number, (found: Diagnostic) => found.column),\n Order.mapInput(Order.String, (found: Diagnostic) => found.message),\n]);\n\nconst same = (left: Diagnostic, right: Diagnostic): boolean =>\n left.path === right.path &&\n left.line === right.line &&\n left.column === right.column &&\n left.message === right.message &&\n left.rule === right.rule;\n\nexport const ordered = (found: readonly Diagnostic[]): readonly Diagnostic[] =>\n Arr.dedupeWith(Arr.sort(found, byPosition), same);\n","import { Array as Arr, Effect, pipe } from \"effect\";\n\nimport type { ActiveRule } from \"#/entities/rule/index.ts\";\nimport type {\n Diagnostic,\n InputKind,\n Project,\n Report,\n RuleContext,\n ScriptLanguage,\n Source,\n} from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { Fu4Error } from \"#/shared/lib/errors.ts\";\n\nexport interface FileInput {\n readonly path: string;\n readonly kind: InputKind;\n readonly source: Source;\n readonly rules: readonly ActiveRule[];\n readonly settings: Readonly<Record<string, unknown>>;\n readonly project: Project;\n readonly parseScript: (language: ScriptLanguage, text: string) => Source;\n}\n\nconst CONCURRENT = { concurrency: \"unbounded\" } as const;\n\nconst appliesTo =\n (kind: InputKind) =>\n ({ rule }: ActiveRule): boolean =>\n pipe(\n rule.meta.kinds ?? [\"workflow\"],\n Arr.some((each) => each === kind),\n );\n\nconst diagnosticOf =\n (input: FileInput, active: ActiveRule) =>\n ({ rule, ...report }: Report): Diagnostic => ({\n path: input.path,\n ...report,\n rule: rule ?? active.id,\n severity: active.severity,\n });\n\nconst checked = (active: ActiveRule, context: RuleContext): Effect.Effect<void> =>\n Effect.suspend(() => {\n const result = active.rule.check(context);\n if (Effect.isEffect(result)) {\n return result;\n }\n return Effect.void;\n });\n\nconst runRule =\n (input: FileInput) =>\n (active: ActiveRule): Effect.Effect<readonly Diagnostic[], Fu4Error> => {\n const reports: Report[] = [];\n const context: RuleContext = {\n filename: input.path,\n kind: input.kind,\n source: input.source,\n options: active.options,\n settings: input.settings,\n project: input.project,\n parseScript: input.parseScript,\n report: (report) => {\n reports.push(report);\n },\n };\n return checked(active, context).pipe(\n Effect.catchCause((cause) =>\n cause.pipe(failedWith(`fu4 rule ${active.id} failed on ${input.path}`), Effect.fail),\n ),\n Effect.map(() => pipe(reports, Arr.map(diagnosticOf(input, active)))),\n Effect.withSpan(\"fu4.rule\", {\n attributes: { \"fu4.rule.id\": active.id, \"code.file.path\": input.path },\n }),\n );\n };\n\nexport const runFile = Effect.fn(\"fu4.runFile\")(function* runFile(input: FileInput) {\n const active = pipe(input.rules, Arr.filter(appliesTo(input.kind)));\n const results = yield* Effect.forEach(active, runRule(input), CONCURRENT);\n return Arr.flatten(results);\n});\n","import { callAddon, traceparent } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { activeRules, flattenConfig, isIgnored } from \"#/entities/rule/index.ts\";\nimport { kindOf, sourceOf } from \"#/entities/source/index.ts\";\nimport { ordered, runFile } from \"#/features/run-rules/index.ts\";\nimport type {\n Fu4Config,\n InputKind,\n Project,\n ScriptLanguage,\n Source,\n} from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport { native, sourceView } from \"#/shared/native/index.ts\";\nimport type { Native, ParsedFile } from \"#/shared/native/index.ts\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly config?: Fu4Config;\n}\n\nexport interface LintTextInput {\n readonly root: string;\n readonly path: string;\n readonly text: string;\n readonly kind?: InputKind;\n readonly config?: Fu4Config;\n}\n\nconst CONCURRENT = { concurrency: \"unbounded\" } as const;\n\nconst projectOf = (root: string, addon: Native): Project => {\n const parsed = new Map<string, Option.Option<Source>>();\n const read = (file: string): Option.Option<string> =>\n Option.fromNullishOr(addon.readText(root, file));\n const parse = (file: string): Option.Option<Source> => {\n const source = pipe(\n read(file),\n Option.map((text) => sourceOf(sourceView(addon.parseText(text)))),\n );\n parsed.set(file, source);\n return source;\n };\n return {\n root,\n exists: (file) => addon.pathExists(root, file),\n read,\n parse: (file) => Option.getOrElse(Option.fromNullishOr(parsed.get(file)), () => parse(file)),\n };\n};\n\nconst scriptParser =\n (addon: Native) =>\n (language: ScriptLanguage, text: string): Source =>\n sourceOf(sourceView(addon.parseScript(language, text)));\n\nconst targetsOf = (config: Fu4Config, files: readonly string[]): readonly string[] =>\n pipe(\n files,\n Arr.filter((file) => Option.isSome(kindOf(file)) && !isIgnored(config)(file)),\n );\n\nconst parsedFiles = Effect.fn(\"fu4.parse\")(function* parsedFiles(\n root: string,\n targets: readonly string[],\n) {\n const parent = yield* traceparent;\n return yield* callAddon({\n addon: native,\n name: \"fu4\",\n files: targets.length,\n call: (loaded): readonly ParsedFile[] =>\n loaded.parsePaths(root, targets, { traceparent: Option.getOrUndefined(parent) }),\n failWith: failedWith,\n });\n});\n\nexport const lint = Effect.fn(\"fu4.lint\")(function* lint(input: LintInput) {\n const config = flattenConfig(input.config ?? {});\n const addon = yield* native;\n const parsed = yield* parsedFiles(input.root, targetsOf(config, input.files));\n const project = projectOf(input.root, addon);\n const lintOne = (file: ParsedFile): ReturnType<typeof runFile> =>\n runFile({\n path: file.path,\n kind: Option.getOrThrow(kindOf(file.path)),\n source: sourceOf(sourceView(file.source)),\n rules: activeRules(config)(file.path),\n settings: config.settings ?? {},\n project,\n parseScript: scriptParser(addon),\n });\n const results = yield* Effect.forEach(parsed, lintOne, CONCURRENT);\n return ordered(Arr.flatten(results));\n});\n\nconst kindFor = (input: LintTextInput): InputKind =>\n pipe(\n Option.fromNullishOr(input.kind),\n Option.orElse(() => kindOf(input.path)),\n Option.getOrElse((): InputKind => \"workflow\"),\n );\n\nexport const lintText = Effect.fn(\"fu4.lintText\")(function* lintText(input: LintTextInput) {\n const config = flattenConfig(input.config ?? {});\n const addon = yield* native;\n const source = sourceOf(sourceView(addon.parseText(input.text)));\n const results = yield* runFile({\n path: input.path,\n kind: kindFor(input),\n source,\n rules: activeRules(config)(input.path),\n settings: config.settings ?? {},\n project: projectOf(input.root, addon),\n parseScript: scriptParser(addon),\n });\n return ordered(results);\n});\n","import { pathspecsOf, sectionOf } from \"@masseater.dev/lint-host\";\nimport type { PathspecRequest } from \"@masseater.dev/lint-host\";\n\nimport { flattenConfig } from \"#/entities/rule/index.ts\";\nimport type { Fu4Config } from \"#/shared/config/index.ts\";\n\nexport type PathspecInput = PathspecRequest<Fu4Config>;\n\nexport const fu4Section = sectionOf<Fu4Config>({\n name: \"fu4\",\n prepare: flattenConfig,\n fallback: {},\n});\n\nexport const workflowPathspecs = pathspecsOf({\n defaults: [\n \".github/workflows/*.yml\",\n \".github/workflows/*.yaml\",\n \":(glob)**/action.yml\",\n \":(glob)**/action.yaml\",\n \".github/dependabot.yml\",\n \".github/dependabot.yaml\",\n \".pre-commit-config.yaml\",\n \".pre-commit-hooks.yaml\",\n ],\n unowned: [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"],\n});\n"],"mappings":";;;;;;;;;;AAEA,MAAa,UAAU,eACrB,GAAG,WAAW,KAAK,GAAG,OAAO,WAAW,IAAI,EAAE,GAAG,OAAO,WAAW,MAAM,EAAE,IAAI,WAAW,QAAQ,IAAI,WAAW,KAAK;;ACUxH,MAAM,aAA0B,CAAC;AAEjC,MAAa,aAAa,UACxB,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,MAAM,SAAS,cAAuB;CAAE;CAAU,SAAS;AAAW,EAAE,GACnF,MAAM,QAAQ,CAAC,UAAU,cAAuB;CAC9C;CACA,SAAS,WAAW;AACtB,EAAE,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AAC,MAAM,IAAI;EACrC,UAAU,OAAO,YAAY,CAAC;EAC9B,SAAS,UAAU,MAAM,MAAM,KAAK;EACpC,aAAa,aAAa,KAAK;CACjC,CAAC;CACD,OAAO,QAAQ,OAAO;AACxB,CAAC;;AC/GD,MAAa,aAAa,UAAqB;CAC7C,MAAM;CACN,SAAS;CACT,UAAU,CAAC;AACb,CAAC;AAED,MAAa,oBAAoB,YAAY;CAC3C,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,SAAS,CAAC,qCAAqC,oCAAoC;AACrF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { d as format, i as lint, n as fu4Section, r as workflowPathspecs, s as failedWith, u as runCli$1 } from "./app-DheTFmZd.mjs";
1
+ import { c as format, n as workflowPathspecs, o as failedWith, r as lint, s as runCli$1, t as fu4Section } from "./app-KgCbMsJa.mjs";
2
2
  // src/app/cli.ts
3
3
  const runCli = () => {
4
4
  runCli$1({
@@ -12,4 +12,4 @@ const runCli = () => {
12
12
  };
13
13
  export { runCli };
14
14
 
15
- //# sourceMappingURL=cli-Dc3I8PTz.mjs.map
15
+ //# sourceMappingURL=cli-CfFhh0Tu.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-Dc3I8PTz.mjs","names":[],"sources":["../src/app/cli.ts"],"sourcesContent":["import { runCli as runLinter } from \"@masseater.dev/lint-host\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { format, lint } from \"./index.ts\";\nimport { fu4Section, workflowPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"fu4\",\n section: fu4Section,\n pathspecs: workflowPathspecs,\n lint,\n format,\n failWith: failedWith,\n });\n};\n"],"mappings":";;AAOA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACN,SAAS;EACT,WAAW;EACX;EACA;EACA,UAAU;CACZ,CAAC;AACH"}
1
+ {"version":3,"file":"cli-CfFhh0Tu.mjs","names":[],"sources":["../src/app/cli.ts"],"sourcesContent":["import { runCli as runLinter } from \"@masseater.dev/lint-host\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { format, lint } from \"./index.ts\";\nimport { fu4Section, workflowPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"fu4\",\n section: fu4Section,\n pathspecs: workflowPathspecs,\n lint,\n format,\n failWith: failedWith,\n });\n};\n"],"mappings":";;AAOA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACN,SAAS;EACT,WAAW;EACX;EACA;EACA,UAAU;CACZ,CAAC;AACH"}
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { enableCompileCache } from "node:module";
3
3
  // bin/fu4.ts
4
4
  enableCompileCache();
5
- const { runCli } = await import("./cli-Dc3I8PTz.mjs");
5
+ const { runCli } = await import("./cli-CfFhh0Tu.mjs");
6
6
  runCli();
7
7
  export {};
8
8
 
@@ -2,6 +2,10 @@ import { Effect, FileSystem, Option, Path } from "effect";
2
2
  type Severity = "off" | "warn" | "error";
3
3
  type RuleOptions = Readonly<Record<string, unknown>>;
4
4
  type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];
5
+ interface PathspecRequest<Config> {
6
+ readonly config: Config;
7
+ readonly patterns?: readonly string[];
8
+ }
5
9
  interface Position {
6
10
  readonly line: number;
7
11
  readonly column: number;
@@ -106,5 +110,5 @@ interface Diagnostic {
106
110
  readonly detail?: string;
107
111
  readonly severity: Exclude<Severity, "off">;
108
112
  }
109
- export { YamlNode as _, Override as a, RuleOptions as b, Position as c, Rule as d, RuleContext as f, YamlKind as g, SyntaxNode as h, InputKind as i, Project as l, Source as m, Fu4Config as n, ParseError as o, ScriptLanguage as p, INPUT_KINDS as r, Plugin as s, Diagnostic as t, Report as u, YamlStyle as v, Severity as x, RuleEntry as y };
110
- //# sourceMappingURL=index-BBTwA_Cz.d.mts.map
113
+ export { Severity as S, YamlNode as _, Override as a, RuleEntry as b, Position as c, Rule as d, RuleContext as f, YamlKind as g, SyntaxNode as h, InputKind as i, Project as l, Source as m, Fu4Config as n, ParseError as o, ScriptLanguage as p, INPUT_KINDS as r, Plugin as s, Diagnostic as t, Report as u, YamlStyle as v, RuleOptions as x, PathspecRequest as y };
114
+ //# sourceMappingURL=index-DFaQsB5x.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,5 +1,8 @@
1
- import { _ as YamlNode, a as Override, b as RuleOptions, c as Position, d as Rule, f as RuleContext, g as YamlKind, h as SyntaxNode, i as InputKind, l as Project, m as Source, n as Fu4Config, o as ParseError, p as ScriptLanguage, r as INPUT_KINDS, s as Plugin, t as Diagnostic, u as Report, v as YamlStyle, x as Severity, y as RuleEntry } from "./index-BBTwA_Cz.mjs";
1
+ import { S as Severity, _ as YamlNode, a as Override, b as RuleEntry, c as Position, d as Rule, f as RuleContext, g as YamlKind, h as SyntaxNode, i as InputKind, l as Project, m as Source, n as Fu4Config, o as ParseError, p as ScriptLanguage, r as INPUT_KINDS, s as Plugin, t as Diagnostic, u as Report, v as YamlStyle, x as RuleOptions, y as PathspecRequest } from "./index-DFaQsB5x.mjs";
2
2
  import { Effect, Schema } from "effect";
3
+ interface Ignoring {
4
+ readonly ignores?: readonly string[] | undefined;
5
+ }
3
6
  export declare const format: (diagnostic: Diagnostic) => string;
4
7
  declare const Fu4Error_base: Schema.Class<Fu4Error, Schema.TaggedStruct<"Fu4Error", {
5
8
  readonly message: Schema.String;
@@ -21,12 +24,12 @@ interface LintTextInput {
21
24
  }
22
25
  export declare const lint: (input: LintInput) => Effect.Effect<readonly Diagnostic[], Fu4Error, never>;
23
26
  export declare const lintText: (input: LintTextInput) => Effect.Effect<readonly Diagnostic[], Fu4Error, never>;
27
+ type PathspecInput = PathspecRequest<Fu4Config>;
24
28
  export declare const fu4Section: (config: unknown) => Fu4Config;
25
- interface PathspecInput {
26
- readonly config: Fu4Config;
29
+ export declare const workflowPathspecs: ({ config, patterns }: {
30
+ readonly config: Ignoring;
27
31
  readonly patterns?: readonly string[];
28
- }
29
- export declare const workflowPathspecs: ({ config, patterns }: PathspecInput) => readonly string[];
32
+ }) => readonly string[];
30
33
  export declare const defineRule: (rule: Rule) => Rule;
31
34
  export declare const definePlugin: (plugin: Plugin) => Plugin;
32
35
  export { type Diagnostic, type Fu4Config, INPUT_KINDS, type InputKind, type LintInput, type LintTextInput, type Override, type ParseError, type PathspecInput, type Plugin, type Position, type Project, type Report, type Rule, type RuleContext, type RuleEntry, type RuleOptions, type ScriptLanguage, type Severity, type Source, type SyntaxNode, type YamlKind, type YamlNode, type YamlStyle };
package/dist/index.mjs CHANGED
@@ -1 +1,3 @@
1
- export { o as Fu4Error, t as INPUT_KINDS, c as definePlugin, l as defineRule, d as format, n as fu4Section, i as lint, a as lintText, r as workflowPathspecs } from "./app-DheTFmZd.mjs";
1
+ import { a as Fu4Error, c as format, i as lintText, n as workflowPathspecs, r as lint, t as fu4Section } from "./app-KgCbMsJa.mjs";
2
+ import { o as definePlugin, s as defineRule, t as INPUT_KINDS } from "./types-CsheTVso.mjs";
3
+ export { Fu4Error, INPUT_KINDS, definePlugin, defineRule, format, fu4Section, lint, lintText, workflowPathspecs };