@r_masseater/fu4 0.1.0 → 0.2.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-DheTFmZd.mjs","names":["taggedError","Rec","Str","Arr","DATA_FIRST_ARITY","Arr","Fn","Str","nodeServices","present","Fn","Bool","byPosition","Arr","Rec","WORD","EMPTY","Arr","SEPARATOR","Str","Arr","Rec","WORKFLOWS","Str","Arr","Arr","Str","Arr","CONCURRENT","Arr","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","../src/entities/rule/model/define.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","../src/shared/config/types.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 } from \"effect\";\n\nconst WORD = 4;\nconst EMPTY = 0;\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","import type { Plugin, Rule } from \"#/shared/config/index.ts\";\n\nexport const defineRule = (rule: Rule): Rule => rule;\n\nexport const definePlugin = (plugin: Plugin): Plugin => plugin;\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 { Array as Arr, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport { minimatch } from \"minimatch\";\n\nimport type {\n Fu4Config,\n Override,\n Rule,\n RuleEntry,\n RuleOptions,\n Severity,\n} from \"#/shared/config/index.ts\";\n\nconst NEGATION = \"!\";\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 matches =\n (path: string) =>\n (pattern: string): boolean =>\n minimatch(path, pattern, { dot: true });\n\nconst negated = Str.startsWith(NEGATION);\n\nconst applies =\n (path: string) =>\n (override: Override): boolean =>\n pipe(\n override.files,\n Arr.filter((pattern) => !negated(pattern)),\n Arr.some(matches(path)),\n ) &&\n !pipe(\n override.files,\n Arr.filter(negated),\n Arr.map(Str.slice(NEGATION.length)),\n Arr.some(matches(path)),\n );\n\nexport const isIgnored =\n (config: Fu4Config) =>\n (path: string): boolean =>\n pipe(config.ignores ?? [], Arr.some(matches(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 { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { InputKind } from \"#/shared/config/index.ts\";\n\nconst SEPARATOR = \"/\";\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\nconst baseName = (path: string): string =>\n pipe(\n Str.split(SEPARATOR)(path),\n Arr.last,\n Option.getOrElse(() => path),\n );\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 { aligned, wordAt } from \"@masseater.dev/lint-host\";\nimport { Option } from \"effect\";\n\nconst WORD = 4;\nconst EMPTY = 0;\nconst NEXT = 1;\nconst STRING_WORDS = 2;\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 = new TextDecoder(\"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 semanticCount = wordAt(header)(HEADER.semanticCount);\n const concreteCount = wordAt(header)(HEADER.concreteCount);\n const errorCount = wordAt(header)(HEADER.errorCount);\n const semanticAt = HEADER_WORDS;\n const concreteAt = semanticAt + semanticCount * SEMANTIC_WORDS;\n const childAt = concreteAt + concreteCount * CONCRETE_WORDS;\n const errorAt = childAt + wordAt(header)(HEADER.childCount);\n const spanAt = errorAt + errorCount * ERROR_WORDS;\n const blobAt = (spanAt + wordAt(header)(HEADER.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\nconst stringsOf = (\n words: Uint32Array,\n blob: Uint8Array,\n spanAt: number,\n): ((index: number) => string) => {\n const cache = new Map<number, string>();\n const decode = (index: number): string => {\n const offset = wordAt(words)(spanAt + index * STRING_WORDS) * STRING_WORDS;\n const length = wordAt(words)(spanAt + index * STRING_WORDS + NEXT) * STRING_WORDS;\n const value = utf16.decode(blob.subarray(offset, offset + length));\n cache.set(index, value);\n return value;\n };\n return (index) => Option.getOrElse(Option.fromNullishOr(cache.get(index)), () => decode(index));\n};\n\nexport const sourceView = (raw: Uint8Array): SourceView => {\n const buffer = aligned(raw);\n const header = new Uint32Array(buffer.buffer, buffer.byteOffset, HEADER_WORDS);\n const layout = layoutOf(header);\n const words = new Uint32Array(buffer.buffer, buffer.byteOffset, layout.blobAt / WORD);\n const stringAt = stringsOf(words, buffer.subarray(layout.blobAt), layout.spanAt);\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 Effect.fail(failedWith(`fu4 rule ${active.id} failed on ${input.path}`)(cause)),\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 { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport { flattenConfig } from \"#/entities/rule/index.ts\";\nimport type { Fu4Config } from \"#/shared/config/index.ts\";\n\nconst WORKFLOWS = [\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\nconst NOT_OWNED = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\n\nconst hasSection = (value: unknown): value is { readonly fu4: Fu4Config } =>\n Predicate.hasProperty(value, \"fu4\") && Predicate.isObject(value.fu4);\n\nexport const fu4Section = (config: unknown): Fu4Config =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => flattenConfig(value.fu4)),\n Option.getOrElse((): Fu4Config => ({})),\n );\n\nexport interface PathspecInput {\n readonly config: Fu4Config;\n readonly patterns?: readonly string[];\n}\n\nexport const workflowPathspecs = ({\n config,\n patterns = WORKFLOWS,\n}: PathspecInput): readonly string[] => [\n ...patterns,\n ...NOT_OWNED,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n];\n","import type { RuleEntry, RuleOptions, Severity } from \"@masseater.dev/lint-host\";\nimport type { Effect, Option } from \"effect\";\n\nexport type { RuleEntry, RuleOptions, Severity } from \"@masseater.dev/lint-host\";\n\nexport interface Position {\n readonly line: number;\n readonly column: number;\n}\n\nexport type YamlKind = \"scalar\" | \"sequence\" | \"mapping\" | \"alias\";\n\nexport type YamlStyle = \"plain\" | \"single-quoted\" | \"double-quoted\" | \"literal\" | \"folded\";\n\nexport interface YamlNode {\n readonly id: number;\n readonly kind: YamlKind;\n readonly tag: string;\n readonly value: string;\n readonly style: YamlStyle;\n readonly line: number;\n readonly column: number;\n readonly children: readonly YamlNode[];\n}\n\nexport interface SyntaxNode {\n readonly id: number;\n readonly type: string;\n readonly named: boolean;\n readonly isError: boolean;\n readonly isMissing: boolean;\n readonly isExtra: boolean;\n readonly start: number;\n readonly end: number;\n readonly field: string | undefined;\n readonly parent: SyntaxNode | undefined;\n readonly children: readonly SyntaxNode[];\n readonly namedChildren: readonly SyntaxNode[];\n readonly text: string;\n}\n\nexport interface ParseError {\n readonly line: number;\n readonly column: number;\n readonly message: string;\n}\n\nexport interface Source {\n readonly text: string;\n readonly yaml: YamlNode | undefined;\n readonly syntax: SyntaxNode | undefined;\n readonly errors: readonly ParseError[];\n readonly lines: readonly string[];\n readonly positionOf: (offset: number) => Position;\n}\n\nexport const INPUT_KINDS = [\"workflow\", \"action\", \"dependabot\", \"pre-commit\"] as const;\nexport type InputKind = (typeof INPUT_KINDS)[number];\n\nexport type ScriptLanguage = \"bash\" | \"powershell\";\n\nexport interface Report {\n readonly message: string;\n readonly line: number;\n readonly column: number;\n readonly length?: number;\n readonly detail?: string;\n readonly rule?: string;\n}\n\nexport interface Project {\n readonly root: string;\n readonly exists: (path: string) => boolean;\n readonly read: (path: string) => Option.Option<string>;\n readonly parse: (path: string) => Option.Option<Source>;\n}\n\nexport interface RuleContext {\n readonly filename: string;\n readonly kind: InputKind;\n readonly source: Source;\n readonly options: RuleOptions;\n readonly settings: Readonly<Record<string, unknown>>;\n readonly project: Project;\n readonly parseScript: (language: ScriptLanguage, text: string) => Source;\n readonly report: (report: Report) => void;\n}\n\nexport interface Rule {\n readonly meta: {\n readonly description: string;\n readonly kinds?: readonly InputKind[];\n readonly docs?: string;\n };\n readonly check: (context: RuleContext) => void | Effect.Effect<void>;\n}\n\nexport interface Plugin {\n readonly rules: Readonly<Record<string, Rule>>;\n}\n\nexport interface Override {\n readonly files: readonly string[];\n readonly rules: Readonly<Record<string, RuleEntry>>;\n}\n\nexport interface Fu4Config {\n readonly extends?: readonly Fu4Config[];\n readonly plugins?: Readonly<Record<string, Plugin>>;\n readonly rules?: Readonly<Record<string, RuleEntry>>;\n readonly settings?: Readonly<Record<string, unknown>>;\n readonly overrides?: readonly Override[];\n readonly ignores?: readonly string[];\n}\n\nexport interface Diagnostic {\n readonly path: string;\n readonly line: number;\n readonly column: number;\n readonly length?: number;\n readonly rule: string;\n readonly message: string;\n readonly detail?: string;\n readonly severity: Exclude<Severity, \"off\">;\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;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ACnB;EACA,OAAO,YAAY,MAAM,CAAC,CAAC,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;;AClHD,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,YAAY,CAAC,qCAAqC,oCAAoC;AAE5F,MAAM,cAAc,UAClB,UAAU,YAAY,OAAO,KAAK,KAAK,UAAU,SAAS,MAAM,GAAG;AAErE,MAAa,cAAc,WACzB,KACE,OAAO,cAAc,QAAQ,UAAU,GACvC,OAAO,KAAK,UAAU,cAAc,MAAM,GAAG,CAAC,GAC9C,OAAO,iBAA4B,CAAC,EAAE,CACxC;AAOF,MAAa,qBAAqB,EAChC,QACA,WAAW,gBAC2B;CACtC,GAAG;CACH,GAAG;CACH,GAAG,KACD,OAAO,WAAW,CAAC,GACnBC,QAAI,KAAK,SAAS,kBAAkB,MAAM,CAC5C;AACF;;ACaA,MAAa,cAAc;CAAC;CAAY;CAAU;CAAc;AAAY"}
@@ -0,0 +1,15 @@
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";
2
+ // src/app/cli.ts
3
+ const runCli = () => {
4
+ runCli$1({
5
+ name: "fu4",
6
+ section: fu4Section,
7
+ pathspecs: workflowPathspecs,
8
+ lint,
9
+ format,
10
+ failWith: failedWith
11
+ });
12
+ };
13
+ export { runCli };
14
+
15
+ //# sourceMappingURL=cli-Dc3I8PTz.mjs.map
@@ -0,0 +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"}
package/dist/cli.mjs CHANGED
@@ -1,17 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as failedWith, n as workflowPathspecs, o as runCli$1, r as lint, s as format, t as fu4Section } from "./app-D0TgXIa0.mjs";
3
- // src/app/cli.ts
4
- const runCli = () => {
5
- runCli$1({
6
- name: "fu4",
7
- section: fu4Section,
8
- pathspecs: workflowPathspecs,
9
- lint,
10
- format,
11
- failWith: failedWith
12
- });
13
- };
2
+ import { enableCompileCache } from "node:module";
14
3
  // bin/fu4.ts
