@r_masseater/fu4 0.0.0-stage → 0.1.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/LICENSE +87 -0
- package/README.md +49 -2
- package/dist/app-D0TgXIa0.mjs +211 -0
- package/dist/app-D0TgXIa0.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +18 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.mjs +1 -0
- package/dist/types-DywsX0Gn.d.mts +34 -0
- package/dist/vite.d.mts +7 -0
- package/dist/vite.mjs +1 -0
- package/logo.svg +9 -0
- package/package.json +90 -3
- package/skills/lint-workflows/SKILL.md +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 masseater
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
@tanstack/eslint-plugin-start
|
|
26
|
+
|
|
27
|
+
MIT License
|
|
28
|
+
|
|
29
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
33
|
+
in the Software without restriction, including without limitation the rights
|
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
36
|
+
furnished to do so, subject to the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be included in all
|
|
39
|
+
copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
47
|
+
SOFTWARE.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
@typescript-eslint/utils
|
|
52
|
+
|
|
53
|
+
MIT License
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2019 typescript-eslint and other contributors
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
in the Software without restriction, including without limitation the rights
|
|
60
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
furnished to do so, subject to the following conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be included in all
|
|
65
|
+
copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
+
SOFTWARE.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
globals
|
|
78
|
+
|
|
79
|
+
MIT License
|
|
80
|
+
|
|
81
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @r_masseater/fu4
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A GitHub Actions workflow linter written in Rust and configured from `vite.config.ts`.
|
|
6
|
+
|
|
7
|
+
It reports what [actionlint](https://github.com/rhysd/actionlint) reports, with the same
|
|
8
|
+
messages and positions, except for its pyflakes integration. Instead of running shellcheck,
|
|
9
|
+
it checks `run:` scripts itself with tree-sitter-bash for the most common shellcheck findings.
|
|
10
|
+
It also accepts the `$/` self repository reference in `uses:`, which actionlint 1.7.12 rejects.
|
|
11
|
+
Its knowledge of
|
|
12
|
+
contexts, events, permissions, runners and popular actions is generated from GitHub's docs and
|
|
13
|
+
schemas.
|
|
14
|
+
|
|
15
|
+
It also runs [zizmor](https://github.com/zizmorcore/zizmor)'s security audits on workflows,
|
|
16
|
+
actions, Dependabot configs and pre-commit configs, with zizmor's findings and positions, built
|
|
17
|
+
on zizmor's published crates. Audits that query GitHub run when `GH_TOKEN` is set. zizmor's
|
|
18
|
+
auto-fixes are not included.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import "@r_masseater/fu4/vite";
|
|
22
|
+
import { defineConfig } from "vite-plus";
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
fu4: {
|
|
26
|
+
selfHostedRunner: { labels: ["gpu"] },
|
|
27
|
+
configVariables: ["DEPLOY_TARGET"],
|
|
28
|
+
paths: {
|
|
29
|
+
".github/workflows/release.yml": { ignore: ['^input "token" is not defined'] },
|
|
30
|
+
},
|
|
31
|
+
ignores: [".github/workflows/vendored-*.yml"],
|
|
32
|
+
audit: {
|
|
33
|
+
persona: "regular",
|
|
34
|
+
minSeverity: "low",
|
|
35
|
+
rules: { "unpinned-uses": { config: { policies: { "actions/*": "ref-pin" } } } },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`audit.rules` takes the `rules` section of a zizmor config. Set `audit.online` to `false` to
|
|
42
|
+
skip the audits that query GitHub.
|
|
43
|
+
|
|
44
|
+
Run `fu4` to lint the workflows under `.github/workflows`, the `action.yml` files, the
|
|
45
|
+
Dependabot config and the pre-commit configs, or pass pathspecs to lint others.
|
|
46
|
+
Call `lint` to lint from code.
|
|
47
|
+
|
|
48
|
+
## Agent skills
|
|
49
|
+
|
|
50
|
+
The package ships TanStack Intent skills for coding agents. Load one with `vp exec intent load @r_masseater/fu4#<skill>`.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { Array, Boolean, Config, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, Redacted, Schema, String as String$1, pipe } from "effect";
|
|
3
|
+
import { NodeServices } from "@effect/platform-node";
|
|
4
|
+
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
5
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
+
import { FetchHttpClient } from "effect/http";
|
|
7
|
+
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
8
|
+
import { resolveConfigFromFile } from "vite-plus";
|
|
9
|
+
// src/app/format.ts
|
|
10
|
+
const format = (diagnostic) => `${diagnostic.path}:${String(diagnostic.line)}:${String(diagnostic.column)}: ${diagnostic.message} [${diagnostic.rule}]`;
|
|
11
|
+
// ../lint-host/src/shared/lib/target.ts
|
|
12
|
+
const abiOf = (platform) => Match.value(platform).pipe(Match.when("linux", () => "-gnu"), Match.when("win32", () => "-msvc"), Match.orElse(() => ""));
|
|
13
|
+
const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;
|
|
14
|
+
const addonFileOf = (binary) => `${binary}.${platformTarget}.node`;
|
|
15
|
+
// ../lint-host/src/features/build-addon/model/build.ts
|
|
16
|
+
const taggedError$1 = Schema.TaggedError;
|
|
17
|
+
var AddonBuildFailed = class extends taggedError$1()("AddonBuildFailed", { message: Schema.String }) {};
|
|
18
|
+
const LIBRARY = {
|
|
19
|
+
linux: (name) => `lib${name}.so`,
|
|
20
|
+
darwin: (name) => `lib${name}.dylib`,
|
|
21
|
+
win32: (name) => `${name}.dll`
|
|
22
|
+
};
|
|
23
|
+
const SUCCESS = 0;
|
|
24
|
+
const cargo = Effect.fn("cargo")(function* cargo(crate, workspace) {
|
|
25
|
+
const exitCode = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make("cargo", [
|
|
26
|
+
"build",
|
|
27
|
+
"--release",
|
|
28
|
+
"--locked",
|
|
29
|
+
"-p",
|
|
30
|
+
crate
|
|
31
|
+
], {
|
|
32
|
+
cwd: workspace,
|
|
33
|
+
stdout: "inherit",
|
|
34
|
+
stderr: "inherit"
|
|
35
|
+
}));
|
|
36
|
+
const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });
|
|
37
|
+
yield* Effect.when(Effect.fail(failure), Effect.sync(() => Number(exitCode) !== SUCCESS));
|
|
38
|
+
});
|
|
39
|
+
Effect.fn("buildAddon")(function* build(options) {
|
|
40
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
41
|
+
const path = yield* Path.Path;
|
|
42
|
+
const library = yield* Effect.fromOption(Record.get(LIBRARY, process.platform)).pipe(Effect.mapError(() => AddonBuildFailed.make({ message: `no native build for ${process.platform}` })));
|
|
43
|
+
yield* cargo(options.crate, options.workspaceDir);
|
|
44
|
+
const output = path.join(options.packageDir, "native");
|
|
45
|
+
yield* fileSystem.makeDirectory(output, { recursive: true });
|
|
46
|
+
const built = library(String$1.replaceAll("-", "_")(options.crate));
|
|
47
|
+
yield* fileSystem.copyFile(path.join(options.workspaceDir, "target", "release", built), path.join(output, addonFileOf(options.binary)));
|
|
48
|
+
});
|
|
49
|
+
// ../lint-host/src/features/load-addon/model/load.ts
|
|
50
|
+
const loadAddon = ({ packageName, binary, from, isAddon, failWith }) => {
|
|
51
|
+
const requireFrom = createRequire(from);
|
|
52
|
+
const loadFrom = (specifier) => Effect.try({
|
|
53
|
+
try: () => requireFrom(specifier),
|
|
54
|
+
catch: failWith(`could not load ${specifier}`)
|
|
55
|
+
});
|
|
56
|
+
return loadFrom(`${packageName}-${platformTarget}`).pipe(Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)), Effect.filterOrFail(isAddon, (found) => failWith(`no ${binary} addon for ${platformTarget}`)(found)));
|
|
57
|
+
};
|
|
58
|
+
const callAddon = ({ addon, name, files, call, failWith }) => addon.pipe(Effect.flatMap((loaded) => Effect.try({
|
|
59
|
+
try: () => call(loaded),
|
|
60
|
+
catch: failWith(`${name} could not lint`)
|
|
61
|
+
}).pipe(Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())))), Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }));
|
|
62
|
+
// ../lint-host/src/features/run-cli/model/cli.ts
|
|
63
|
+
const CONFIG_FILES = [
|
|
64
|
+
"vite.config.ts",
|
|
65
|
+
"vite.config.mts",
|
|
66
|
+
"vite.config.js",
|
|
67
|
+
"vite.config.mjs"
|
|
68
|
+
];
|
|
69
|
+
const FAILED = 1;
|
|
70
|
+
const ARGUMENTS_START = 2;
|
|
71
|
+
const configOf = (cli, root) => Effect.gen(function* readConfig() {
|
|
72
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
73
|
+
const path = yield* Path.Path;
|
|
74
|
+
const found = yield* pipe(CONFIG_FILES, Array.map((name) => path.join(root, name)), Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))));
|
|
75
|
+
const loaded = yield* Option.match(Array.head(found), {
|
|
76
|
+
onNone: () => Effect.succeed({}),
|
|
77
|
+
onSome: (file) => Effect.tryPromise({
|
|
78
|
+
try: () => resolveConfigFromFile(file),
|
|
79
|
+
catch: cli.failWith(`could not load ${file}`)
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
return cli.section(loaded);
|
|
83
|
+
}).pipe(Effect.withSpan(`${cli.name}.config`));
|
|
84
|
+
const trackedFiles = (root, pathspecs) => Effect.gen(function* listFiles() {
|
|
85
|
+
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
86
|
+
"ls-files",
|
|
87
|
+
"-co",
|
|
88
|
+
"--exclude-standard",
|
|
89
|
+
"-z",
|
|
90
|
+
"--",
|
|
91
|
+
...pathspecs
|
|
92
|
+
], { cwd: root }));
|
|
93
|
+
return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
|
|
94
|
+
});
|
|
95
|
+
const requestOf = (config, patterns) => Array.match(patterns, {
|
|
96
|
+
onEmpty: () => ({ config }),
|
|
97
|
+
onNonEmpty: (given) => ({
|
|
98
|
+
config,
|
|
99
|
+
patterns: given
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
const hasError = (found) => pipe(found, Array.some(({ severity }) => severity === "error"));
|
|
103
|
+
const mainOf = (cli) => Effect.gen(function* main() {
|
|
104
|
+
const root = process.cwd();
|
|
105
|
+
const config = yield* configOf(cli, root);
|
|
106
|
+
const patterns = process.argv.slice(ARGUMENTS_START);
|
|
107
|
+
const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(Effect.withSpan(`${cli.name}.files`));
|
|
108
|
+
const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));
|
|
109
|
+
const found = yield* cli.lint({
|
|
110
|
+
root,
|
|
111
|
+
files,
|
|
112
|
+
projectFiles,
|
|
113
|
+
config
|
|
114
|
+
});
|
|
115
|
+
yield* Array.match(found, {
|
|
116
|
+
onEmpty: () => Effect.void,
|
|
117
|
+
onNonEmpty: (all) => Console.log(pipe(all, Array.map(cli.format), Array.join("\n")))
|
|
118
|
+
});
|
|
119
|
+
yield* Effect.when(Effect.sync(() => {
|
|
120
|
+
process.exitCode = FAILED;
|
|
121
|
+
}), Effect.sync(() => hasError(found)));
|
|
122
|
+
});
|
|
123
|
+
const runCli = (cli) => {
|
|
124
|
+
const services = Otlp.layerFromConfig({ resource: { serviceName: cli.name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(NodeServices.layer));
|
|
125
|
+
runMain(mainOf(cli).pipe(Effect.provide(services)));
|
|
126
|
+
};
|
|
127
|
+
const present = Function.dual(2, (value, build) => Option.match(value, {
|
|
128
|
+
onNone: () => ({}),
|
|
129
|
+
onSome: build
|
|
130
|
+
}));
|
|
131
|
+
// ../lint-host/src/shared/lib/trace.ts
|
|
132
|
+
const SAMPLED = "01";
|
|
133
|
+
const NOT_SAMPLED = "00";
|
|
134
|
+
const flagsOf = (sampled) => Boolean.match(sampled, {
|
|
135
|
+
onFalse: () => NOT_SAMPLED,
|
|
136
|
+
onTrue: () => SAMPLED
|
|
137
|
+
});
|
|
138
|
+
const traceparent = Effect.currentSpan.pipe(Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`), Effect.option);
|
|
139
|
+
const byPosition = Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.mapInput(Order.Number, (found) => found.line));
|
|
140
|
+
const sortByPosition = (found) => Array.sort(found, byPosition);
|
|
141
|
+
// src/shared/lib/errors.ts
|
|
142
|
+
const taggedError = Schema.TaggedError;
|
|
143
|
+
var Fu4Error = class extends taggedError()("Fu4Error", { message: Schema.String }) {};
|
|
144
|
+
const failedWith = (message) => (cause) => Fu4Error.make({ message: `${message}: ${String(cause)}` });
|
|
145
|
+
// src/shared/native/index.ts
|
|
146
|
+
const isNative = (value) => Predicate.hasProperty(value, "lintPaths") && Predicate.isFunction(value.lintPaths) && Predicate.hasProperty(value, "flushTelemetry") && Predicate.isFunction(value.flushTelemetry);
|
|
147
|
+
const native = loadAddon({
|
|
148
|
+
packageName: "@r_masseater/fu4",
|
|
149
|
+
binary: "fu4",
|
|
150
|
+
from: import.meta.url,
|
|
151
|
+
isAddon: isNative,
|
|
152
|
+
failWith: failedWith
|
|
153
|
+
});
|
|
154
|
+
// src/app/lint.ts
|
|
155
|
+
const diagnosticsOf = (result) => pipe(result.diagnostics, Array.map((diagnostic) => ({
|
|
156
|
+
path: result.path,
|
|
157
|
+
line: diagnostic.line,
|
|
158
|
+
column: diagnostic.column,
|
|
159
|
+
rule: diagnostic.kind,
|
|
160
|
+
message: diagnostic.message,
|
|
161
|
+
severity: "error"
|
|
162
|
+
})));
|
|
163
|
+
const githubToken = Config.option(Config.Redacted("GH_TOKEN")).pipe(Effect.map(Option.filter((token) => Redacted.value(token) !== "")), Effect.orDie);
|
|
164
|
+
const auditOptions = Effect.fn("fu4.auditOptions")(function* auditOptions(config = {}) {
|
|
165
|
+
const { online = true, ...rest } = config;
|
|
166
|
+
if (!online) return rest;
|
|
167
|
+
const token = yield* githubToken;
|
|
168
|
+
return {
|
|
169
|
+
...rest,
|
|
170
|
+
...present(token, (value) => ({ githubToken: Redacted.value(value) }))
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
const lint = Effect.fn("fu4.lint")(function* lint(input) {
|
|
174
|
+
const parent = yield* traceparent;
|
|
175
|
+
const config = input.config ?? {};
|
|
176
|
+
const options = {
|
|
177
|
+
config,
|
|
178
|
+
audit: yield* auditOptions(config.audit),
|
|
179
|
+
...present(parent, (value) => ({ traceparent: value }))
|
|
180
|
+
};
|
|
181
|
+
const results = yield* callAddon({
|
|
182
|
+
addon: native,
|
|
183
|
+
name: "fu4",
|
|
184
|
+
files: input.files.length,
|
|
185
|
+
call: (addon) => addon.lintPaths(input.root, input.files, options),
|
|
186
|
+
failWith: failedWith
|
|
187
|
+
});
|
|
188
|
+
return sortByPosition(pipe(results, Array.flatMap(diagnosticsOf)));
|
|
189
|
+
});
|
|
190
|
+
// src/app/section.ts
|
|
191
|
+
const WORKFLOWS = [
|
|
192
|
+
".github/workflows/*.yml",
|
|
193
|
+
".github/workflows/*.yaml",
|
|
194
|
+
":(glob)**/action.yml",
|
|
195
|
+
":(glob)**/action.yaml",
|
|
196
|
+
".github/dependabot.yml",
|
|
197
|
+
".github/dependabot.yaml",
|
|
198
|
+
".pre-commit-config.yaml",
|
|
199
|
+
".pre-commit-hooks.yaml"
|
|
200
|
+
];
|
|
201
|
+
const NOT_OWNED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
202
|
+
const hasSection = (value) => Predicate.hasProperty(value, "fu4") && Predicate.isObject(value.fu4);
|
|
203
|
+
const fu4Section = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => value.fu4), Option.getOrElse(() => ({})));
|
|
204
|
+
const workflowPathspecs = ({ config, patterns = WORKFLOWS }) => [
|
|
205
|
+
...patterns,
|
|
206
|
+
...NOT_OWNED,
|
|
207
|
+
...pipe(config.ignores ?? [], Array.map((glob) => `:(glob,exclude)${glob}`))
|
|
208
|
+
];
|
|
209
|
+
export { failedWith as a, Fu4Error as i, workflowPathspecs as n, runCli as o, lint as r, format as s, fu4Section as t };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=app-D0TgXIa0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-D0TgXIa0.mjs","names":["taggedError","Rec","Str","Arr","Str","Fn","Bool","Arr","Arr","Arr"],"sources":["../src/app/format.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/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/shared/lib/errors.ts","../src/shared/native/index.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 { 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 { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\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.layer)));\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 { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\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 ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n readonly failWith: FailWith<Failure>;\n}\n\nconst configOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, 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: cli.failWith(`could not load ${file}`),\n }),\n });\n return cli.section(loaded);\n }).pipe(Effect.withSpan(`${cli.name}.config`));\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 mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<\n void,\n Failure | PlatformError,\n FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner\n> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* configOf(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(\n Effect.withSpan(`${cli.name}.files`),\n );\n const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));\n const found = yield* cli.lint({ root, files, projectFiles, config });\n yield* Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(cli.format), Arr.join(\"\\n\"))),\n });\n yield* Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.sync(() => hasError(found)),\n );\n });\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: cli.name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(NodeServices.layer),\n );\n runMain(mainOf(cli).pipe(Effect.provide(services)));\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}\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.mapInput(Order.Number, (found: Positioned) => found.line),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\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 { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { AuditConfig, Fu4Config } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { Fu4Error } from \"#/shared/lib/errors.ts\";\n\nexport interface NativeDiagnostic {\n readonly line: number;\n readonly column: number;\n readonly message: string;\n readonly kind: string;\n}\n\nexport interface NativeResult {\n readonly path: string;\n readonly diagnostics: readonly NativeDiagnostic[];\n}\n\nexport interface NativeAuditOptions extends Omit<AuditConfig, \"online\"> {\n readonly githubToken?: string;\n}\n\nexport interface NativeOptions {\n readonly config?: Fu4Config;\n readonly audit?: NativeAuditOptions;\n readonly traceparent?: string;\n}\n\nexport interface Native {\n readonly lintPaths: (\n root: string,\n paths: readonly string[],\n options: NativeOptions,\n ) => readonly NativeResult[];\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"lintPaths\") &&\n Predicate.isFunction(value.lintPaths) &&\n Predicate.hasProperty(value, \"flushTelemetry\") &&\n Predicate.isFunction(value.flushTelemetry);\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 { callAddon, present, sortByPosition, traceparent } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Config, Effect, Option, Redacted, pipe } from \"effect\";\n\nimport type { AuditConfig, Diagnostic, Fu4Config } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\nimport type { NativeAuditOptions, NativeOptions, NativeResult } from \"#/shared/native/index.ts\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly config?: Fu4Config;\n}\n\nconst diagnosticsOf = (result: NativeResult): readonly Diagnostic[] =>\n pipe(\n result.diagnostics,\n Arr.map((diagnostic): Diagnostic => ({\n path: result.path,\n line: diagnostic.line,\n column: diagnostic.column,\n rule: diagnostic.kind,\n message: diagnostic.message,\n severity: \"error\",\n })),\n );\n\nconst githubToken = Config.option(Config.Redacted(\"GH_TOKEN\")).pipe(\n Effect.map(Option.filter((token) => Redacted.value(token) !== \"\")),\n Effect.orDie,\n);\n\nconst auditOptions = Effect.fn(\"fu4.auditOptions\")(function* auditOptions(\n config: AuditConfig = {},\n) {\n const { online = true, ...rest } = config;\n if (!online) {\n return rest;\n }\n const token = yield* githubToken;\n return {\n ...rest,\n ...present(token, (value) => ({ githubToken: Redacted.value(value) })),\n } satisfies NativeAuditOptions;\n});\n\nexport const lint = Effect.fn(\"fu4.lint\")(function* lint(input: LintInput) {\n const parent = yield* traceparent;\n const config = input.config ?? {};\n const options: NativeOptions = {\n config,\n audit: yield* auditOptions(config.audit),\n ...present(parent, (value) => ({ traceparent: value })),\n };\n const results = yield* callAddon({\n addon: native,\n name: \"fu4\",\n files: input.files.length,\n call: (addon) => addon.lintPaths(input.root, input.files, options),\n failWith: failedWith,\n });\n return sortByPosition(pipe(results, Arr.flatMap(diagnosticsOf)));\n});\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\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) => 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"],"mappings":";;;;;;;;;AAEA,MAAa,UAAU,eACrB,GAAG,WAAW,KAAK,GAAG,OAAO,WAAW,IAAI,EAAE,GAAG,OAAO,WAAW,MAAM,EAAE,IAAI,WAAW,QAAQ,IAAI,WAAW,KAAK;;ACDxH,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,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S,OAAO;CACtB,MAAM,SAAS,MAAM,UAAU,CAAC;CAChC,MAAM,UAAyB;EAC7B;EACA,OAAO,OAAO,aAAa,OAAO,KAAK;EACvC,GAAG,QAAQ,SAAS,WAAW,EAAE,aAAa,MAAM,EAAE;CACxD;CACA,MAAM,UAAU,OAAO,UAAU;EAC/B,OAAO;EACP,MAAM;EACN,OAAO,MAAM,MAAM;EACnB,OAAO,UAAU,MAAM,UAAU,MAAM,MAAM,MAAM,OAAO,OAAO;EACjE,UAAU;CACZ,CAAC;CACD,OAAO,eAAe,KAAK,SAASA,MAAI,QAAQ,aAAa,CAAC,CAAC;AACjE,CAAC;;AC1DD,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,MAAM,GAAG,GAC/B,OAAO,iBAA4B,CAAC,EAAE,CACxC;AAOF,MAAa,qBAAqB,EAChC,QACA,WAAW,gBAC2B;CACtC,GAAG;CACH,GAAG;CACH,GAAG,KACD,OAAO,WAAW,CAAC,GACnBC,MAAI,KAAK,SAAS,kBAAkB,MAAM,CAC5C;AACF"}
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
};
|
|
14
|
+
// bin/fu4.ts
|
|
15
|
+
runCli();
|
|
16
|
+
export {};
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +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"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
export declare const format: (diagnostic: Diagnostic) => string;
|
|
4
|
+
declare const Fu4Error_base: Schema.Class<Fu4Error, Schema.TaggedStruct<"Fu4Error", {
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
}>, import("effect/Cause").YieldableError & {
|
|
7
|
+
readonly brand: unique symbol;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class Fu4Error extends Fu4Error_base {}
|
|
10
|
+
interface LintInput {
|
|
11
|
+
readonly root: string;
|
|
12
|
+
readonly files: readonly string[];
|
|
13
|
+
readonly config?: Fu4Config;
|
|
14
|
+
}
|
|
15
|
+
export declare const lint: (input: LintInput) => Effect.Effect<Diagnostic[], Fu4Error, never>;
|
|
16
|
+
export declare const fu4Section: (config: unknown) => Fu4Config;
|
|
17
|
+
interface PathspecInput {
|
|
18
|
+
readonly config: Fu4Config;
|
|
19
|
+
readonly patterns?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare const workflowPathspecs: ({ config, patterns }: PathspecInput) => readonly string[];
|
|
22
|
+
export type { AuditConfig, Confidence, Diagnostic, Fu4Config, LintInput, PathConfig, PathspecInput, Persona, SelfHostedRunner, Severity };
|
|
23
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as Fu4Error, s as format, t as fu4Section, r as lint, n as workflowPathspecs } from "./app-D0TgXIa0.mjs";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface PathConfig {
|
|
2
|
+
readonly ignore?: readonly string[];
|
|
3
|
+
}
|
|
4
|
+
interface SelfHostedRunner {
|
|
5
|
+
readonly labels?: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
type Persona = "regular" | "pedantic" | "auditor";
|
|
8
|
+
type Severity = "informational" | "low" | "medium" | "high";
|
|
9
|
+
type Confidence = Exclude<Severity, "informational">;
|
|
10
|
+
interface AuditConfig {
|
|
11
|
+
readonly rules?: Readonly<Record<string, unknown>>;
|
|
12
|
+
readonly persona?: Persona;
|
|
13
|
+
readonly minSeverity?: Severity;
|
|
14
|
+
readonly minConfidence?: Confidence;
|
|
15
|
+
readonly githubHost?: string;
|
|
16
|
+
readonly online?: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface Fu4Config {
|
|
19
|
+
readonly audit?: AuditConfig;
|
|
20
|
+
readonly selfHostedRunner?: SelfHostedRunner;
|
|
21
|
+
readonly configVariables?: readonly string[] | null;
|
|
22
|
+
readonly paths?: Readonly<Record<string, PathConfig>>;
|
|
23
|
+
readonly ignores?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
interface Diagnostic {
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly line: number;
|
|
28
|
+
readonly column: number;
|
|
29
|
+
readonly rule: string;
|
|
30
|
+
readonly message: string;
|
|
31
|
+
readonly severity: "error";
|
|
32
|
+
}
|
|
33
|
+
export { PathConfig as a, Severity as c, Fu4Config as i, Confidence as n, Persona as o, Diagnostic as r, SelfHostedRunner as s, AuditConfig as t };
|
|
34
|
+
//# sourceMappingURL=types-DywsX0Gn.d.mts.map
|
package/dist/vite.d.mts
ADDED
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/logo.svg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:c2pa="http://c2pa.org/manifest">
|
|
2
|
+
<rect width="512" height="512" fill="#2A3F73"/>
|
|
3
|
+
<path d="M186 214 C 160 150, 168 104, 196 98 C 222 94, 232 150, 226 206 Z" fill="#F6F1E4"/>
|
|
4
|
+
<path d="M286 206 C 280 150, 290 94, 316 98 C 344 104, 352 150, 326 214 Z" fill="#F6F1E4"/>
|
|
5
|
+
<path d="M188 116 C 190 100, 204 96, 212 104 C 206 112, 196 118, 188 116 Z" fill="#14182B"/>
|
|
6
|
+
<path d="M300 104 C 308 96, 322 100, 324 116 C 316 118, 306 112, 300 104 Z" fill="#14182B"/>
|
|
7
|
+
<path d="M100 330 C 92 230, 170 186, 256 186 C 342 186, 420 230, 412 330 C 404 392, 330 410, 256 410 C 182 410, 108 392, 100 330 Z" fill="#F6F1E4"/>
|
|
8
|
+
<path d="M388 250 l22 -18 l-2 26 l26 -6 l-14 22 l24 10 l-26 8 Z" fill="#E98A3C"/>
|
|
9
|
+
<metadata><c2pa:manifest>AAAWgmp1bWIAAAAeanVtZGMyc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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQIWOl0ZQvIIfetdUzwoiKZKbjg7XJ0FMs5WzesRVUicxT69O31C3cqtLKAH3RsHO2tmZL+5ckeLdfLu7NZrv5rI=</c2pa:manifest></metadata></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/fu4",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
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.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"actionlint",
|
|
7
|
+
"github-actions",
|
|
8
|
+
"lint",
|
|
9
|
+
"tanstack-intent",
|
|
10
|
+
"vite-plus"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/masseater/masseater.dev/tree/main/libs/fu4#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/masseater/masseater.dev/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/masseater/masseater.dev.git",
|
|
20
|
+
"directory": "libs/fu4"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"fu4": "./dist/cli.mjs"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"dist",
|
|
28
|
+
"logo.svg",
|
|
29
|
+
"skills/lint-workflows"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"imports": {
|
|
33
|
+
"#/*": "./src/*"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"default": "./dist/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./vite": {
|
|
41
|
+
"types": "./dist/vite.d.mts",
|
|
42
|
+
"default": "./dist/vite.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public",
|
|
48
|
+
"provenance": true
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@effect/platform-node": "4.1.4"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@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",
|
|
58
|
+
"@types/node": "26.6.6",
|
|
59
|
+
"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
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
|
|
70
|
+
"vite-plus": "1.7.0",
|
|
71
|
+
"yaml": "2.9.1"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"effect": "^4.1.2",
|
|
75
|
+
"vite": "*",
|
|
76
|
+
"vite-plus": ">=1.5.0"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=26"
|
|
80
|
+
},
|
|
81
|
+
"native": {
|
|
82
|
+
"binary": "fu4",
|
|
83
|
+
"targets": [
|
|
84
|
+
"linux-x64-gnu",
|
|
85
|
+
"win32-x64-msvc"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"optionalDependencies": {
|
|
89
|
+
"@r_masseater/fu4-linux-x64-gnu": "0.1.0",
|
|
90
|
+
"@r_masseater/fu4-win32-x64-msvc": "0.1.0"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {}
|
|
6
93
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-workflows
|
|
3
|
+
description: >
|
|
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.
|
|
8
|
+
metadata:
|
|
9
|
+
type: core
|
|
10
|
+
library: "@r_masseater/fu4"
|
|
11
|
+
library_version: 0.1.0
|
|
12
|
+
sources:
|
|
13
|
+
- src/app/index.ts
|
|
14
|
+
- src/shared/config/types.ts
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# lint-workflows
|
|
18
|
+
|
|
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.
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
vp add -D @r_masseater/fu4
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import "@r_masseater/fu4/vite";
|
|
33
|
+
import { defineConfig } from "vite-plus";
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
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
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
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.
|
|
66
|
+
|
|
67
|
+
## Running
|
|
68
|
+
|
|
69
|
+
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'`.
|
|
74
|
+
|
|
75
|
+
From code, `lint({ root, files, config })` returns the diagnostics as an Effect.
|
|
76
|
+
|
|
77
|
+
## Fixing reports
|
|
78
|
+
|
|
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.
|