4
+ enableCompileCache();
5
+ const { runCli } = await import("./cli-Dc3I8PTz.mjs");
15
6
  runCli();
16
7
  export {};
17
8
 
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/app/cli.ts","../bin/fu4.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","#!/usr/bin/env node\nimport { runCli } from \"#/app/cli.ts\";\n\nrunCli();\n"],"mappings":";;;AAOA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACN,SAAS;EACT,WAAW;EACX;EACA;EACA,UAAU;CACZ,CAAC;AACH;;ACbA,OAAO"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../bin/fu4.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\n\nenableCompileCache();\n\nconst { runCli } = await import(\"#/app/cli.ts\");\n\nrunCli();\n"],"mappings":";;;AAGA,mBAAmB;AAEnB,MAAM,EAAE,WAAW,MAAM,OAAO;AAEhC,OAAO"}
@@ -0,0 +1,110 @@
1
+ import { Effect, FileSystem, Option, Path } from "effect";
2
+ type Severity = "off" | "warn" | "error";
3
+ type RuleOptions = Readonly<Record<string, unknown>>;
4
+ type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];
5
+ interface Position {
6
+ readonly line: number;
7
+ readonly column: number;
8
+ }
9
+ type YamlKind = "scalar" | "sequence" | "mapping" | "alias";
10
+ type YamlStyle = "plain" | "single-quoted" | "double-quoted" | "literal" | "folded";
11
+ interface YamlNode {
12
+ readonly id: number;
13
+ readonly kind: YamlKind;
14
+ readonly tag: string;
15
+ readonly value: string;
16
+ readonly style: YamlStyle;
17
+ readonly line: number;
18
+ readonly column: number;
19
+ readonly children: readonly YamlNode[];
20
+ }
21
+ interface SyntaxNode {
22
+ readonly id: number;
23
+ readonly type: string;
24
+ readonly named: boolean;
25
+ readonly isError: boolean;
26
+ readonly isMissing: boolean;
27
+ readonly isExtra: boolean;
28
+ readonly start: number;
29
+ readonly end: number;
30
+ readonly field: string | undefined;
31
+ readonly parent: SyntaxNode | undefined;
32
+ readonly children: readonly SyntaxNode[];
33
+ readonly namedChildren: readonly SyntaxNode[];
34
+ readonly text: string;
35
+ }
36
+ interface ParseError {
37
+ readonly line: number;
38
+ readonly column: number;
39
+ readonly message: string;
40
+ }
41
+ interface Source {
42
+ readonly text: string;
43
+ readonly yaml: YamlNode | undefined;
44
+ readonly syntax: SyntaxNode | undefined;
45
+ readonly errors: readonly ParseError[];
46
+ readonly lines: readonly string[];
47
+ readonly positionOf: (offset: number) => Position;
48
+ }
49
+ declare const INPUT_KINDS: readonly ["workflow", "action", "dependabot", "pre-commit"];
50
+ type InputKind = (typeof INPUT_KINDS)[number];
51
+ type ScriptLanguage = "bash" | "powershell";
52
+ interface Report {
53
+ readonly message: string;
54
+ readonly line: number;
55
+ readonly column: number;
56
+ readonly length?: number;
57
+ readonly detail?: string;
58
+ readonly rule?: string;
59
+ }
60
+ interface Project {
61
+ readonly root: string;
62
+ readonly exists: (path: string) => boolean;
63
+ readonly read: (path: string) => Option.Option<string>;
64
+ readonly parse: (path: string) => Option.Option<Source>;
65
+ }
66
+ interface RuleContext {
67
+ readonly filename: string;
68
+ readonly kind: InputKind;
69
+ readonly source: Source;
70
+ readonly options: RuleOptions;
71
+ readonly settings: Readonly<Record<string, unknown>>;
72
+ readonly project: Project;
73
+ readonly parseScript: (language: ScriptLanguage, text: string) => Source;
74
+ readonly report: (report: Report) => void;
75
+ }
76
+ interface Rule {
77
+ readonly meta: {
78
+ readonly description: string;
79
+ readonly kinds?: readonly InputKind[];
80
+ readonly docs?: string;
81
+ };
82
+ readonly check: (context: RuleContext) => void | Effect.Effect<void>;
83
+ }
84
+ interface Plugin {
85
+ readonly rules: Readonly<Record<string, Rule>>;
86
+ }
87
+ interface Override {
88
+ readonly files: readonly string[];
89
+ readonly rules: Readonly<Record<string, RuleEntry>>;
90
+ }
91
+ interface Fu4Config {
92
+ readonly extends?: readonly Fu4Config[];
93
+ readonly plugins?: Readonly<Record<string, Plugin>>;
94
+ readonly rules?: Readonly<Record<string, RuleEntry>>;
95
+ readonly settings?: Readonly<Record<string, unknown>>;
96
+ readonly overrides?: readonly Override[];
97
+ readonly ignores?: readonly string[];
98
+ }
99
+ interface Diagnostic {
100
+ readonly path: string;
101
+ readonly line: number;
102
+ readonly column: number;
103
+ readonly length?: number;
104
+ readonly rule: string;
105
+ readonly message: string;
106
+ readonly detail?: string;
107
+ readonly severity: Exclude<Severity, "off">;
108
+ }
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
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as PathConfig, c as Severity, i as Fu4Config, n as Confidence, o as Persona, r as Diagnostic, s as SelfHostedRunner, t as AuditConfig } from "./types-DywsX0Gn.mjs";
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";
2
2
  import { Effect, Schema } from "effect";
3
3
  export declare const format: (diagnostic: Diagnostic) => string;
4
4
  declare const Fu4Error_base: Schema.Class<Fu4Error, Schema.TaggedStruct<"Fu4Error", {
@@ -12,12 +12,22 @@ interface LintInput {
12
12
  readonly files: readonly string[];
13
13
  readonly config?: Fu4Config;
14
14
  }
15
- export declare const lint: (input: LintInput) => Effect.Effect<Diagnostic[], Fu4Error, never>;
15
+ interface LintTextInput {
16
+ readonly root: string;
17
+ readonly path: string;
18
+ readonly text: string;
19
+ readonly kind?: InputKind;
20
+ readonly config?: Fu4Config;
21
+ }
22
+ export declare const lint: (input: LintInput) => Effect.Effect<readonly Diagnostic[], Fu4Error, never>;
23
+ export declare const lintText: (input: LintTextInput) => Effect.Effect<readonly Diagnostic[], Fu4Error, never>;
16
24
  export declare const fu4Section: (config: unknown) => Fu4Config;
17
25
  interface PathspecInput {
18
26
  readonly config: Fu4Config;
19
27
  readonly patterns?: readonly string[];
20
28
  }
21
29
  export declare const workflowPathspecs: ({ config, patterns }: PathspecInput) => readonly string[];
22
- export type { AuditConfig, Confidence, Diagnostic, Fu4Config, LintInput, PathConfig, PathspecInput, Persona, SelfHostedRunner, Severity };
30
+ export declare const defineRule: (rule: Rule) => Rule;
31
+ export declare const definePlugin: (plugin: Plugin) => Plugin;
32
+ 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 };
23
33
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { i as Fu4Error, s as format, t as fu4Section, r as lint, n as workflowPathspecs } from "./app-D0TgXIa0.mjs";
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";
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as Fu4Config } from "./types-DywsX0Gn.mjs";
1
+ import { n as Fu4Config } from "./index-BBTwA_Cz.mjs";
2
2
  declare module "vite" {
3
3
  interface UserConfig {
4
4
  readonly fu4?: Fu4Config;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@r_masseater/fu4",
3
- "version": "0.1.0",
4
- "description": "A GitHub Actions workflow linter written in Rust that matches actionlint's checks, configured from vite.config.ts.",
3
+ "version": "0.2.0",
4
+ "description": "The engine of a GitHub Actions linter: Rust parses workflows and TypeScript rules from @r_masseater/fu4-presets check them, configured from vite.config.ts.",
5
5
  "keywords": [
6
6
  "actionlint",
7
7
  "github-actions",
@@ -48,24 +48,14 @@
48
48
  "provenance": true
49
49
  },
50
50
  "dependencies": {
51
- "@effect/platform-node": "4.1.4"
51
+ "@effect/platform-node": "^4.1.4",
52
+ "minimatch": "^11.0.9"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@masseater.dev/lint-host": "0.0.0",
55
- "@r_masseater/vitest-otlp": "0.2.0",
56
- "@types/hast": "3.0.5",
57
- "@types/mdast": "4.0.4",
56
+ "@r_masseater/vitest-otlp": "0.2.1",
58
57
  "@types/node": "26.6.6",
59
58
  "effect": "4.1.4",
60
- "hast-util-from-html": "^2.1.0",
61
- "hast-util-select": "^6.0.4",
62
- "hast-util-to-string": "^3.0.1",
63
- "liquidjs": "^10.30.1",
64
- "mdast-util-to-string": "4.0.0",
65
- "remark-gfm": "4.0.1",
66
- "remark-parse": "11.0.0",
67
- "unified": "11.0.5",
68
- "unist-util-visit": "^5.2.0",
69
59
  "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
70
60
  "vite-plus": "1.7.0",
71
61
  "yaml": "2.9.1"
@@ -76,7 +66,7 @@
76
66
  "vite-plus": ">=1.5.0"
77
67
  },
78
68
  "engines": {
79
- "node": ">=26"
69
+ "node": "v26.13.1"
80
70
  },
81
71
  "native": {
82
72
  "binary": "fu4",
@@ -86,8 +76,8 @@
86
76
  ]
87
77
  },
88
78
  "optionalDependencies": {
89
- "@r_masseater/fu4-linux-x64-gnu": "0.1.0",
90
- "@r_masseater/fu4-win32-x64-msvc": "0.1.0"
79
+ "@r_masseater/fu4-linux-x64-gnu": "0.2.0",
80
+ "@r_masseater/fu4-win32-x64-msvc": "0.2.0"
91
81
  },
92
82
  "scripts": {}
93
83
  }
@@ -2,9 +2,8 @@
2
2
  name: lint-workflows
3
3
  description: >
4
4
  Use when setting up @r_masseater/fu4 in vite.config.ts, running it on GitHub Actions
5
- workflows, actions or Dependabot configs, or fixing what it reports. Covers self-hosted
6
- runner labels, configuration variables, per-path ignores, excluded workflows, zizmor's
7
- security audits, and the CLI.
5
+ workflows, actions, Dependabot or pre-commit configs, or writing a rule or plugin for it.
6
+ Covers extends, rules, settings, overrides, ignores, the CLI and the rule API.
8
7
  metadata:
9
8
  type: core
10
9
  library: "@r_masseater/fu4"
@@ -16,67 +15,57 @@ sources:
16
15
 
17
16
  # lint-workflows
18
17
 
19
- fu4 is a GitHub Actions workflow linter written in Rust. It reports what actionlint reports,
20
- with the same messages and positions, except for actionlint's pyflakes check. It checks `run:`
21
- scripts with its own subset of shellcheck's checks, so shellcheck does not need to be installed.
22
- It also runs zizmor's security audits on workflows, `action.yml` files, the Dependabot config
23
- and pre-commit configs, so zizmor does not need to be installed either.
18
+ fu4 is the engine of a GitHub Actions linter. Rust parses each file once; TypeScript rules read
19
+ the parsed trees without copying them. fu4 has no rules of its own, so a config without plugins
20
+ reports nothing. The official rules are in `@r_masseater/fu4-presets`, which ships its own skill for choosing
21
+ them and fixing what they report.
24
22
 
25
23
  ## Setup
26
24
 
27
25
  ```sh
28
- vp add -D @r_masseater/fu4
26
+ vp add -D @r_masseater/fu4 @r_masseater/fu4-presets
29
27
  ```
30
28
 
31
29
  ```ts
32
30
  import "@r_masseater/fu4/vite";
31
+ import { recommended } from "@r_masseater/fu4-presets";
33
32
  import { defineConfig } from "vite-plus";
34
33
 
35
34
  export default defineConfig({
36
35
  fu4: {
37
- selfHostedRunner: { labels: ["gpu"] },
38
- configVariables: ["DEPLOY_TARGET"],
39
- paths: {
40
- ".github/workflows/release.yml": { ignore: ['^input "token" is not defined'] },
41
- },
42
- ignores: [".github/workflows/vendored-*.yml"],
43
- audit: {
44
- persona: "regular",
45
- minSeverity: "low",
46
- rules: { "template-injection": { disable: true } },
47
- },
36
+ extends: [recommended()],
37
+ rules: { "zizmor/stale-action-refs": "warn" },
38
+ overrides: [
39
+ { files: [".github/workflows/vendored-*.yml"], rules: { "actionlint/shellcheck": "off" } },
40
+ ],
41
+ ignores: [".github/workflows/generated-*.yml"],
48
42
  },
49
43
  });
50
44
  ```
51
45
 
52
- - `selfHostedRunner.labels` lists the labels of your own runners, so `runs-on` accepts them.
53
- - `configVariables` lists the names `vars.*` may use. Leave it out to accept any name; an
54
- empty list rejects every name.
55
- - `paths` maps a glob of workflow paths to regular expressions. A diagnostic in a matching
56
- workflow is dropped when its message matches one of them.
57
- - `ignores` lists globs of workflows the CLI does not lint.
58
- - `audit.rules` is the `rules` section of a zizmor config: `disable`, `ignore`,
59
- `severity` and each audit's `config`.
60
- - `audit.persona` is `regular` (the default), `pedantic` or `auditor`; the latter two add
61
- findings zizmor hides by default. `audit.minSeverity` and `audit.minConfidence` drop findings
62
- below a level.
63
- - Audits that query GitHub (impostor commits, ref confusion, known vulnerable actions and
64
- others) run when `GH_TOKEN` is set. `audit.online: false` skips them, and `audit.githubHost`
65
- points them at GitHub Enterprise.
46
+ - `extends` lists configs to start from. The config's own keys come after them and win.
47
+ - `rules` sets a rule to `"error"`, `"warn"` or `"off"`, or to `[severity, options]`.
48
+ - `settings` holds values every rule can read, keyed by plugin name.
49
+ - `overrides` gives `files` globs their own `rules`.
50
+ - `ignores` lists globs of files the CLI does not lint.
66
51
 
67
52
  ## Running
68
53
 
69
54
  Run `fu4` in the repository root. It lints the workflows git tracks or would add under
70
- `.github/workflows`, prints `path:line:column: message [rule]`, and exits with 1 when it reports
71
- anything. It also audits `action.yml` files anywhere in the repository, `.github/dependabot.yml`
72
- and the pre-commit configs at the root. Pass pathspecs to lint other files:
73
- `fu4 'ci/**/*.yml'`.
55
+ `.github/workflows`, the `action.yml` files, `.github/dependabot.yml` and the pre-commit configs at
56
+ the root, prints `path:line:column: message [rule]`, and exits with 1 when it reports anything.
57
+ Pass pathspecs to lint other files: `fu4 'ci/**/*.yml'`. From code, `lint({ root, files, config })`
58
+ returns the diagnostics as an Effect.
74
59
 
75
- From code, `lint({ root, files, config })` returns the diagnostics as an Effect.
60
+ ## Writing rules
76
61
 
77
- ## Fixing reports
62
+ Define a rule with `defineRule({ meta, check })` and register it in a plugin with
63
+ `definePlugin({ rules })`. Put the plugin under `plugins` and turn its rules on in `rules`.
78
64
 
79
- The rule name in brackets is actionlint's or zizmor's. An audit's message ends with a link to
80
- zizmor's documentation for it; for other rules, read actionlint's documentation for that
81
- check to see why it fires. A zizmor `# zizmor: ignore[rule]` comment on the line also works. Fix the workflow; use `paths` only for a finding you have decided to accept,
82
- and keep the regular expression narrow.
65
+ - `meta.kinds` lists the inputs the rule reads: `workflow` (the default), `action`, `dependabot`
66
+ or `pre-commit`.
67
+ - `check(context)` reads `context.source` (the YAML tree, the tree-sitter tree and the lines),
68
+ `context.options`, `context.settings` and `context.project`, which reads other files of the
69
+ repository. It may return an Effect.
70
+ - `context.parseScript(language, text)` parses a `run:` script as `bash` or `powershell`.
71
+ - `context.report({ message, line, column })` reports a finding.