@r_masseater/wism 0.0.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.
- package/LICENSE +87 -0
- package/README.md +48 -0
- package/dist/app-Cz0XYkP8.mjs +313 -0
- package/dist/app-Cz0XYkP8.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-wGGk2Etn.d.mts +56 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.mjs +1 -0
- package/dist/vite.d.mts +7 -0
- package/dist/vite.mjs +1 -0
- package/logo.svg +4 -0
- package/package.json +73 -6
- package/skills/lint-structure/SKILL.md +71 -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
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @r_masseater/wism
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
The engine of a structure and dependency linter for TypeScript, Rust and Markdown, configured from
|
|
6
|
+
`vite.config.ts`.
|
|
7
|
+
|
|
8
|
+
A Rust addon reads every import, `use` path and Markdown link of the files git tracks into one
|
|
9
|
+
graph. Rules are TypeScript plugins that check that graph, so a rule package runs on every OS
|
|
10
|
+
without its own native build. `@r_masseater/wism-fsd` holds the Feature-Sliced Design rules.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import "@r_masseater/wism/vite";
|
|
14
|
+
import { definePlugin, defineRule } from "@r_masseater/wism";
|
|
15
|
+
import { fsdPreset, skill, workspace } from "@r_masseater/wism-fsd";
|
|
16
|
+
import { defineConfig } from "vite-plus";
|
|
17
|
+
|
|
18
|
+
const noSharedToApp = defineRule({
|
|
19
|
+
meta: { description: "shared never links into app" },
|
|
20
|
+
check: ({ edges, report }) => {
|
|
21
|
+
for (const edge of edges) {
|
|
22
|
+
if (edge.from.includes("/shared/") && edge.specifier.includes("/app/")) {
|
|
23
|
+
report({ path: edge.from, line: edge.line, message: "points into app" });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const structure = fsdPreset({ kinds: [workspace({ paths: ["libs/*"] }), skill()] });
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
wism: {
|
|
33
|
+
...structure,
|
|
34
|
+
plugins: {
|
|
35
|
+
...structure.plugins,
|
|
36
|
+
local: definePlugin({ rules: { "no-shared-to-app": noSharedToApp } }),
|
|
37
|
+
},
|
|
38
|
+
rules: { ...structure.rules, "local/no-shared-to-app": "error" },
|
|
39
|
+
ignores: ["**/fixtures/**"],
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Run `wism` to check the files git tracks, or call `lint` from code.
|
|
45
|
+
|
|
46
|
+
## Agent skills
|
|
47
|
+
|
|
48
|
+
The package ships TanStack Intent skills for coding agents. Load one with `vp exec intent load @r_masseater/wism#<skill>`.
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { Array, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, 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/entities/rule/model/define.ts
|
|
10
|
+
const defineRule = (rule) => rule;
|
|
11
|
+
const definePlugin = (plugin) => plugin;
|
|
12
|
+
// ../lint-host/src/entities/rule/model/setting.ts
|
|
13
|
+
const NO_OPTIONS = {};
|
|
14
|
+
const settingOf = (entry) => Match.value(entry).pipe(Match.when(Match.string, (severity) => ({
|
|
15
|
+
severity,
|
|
16
|
+
options: NO_OPTIONS
|
|
17
|
+
})), Match.orElse(([severity, options]) => ({
|
|
18
|
+
severity,
|
|
19
|
+
options: options ?? NO_OPTIONS
|
|
20
|
+
})));
|
|
21
|
+
// ../lint-host/src/shared/lib/target.ts
|
|
22
|
+
const abiOf = (platform) => Match.value(platform).pipe(Match.when("linux", () => "-gnu"), Match.when("win32", () => "-msvc"), Match.orElse(() => ""));
|
|
23
|
+
const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;
|
|
24
|
+
const addonFileOf = (binary) => `${binary}.${platformTarget}.node`;
|
|
25
|
+
// ../lint-host/src/features/build-addon/model/build.ts
|
|
26
|
+
const taggedError$1 = Schema.TaggedError;
|
|
27
|
+
var AddonBuildFailed = class extends taggedError$1()("AddonBuildFailed", { message: Schema.String }) {};
|
|
28
|
+
const LIBRARY = {
|
|
29
|
+
linux: (name) => `lib${name}.so`,
|
|
30
|
+
darwin: (name) => `lib${name}.dylib`,
|
|
31
|
+
win32: (name) => `${name}.dll`
|
|
32
|
+
};
|
|
33
|
+
const SUCCESS = 0;
|
|
34
|
+
const cargo = Effect.fn("cargo")(function* cargo(crate, workspace) {
|
|
35
|
+
const exitCode = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make("cargo", [
|
|
36
|
+
"build",
|
|
37
|
+
"--release",
|
|
38
|
+
"--locked",
|
|
39
|
+
"-p",
|
|
40
|
+
crate
|
|
41
|
+
], {
|
|
42
|
+
cwd: workspace,
|
|
43
|
+
stdout: "inherit",
|
|
44
|
+
stderr: "inherit"
|
|
45
|
+
}));
|
|
46
|
+
const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });
|
|
47
|
+
yield* Effect.when(Effect.fail(failure), Effect.sync(() => Number(exitCode) !== SUCCESS));
|
|
48
|
+
});
|
|
49
|
+
Effect.fn("buildAddon")(function* build(options) {
|
|
50
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
51
|
+
const path = yield* Path.Path;
|
|
52
|
+
const library = yield* Effect.fromOption(Record.get(LIBRARY, process.platform)).pipe(Effect.mapError(() => AddonBuildFailed.make({ message: `no native build for ${process.platform}` })));
|
|
53
|
+
yield* cargo(options.crate, options.workspaceDir);
|
|
54
|
+
const output = path.join(options.packageDir, "native");
|
|
55
|
+
yield* fileSystem.makeDirectory(output, { recursive: true });
|
|
56
|
+
const built = library(String$1.replaceAll("-", "_")(options.crate));
|
|
57
|
+
yield* fileSystem.copyFile(path.join(options.workspaceDir, "target", "release", built), path.join(output, addonFileOf(options.binary)));
|
|
58
|
+
});
|
|
59
|
+
// ../lint-host/src/features/load-addon/model/load.ts
|
|
60
|
+
const loadAddon = ({ packageName, binary, from, isAddon, failWith }) => {
|
|
61
|
+
const requireFrom = createRequire(from);
|
|
62
|
+
const loadFrom = (specifier) => Effect.try({
|
|
63
|
+
try: () => requireFrom(specifier),
|
|
64
|
+
catch: failWith(`could not load ${specifier}`)
|
|
65
|
+
});
|
|
66
|
+
return loadFrom(`${packageName}-${platformTarget}`).pipe(Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)), Effect.filterOrFail(isAddon, (found) => failWith(`no ${binary} addon for ${platformTarget}`)(found)));
|
|
67
|
+
};
|
|
68
|
+
const callAddon = ({ addon, name, files, call, failWith }) => addon.pipe(Effect.flatMap((loaded) => Effect.try({
|
|
69
|
+
try: () => call(loaded),
|
|
70
|
+
catch: failWith(`${name} could not lint`)
|
|
71
|
+
}).pipe(Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())))), Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }));
|
|
72
|
+
// ../lint-host/src/features/run-cli/model/cli.ts
|
|
73
|
+
const CONFIG_FILES = [
|
|
74
|
+
"vite.config.ts",
|
|
75
|
+
"vite.config.mts",
|
|
76
|
+
"vite.config.js",
|
|
77
|
+
"vite.config.mjs"
|
|
78
|
+
];
|
|
79
|
+
const FAILED = 1;
|
|
80
|
+
const ARGUMENTS_START = 2;
|
|
81
|
+
const configOf = (cli, root) => Effect.gen(function* readConfig() {
|
|
82
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
83
|
+
const path = yield* Path.Path;
|
|
84
|
+
const found = yield* pipe(CONFIG_FILES, Array.map((name) => path.join(root, name)), Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))));
|
|
85
|
+
const loaded = yield* Option.match(Array.head(found), {
|
|
86
|
+
onNone: () => Effect.succeed({}),
|
|
87
|
+
onSome: (file) => Effect.tryPromise({
|
|
88
|
+
try: () => resolveConfigFromFile(file),
|
|
89
|
+
catch: cli.failWith(`could not load ${file}`)
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
return cli.section(loaded);
|
|
93
|
+
}).pipe(Effect.withSpan(`${cli.name}.config`));
|
|
94
|
+
const trackedFiles = (root, pathspecs) => Effect.gen(function* listFiles() {
|
|
95
|
+
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
96
|
+
"ls-files",
|
|
97
|
+
"-co",
|
|
98
|
+
"--exclude-standard",
|
|
99
|
+
"-z",
|
|
100
|
+
"--",
|
|
101
|
+
...pathspecs
|
|
102
|
+
], { cwd: root }));
|
|
103
|
+
return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
|
|
104
|
+
});
|
|
105
|
+
const requestOf = (config, patterns) => Array.match(patterns, {
|
|
106
|
+
onEmpty: () => ({ config }),
|
|
107
|
+
onNonEmpty: (given) => ({
|
|
108
|
+
config,
|
|
109
|
+
patterns: given
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
const hasError = (found) => pipe(found, Array.some(({ severity }) => severity === "error"));
|
|
113
|
+
const mainOf = (cli) => Effect.gen(function* main() {
|
|
114
|
+
const root = process.cwd();
|
|
115
|
+
const config = yield* configOf(cli, root);
|
|
116
|
+
const patterns = process.argv.slice(ARGUMENTS_START);
|
|
117
|
+
const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(Effect.withSpan(`${cli.name}.files`));
|
|
118
|
+
const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));
|
|
119
|
+
const found = yield* cli.lint({
|
|
120
|
+
root,
|
|
121
|
+
files,
|
|
122
|
+
projectFiles,
|
|
123
|
+
config
|
|
124
|
+
});
|
|
125
|
+
yield* Array.match(found, {
|
|
126
|
+
onEmpty: () => Effect.void,
|
|
127
|
+
onNonEmpty: (all) => Console.log(pipe(all, Array.map(cli.format), Array.join("\n")))
|
|
128
|
+
});
|
|
129
|
+
yield* Effect.when(Effect.sync(() => {
|
|
130
|
+
process.exitCode = FAILED;
|
|
131
|
+
}), Effect.sync(() => hasError(found)));
|
|
132
|
+
});
|
|
133
|
+
const runCli = (cli) => {
|
|
134
|
+
const services = Otlp.layerFromConfig({ resource: { serviceName: cli.name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(NodeServices.layer));
|
|
135
|
+
runMain(mainOf(cli).pipe(Effect.provide(services)));
|
|
136
|
+
};
|
|
137
|
+
const present = Function.dual(2, (value, build) => Option.match(value, {
|
|
138
|
+
onNone: () => ({}),
|
|
139
|
+
onSome: build
|
|
140
|
+
}));
|
|
141
|
+
// ../lint-host/src/shared/lib/trace.ts
|
|
142
|
+
const SAMPLED = "01";
|
|
143
|
+
const NOT_SAMPLED = "00";
|
|
144
|
+
const flagsOf = (sampled) => Boolean.match(sampled, {
|
|
145
|
+
onFalse: () => NOT_SAMPLED,
|
|
146
|
+
onTrue: () => SAMPLED
|
|
147
|
+
});
|
|
148
|
+
const traceparent = Effect.currentSpan.pipe(Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`), Effect.option);
|
|
149
|
+
const byPosition = Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.mapInput(Order.Number, (found) => found.line));
|
|
150
|
+
const sortByPosition = (found) => Array.sort(found, byPosition);
|
|
151
|
+
// src/entities/rule/model/resolve.ts
|
|
152
|
+
const SEPARATOR = "/";
|
|
153
|
+
const NAME_START = 1;
|
|
154
|
+
const isPluginRule = (id) => String$1.includes(SEPARATOR)(id);
|
|
155
|
+
const pluginOf = (id) => Array.headNonEmpty(String$1.split(id, SEPARATOR));
|
|
156
|
+
const nameOf = (id) => pipe(String$1.split(id, SEPARATOR), Array.drop(NAME_START), Array.join(SEPARATOR));
|
|
157
|
+
const scriptOf = (plugins) => ([id, entry]) => pipe(Record.get(plugins, pluginOf(id)), Option.flatMap((plugin) => Record.get(plugin.rules ?? {}, nameOf(id))), Option.map((rule) => ({
|
|
158
|
+
id,
|
|
159
|
+
rule,
|
|
160
|
+
setting: settingOf(entry)
|
|
161
|
+
})), Option.filter(({ setting }) => setting.severity !== "off"));
|
|
162
|
+
const resolve = (config) => pipe(Record.toEntries(config.rules ?? {}), Array.filter(([id]) => isPluginRule(id)), Array.map(scriptOf(config.plugins ?? {})), Array.getSomes);
|
|
163
|
+
const unknownRules = (config) => {
|
|
164
|
+
const plugins = config.plugins ?? {};
|
|
165
|
+
return pipe(Record.keys(config.rules ?? {}), Array.filter((id) => !isPluginRule(id) || pipe(Record.get(plugins, pluginOf(id)), Option.flatMap((plugin) => Record.get(plugin.rules ?? {}, nameOf(id))), Option.isNone)));
|
|
166
|
+
};
|
|
167
|
+
// src/app/format.ts
|
|
168
|
+
const format = (diagnostic) => `${diagnostic.path}:${String(diagnostic.line)}:${String(diagnostic.column)} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}`;
|
|
169
|
+
// src/features/run-rules/model/run.ts
|
|
170
|
+
const FIRST = 1;
|
|
171
|
+
const severityOf = (rule) => Match.value(rule.setting.severity).pipe(Match.when("warn", () => "warn"), Match.orElse(() => "error"));
|
|
172
|
+
const diagnosticOf = (rule) => (report) => ({
|
|
173
|
+
path: report.path,
|
|
174
|
+
line: Option.getOrElse(Option.fromNullishOr(report.line), () => FIRST),
|
|
175
|
+
column: Option.getOrElse(Option.fromNullishOr(report.column), () => FIRST),
|
|
176
|
+
rule: rule.id,
|
|
177
|
+
message: report.message,
|
|
178
|
+
severity: severityOf(rule)
|
|
179
|
+
});
|
|
180
|
+
const runOne = (graph) => (rule) => {
|
|
181
|
+
const reports = [];
|
|
182
|
+
rule.rule.check({
|
|
183
|
+
...graph,
|
|
184
|
+
options: rule.setting.options,
|
|
185
|
+
report: (report) => {
|
|
186
|
+
reports.push(report);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return pipe(reports, Array.map(diagnosticOf(rule)));
|
|
190
|
+
};
|
|
191
|
+
const runScriptRules = (rules) => (graph) => pipe(rules, Array.flatMap(runOne(graph)));
|
|
192
|
+
// src/shared/lib/errors.ts
|
|
193
|
+
const taggedError = Schema.TaggedError;
|
|
194
|
+
var WismError = class extends taggedError()("WismError", { message: Schema.String }) {};
|
|
195
|
+
const failedWith = (message) => (cause) => WismError.make({ message: `${message}: ${String(cause)}` });
|
|
196
|
+
// src/shared/native/graph.ts
|
|
197
|
+
const HEADER_WORDS = 3;
|
|
198
|
+
const EDGE_WORDS = 7;
|
|
199
|
+
const STRING_WORDS = 2;
|
|
200
|
+
const WORD = 4;
|
|
201
|
+
const NOTHING = 0;
|
|
202
|
+
const HEADER = {
|
|
203
|
+
edges: 0,
|
|
204
|
+
strings: 1
|
|
205
|
+
};
|
|
206
|
+
const FIELD = {
|
|
207
|
+
from: 0,
|
|
208
|
+
kind: 1,
|
|
209
|
+
target: 2,
|
|
210
|
+
specifier: 3,
|
|
211
|
+
line: 4,
|
|
212
|
+
column: 5,
|
|
213
|
+
wildcard: 6
|
|
214
|
+
};
|
|
215
|
+
const MODULE = 1;
|
|
216
|
+
const WILDCARD = 1;
|
|
217
|
+
const LENGTH = 1;
|
|
218
|
+
const MODULE_SEPARATOR = "::";
|
|
219
|
+
const at = (words, index) => Option.getOrElse(Option.fromNullishOr(words.at(index)), () => NOTHING);
|
|
220
|
+
const stringsOf = (words) => {
|
|
221
|
+
const spans = HEADER_WORDS + at(words, HEADER.edges) * EDGE_WORDS;
|
|
222
|
+
const blob = new Uint8Array(words.buffer, words.byteOffset + (spans + at(words, HEADER.strings) * STRING_WORDS) * WORD);
|
|
223
|
+
const decoder = new TextDecoder();
|
|
224
|
+
const cache = /* @__PURE__ */ new Map();
|
|
225
|
+
const read = (index) => {
|
|
226
|
+
const start = at(words, spans + index * STRING_WORDS);
|
|
227
|
+
const value = decoder.decode(blob.subarray(start, start + at(words, spans + index * STRING_WORDS + LENGTH)));
|
|
228
|
+
cache.set(index, value);
|
|
229
|
+
return value;
|
|
230
|
+
};
|
|
231
|
+
return (index) => Option.getOrElse(Option.fromNullishOr(cache.get(index)), () => read(index));
|
|
232
|
+
};
|
|
233
|
+
const targetOf = (kind, value) => {
|
|
234
|
+
if (kind === MODULE) return {
|
|
235
|
+
type: "module",
|
|
236
|
+
value: String$1.split(value, MODULE_SEPARATOR)
|
|
237
|
+
};
|
|
238
|
+
return {
|
|
239
|
+
type: "file",
|
|
240
|
+
value
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
const decodeGraph = (files) => (words) => {
|
|
244
|
+
const text = stringsOf(words);
|
|
245
|
+
const field = (base, name) => at(words, base + FIELD[name]);
|
|
246
|
+
const count = at(words, HEADER.edges);
|
|
247
|
+
return pipe(Array.makeBy(count, (index) => HEADER_WORDS + index * EDGE_WORDS), Array.take(count), Array.map((base) => ({
|
|
248
|
+
from: Option.getOrElse(Array.get(files, field(base, "from")), () => ""),
|
|
249
|
+
specifier: text(field(base, "specifier")),
|
|
250
|
+
target: targetOf(field(base, "kind"), text(field(base, "target"))),
|
|
251
|
+
line: field(base, "line"),
|
|
252
|
+
column: field(base, "column"),
|
|
253
|
+
wildcard: field(base, "wildcard") === WILDCARD
|
|
254
|
+
})));
|
|
255
|
+
};
|
|
256
|
+
// src/shared/native/index.ts
|
|
257
|
+
const isNative = (value) => Predicate.hasProperty(value, "collect") && Predicate.isFunction(value.collect) && Predicate.hasProperty(value, "flushTelemetry") && Predicate.isFunction(value.flushTelemetry);
|
|
258
|
+
const native = loadAddon({
|
|
259
|
+
packageName: "@r_masseater/wism",
|
|
260
|
+
binary: "wism",
|
|
261
|
+
from: import.meta.url,
|
|
262
|
+
isAddon: isNative,
|
|
263
|
+
failWith: failedWith
|
|
264
|
+
});
|
|
265
|
+
// src/app/lint.ts
|
|
266
|
+
const checkRules = (config) => Array.match(unknownRules(config), {
|
|
267
|
+
onEmpty: () => Effect.void,
|
|
268
|
+
onNonEmpty: (names) => Effect.fail(WismError.make({ message: `rules that no configured plugin defines: ${Array.join(names, ", ")}. Name each rule plugin/rule.` }))
|
|
269
|
+
});
|
|
270
|
+
const collectEdges = Effect.fn("wism.collect_edges")(function* collectEdges(input) {
|
|
271
|
+
const parent = yield* traceparent;
|
|
272
|
+
const options = present(parent, (value) => ({ traceparent: value }));
|
|
273
|
+
const words = yield* callAddon({
|
|
274
|
+
addon: native,
|
|
275
|
+
name: "wism",
|
|
276
|
+
files: input.files.length,
|
|
277
|
+
call: (addon) => addon.collect(input.root, input.files, options),
|
|
278
|
+
failWith: failedWith
|
|
279
|
+
});
|
|
280
|
+
return yield* Effect.sync(() => decodeGraph(input.files)(words)).pipe(Effect.withSpan("wism.decode"));
|
|
281
|
+
});
|
|
282
|
+
const lint = Effect.fn("wism.lint")(function* lint(input) {
|
|
283
|
+
const config = input.config ?? {};
|
|
284
|
+
yield* checkRules(config);
|
|
285
|
+
const rules = resolve(config);
|
|
286
|
+
if (Array.isReadonlyArrayEmpty(rules)) return [];
|
|
287
|
+
const edges = yield* collectEdges(input);
|
|
288
|
+
const found = yield* Effect.sync(() => runScriptRules(rules)({
|
|
289
|
+
root: input.root,
|
|
290
|
+
files: input.files,
|
|
291
|
+
edges
|
|
292
|
+
})).pipe(Effect.withSpan("wism.script_rules", { attributes: { "wism.edges": edges.length } }));
|
|
293
|
+
return sortByPosition(found);
|
|
294
|
+
});
|
|
295
|
+
// src/app/section.ts
|
|
296
|
+
const UNOWNED = [
|
|
297
|
+
":(exclude,attr:linguist-vendored)",
|
|
298
|
+
":(exclude,attr:linguist-generated)",
|
|
299
|
+
":(exclude,attr:linguist-documentation)"
|
|
300
|
+
];
|
|
301
|
+
const hasSection = (value) => Predicate.hasProperty(value, "wism") && Predicate.isObject(value.wism);
|
|
302
|
+
const wismSection = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => value.wism), Option.getOrElse(() => ({})));
|
|
303
|
+
const wismPathspecs = ({ config, patterns = [] }) => [
|
|
304
|
+
...Array.match(patterns, {
|
|
305
|
+
onEmpty: () => ["."],
|
|
306
|
+
onNonEmpty: (given) => given
|
|
307
|
+
}),
|
|
308
|
+
...UNOWNED,
|
|
309
|
+
...pipe(config.ignores ?? [], Array.map((glob) => `:(glob,exclude)${glob}`))
|
|
310
|
+
];
|
|
311
|
+
export { failedWith as a, definePlugin as c, WismError as i, defineRule as l, wismSection as n, format as o, lint as r, runCli as s, wismPathspecs as t };
|
|
312
|
+
|
|
313
|
+
//# sourceMappingURL=app-Cz0XYkP8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-Cz0XYkP8.mjs","names":["taggedError","Rec","Str","Arr","Str","Fn","Bool","Arr","Str","Arr","Rec","Arr","Str","Arr","Arr","Arr"],"sources":["../src/entities/rule/model/define.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/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/entities/rule/model/resolve.ts","../src/app/format.ts","../src/features/run-rules/model/run.ts","../src/shared/lib/errors.ts","../src/shared/native/graph.ts","../src/shared/native/index.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["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 { Match } 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","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 { settingOf } from \"@masseater.dev/lint-host\";\nimport type { Setting } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { Plugin, Rule, RuleEntry, WismConfig } from \"#/shared/config/index.ts\";\n\nconst SEPARATOR = \"/\";\nconst NAME_START = 1;\n\nexport interface ScriptRule {\n readonly id: string;\n readonly rule: Rule;\n readonly setting: Setting;\n}\n\nconst isPluginRule = (id: string): boolean => Str.includes(SEPARATOR)(id);\n\nconst pluginOf = (id: string): string => Arr.headNonEmpty(Str.split(id, SEPARATOR));\n\nconst nameOf = (id: string): string =>\n pipe(Str.split(id, SEPARATOR), Arr.drop(NAME_START), Arr.join(SEPARATOR));\n\nconst scriptOf =\n (plugins: Readonly<Record<string, Plugin>>) =>\n ([id, entry]: readonly [string, RuleEntry]): Option.Option<ScriptRule> =>\n pipe(\n Rec.get(plugins, pluginOf(id)),\n Option.flatMap((plugin) => Rec.get(plugin.rules ?? {}, nameOf(id))),\n Option.map((rule): ScriptRule => ({ id, rule, setting: settingOf(entry) })),\n Option.filter(({ setting }) => setting.severity !== \"off\"),\n );\n\nexport const resolve = (config: WismConfig): readonly ScriptRule[] =>\n pipe(\n Rec.toEntries(config.rules ?? {}),\n Arr.filter(([id]) => isPluginRule(id)),\n Arr.map(scriptOf(config.plugins ?? {})),\n Arr.getSomes,\n );\n\nexport const unknownRules = (config: WismConfig): readonly string[] => {\n const plugins = config.plugins ?? {};\n return pipe(\n Rec.keys(config.rules ?? {}),\n Arr.filter(\n (id) =>\n !isPluginRule(id) ||\n pipe(\n Rec.get(plugins, pluginOf(id)),\n Option.flatMap((plugin) => Rec.get(plugin.rules ?? {}, nameOf(id))),\n Option.isNone,\n ),\n ),\n );\n};\n","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.severity} ${diagnostic.rule} ${diagnostic.message}`;\n","import { Array as Arr, Match, Option, pipe } from \"effect\";\n\nimport type { ScriptRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic, GraphEdge, Report } from \"#/shared/config/index.ts\";\n\nconst FIRST = 1;\n\nexport interface Graph {\n readonly files: readonly string[];\n readonly root: string;\n readonly edges: readonly GraphEdge[];\n}\n\nconst severityOf = (rule: ScriptRule): Diagnostic[\"severity\"] =>\n Match.value(rule.setting.severity).pipe(\n Match.when(\"warn\", () => \"warn\" as const),\n Match.orElse(() => \"error\" as const),\n );\n\nconst diagnosticOf =\n (rule: ScriptRule) =>\n (report: Report): Diagnostic => ({\n path: report.path,\n line: Option.getOrElse(Option.fromNullishOr(report.line), () => FIRST),\n column: Option.getOrElse(Option.fromNullishOr(report.column), () => FIRST),\n rule: rule.id,\n message: report.message,\n severity: severityOf(rule),\n });\n\nconst runOne =\n (graph: Graph) =>\n (rule: ScriptRule): readonly Diagnostic[] => {\n const reports: Report[] = [];\n rule.rule.check({\n ...graph,\n options: rule.setting.options,\n report: (report) => {\n reports.push(report);\n },\n });\n return pipe(reports, Arr.map(diagnosticOf(rule)));\n };\n\nexport const runScriptRules =\n (rules: readonly ScriptRule[]) =>\n (graph: Graph): readonly Diagnostic[] =>\n pipe(rules, Arr.flatMap(runOne(graph)));\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class WismError extends taggedError<WismError, { readonly brand: unique symbol }>()(\n \"WismError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): WismError =>\n WismError.make({ message: `${message}: ${String(cause)}` });\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { GraphEdge, ImportTarget } from \"#/shared/config/index.ts\";\n\nconst HEADER_WORDS = 3;\nconst EDGE_WORDS = 7;\nconst STRING_WORDS = 2;\nconst WORD = 4;\nconst NOTHING = 0;\nconst HEADER = { edges: 0, strings: 1 } as const;\nconst FIELD = {\n from: 0,\n kind: 1,\n target: 2,\n specifier: 3,\n line: 4,\n column: 5,\n wildcard: 6,\n} as const;\nconst MODULE = 1;\nconst WILDCARD = 1;\nconst LENGTH = 1;\nconst MODULE_SEPARATOR = \"::\";\n\nconst at = (words: Uint32Array, index: number): number =>\n Option.getOrElse(Option.fromNullishOr(words.at(index)), () => NOTHING);\n\nconst stringsOf = (words: Uint32Array): ((index: number) => string) => {\n const spans = HEADER_WORDS + at(words, HEADER.edges) * EDGE_WORDS;\n const blob = new Uint8Array(\n words.buffer,\n words.byteOffset + (spans + at(words, HEADER.strings) * STRING_WORDS) * WORD,\n );\n const decoder = new TextDecoder();\n const cache = new Map<number, string>();\n const read = (index: number): string => {\n const start = at(words, spans + index * STRING_WORDS);\n const value = decoder.decode(\n blob.subarray(start, start + at(words, spans + index * STRING_WORDS + LENGTH)),\n );\n cache.set(index, value);\n return value;\n };\n return (index) => Option.getOrElse(Option.fromNullishOr(cache.get(index)), () => read(index));\n};\n\nconst targetOf = (kind: number, value: string): ImportTarget => {\n if (kind === MODULE) {\n return { type: \"module\", value: Str.split(value, MODULE_SEPARATOR) };\n }\n return { type: \"file\", value };\n};\n\nexport const decodeGraph =\n (files: readonly string[]) =>\n (words: Uint32Array): readonly GraphEdge[] => {\n const text = stringsOf(words);\n const field = (base: number, name: keyof typeof FIELD): number => at(words, base + FIELD[name]);\n const count = at(words, HEADER.edges);\n return pipe(\n Arr.makeBy(count, (index) => HEADER_WORDS + index * EDGE_WORDS),\n Arr.take(count),\n Arr.map((base): GraphEdge => ({\n from: Option.getOrElse(Arr.get(files, field(base, \"from\")), () => \"\"),\n specifier: text(field(base, \"specifier\")),\n target: targetOf(field(base, \"kind\"), text(field(base, \"target\"))),\n line: field(base, \"line\"),\n column: field(base, \"column\"),\n wildcard: field(base, \"wildcard\") === WILDCARD,\n })),\n );\n };\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { WismError } from \"#/shared/lib/errors.ts\";\n\nexport interface NativeOptions {\n readonly traceparent?: string;\n}\n\nexport interface Native {\n readonly collect: (root: string, files: readonly string[], options: NativeOptions) => Uint32Array;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"collect\") &&\n Predicate.isFunction(value.collect) &&\n Predicate.hasProperty(value, \"flushTelemetry\") &&\n Predicate.isFunction(value.flushTelemetry);\n\nexport const native: Effect.Effect<Native, WismError> = loadAddon({\n packageName: \"@r_masseater/wism\",\n binary: \"wism\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\nexport { decodeGraph } from \"./graph.ts\";\n","import { callAddon, present, sortByPosition, traceparent } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect } from \"effect\";\n\nimport { resolve, unknownRules } from \"#/entities/rule/index.ts\";\nimport { runScriptRules } from \"#/features/run-rules/index.ts\";\nimport type { Diagnostic, WismConfig } from \"#/shared/config/index.ts\";\nimport { WismError, failedWith } from \"#/shared/lib/errors.ts\";\nimport { decodeGraph, native } from \"#/shared/native/index.ts\";\nimport type { NativeOptions } from \"#/shared/native/index.ts\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly config?: WismConfig;\n}\n\nconst checkRules = (config: WismConfig): Effect.Effect<void, WismError> =>\n Arr.match(unknownRules(config), {\n onEmpty: () => Effect.void,\n onNonEmpty: (names) =>\n Effect.fail(\n WismError.make({\n message: `rules that no configured plugin defines: ${Arr.join(names, \", \")}. Name each rule plugin/rule.`,\n }),\n ),\n });\n\nconst collectEdges = Effect.fn(\"wism.collect_edges\")(function* collectEdges(input: LintInput) {\n const parent = yield* traceparent;\n const options: NativeOptions = present(parent, (value) => ({ traceparent: value }));\n const words = yield* callAddon({\n addon: native,\n name: \"wism\",\n files: input.files.length,\n call: (addon) => addon.collect(input.root, input.files, options),\n failWith: failedWith,\n });\n return yield* Effect.sync(() => decodeGraph(input.files)(words)).pipe(\n Effect.withSpan(\"wism.decode\"),\n );\n});\n\nexport const lint = Effect.fn(\"wism.lint\")(function* lint(input: LintInput) {\n const config = input.config ?? {};\n yield* checkRules(config);\n const rules = resolve(config);\n if (Arr.isReadonlyArrayEmpty(rules)) {\n return [];\n }\n const edges = yield* collectEdges(input);\n const found = yield* Effect.sync(() =>\n runScriptRules(rules)({ root: input.root, files: input.files, edges }),\n ).pipe(Effect.withSpan(\"wism.script_rules\", { attributes: { \"wism.edges\": edges.length } }));\n return sortByPosition<Diagnostic>(found);\n});\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport type { WismConfig } from \"#/shared/config/index.ts\";\n\nconst UNOWNED: readonly string[] = [\n \":(exclude,attr:linguist-vendored)\",\n \":(exclude,attr:linguist-generated)\",\n \":(exclude,attr:linguist-documentation)\",\n];\n\nconst hasSection = (value: unknown): value is { readonly wism: WismConfig } =>\n Predicate.hasProperty(value, \"wism\") && Predicate.isObject(value.wism);\n\nexport const wismSection = (config: unknown): WismConfig =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => value.wism),\n Option.getOrElse((): WismConfig => ({})),\n );\n\nexport interface PathspecRequest {\n readonly config: WismConfig;\n readonly patterns?: readonly string[];\n}\n\nexport const wismPathspecs = ({ config, patterns = [] }: PathspecRequest): readonly string[] => [\n ...Arr.match(patterns, { onEm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,MAAM,KAAK,UAAU,SAAS,MAAM,IAAI;AAEvE,MAAa,eAAe,WAC1B,KACE,OAAO,cAAc,QAAQ,UAAU,GACvC,OAAO,KAAK,UAAU,MAAM,IAAI,GAChC,OAAO,iBAA6B,CAAC,EAAE,CACzC;AAOF,MAAa,iBAAiB,EAAE,QAAQ,WAAW,CAAC,QAA4C;CAC9F,GAAGC,MAAI,MAAM,UAAU;EAAE,eAAe,CAAC,GAAG;EAAG,aAAa,UAAU;CAAM,CAAC;CAC7E,GAAG;CACH,GAAG,KACD,OAAO,WAAW,CAAC,GACnBA,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 wismSection, o as format, r as lint, s as runCli$1, t as wismPathspecs } from "./app-Cz0XYkP8.mjs";
|
|
3
|
+
// src/app/cli.ts
|
|
4
|
+
const runCli = () => {
|
|
5
|
+
runCli$1({
|
|
6
|
+
name: "wism",
|
|
7
|
+
section: wismSection,
|
|
8
|
+
pathspecs: wismPathspecs,
|
|
9
|
+
lint,
|
|
10
|
+
format,
|
|
11
|
+
failWith: failedWith
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
// bin/wism.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/wism.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 { wismPathspecs, wismSection } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"wism\",\n section: wismSection,\n pathspecs: wismPathspecs,\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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Effect, Option } 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
|
+
type ImportTarget = {
|
|
6
|
+
readonly type: "file";
|
|
7
|
+
readonly value: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly type: "module";
|
|
10
|
+
readonly value: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
interface GraphEdge {
|
|
13
|
+
readonly from: string;
|
|
14
|
+
readonly specifier: string;
|
|
15
|
+
readonly target: ImportTarget;
|
|
16
|
+
readonly line: number;
|
|
17
|
+
readonly column: number;
|
|
18
|
+
readonly wildcard: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface Report {
|
|
21
|
+
readonly message: string;
|
|
22
|
+
readonly path: string;
|
|
23
|
+
readonly line?: number;
|
|
24
|
+
readonly column?: number;
|
|
25
|
+
}
|
|
26
|
+
interface RuleContext {
|
|
27
|
+
readonly root: string;
|
|
28
|
+
readonly files: readonly string[];
|
|
29
|
+
readonly edges: readonly GraphEdge[];
|
|
30
|
+
readonly options: RuleOptions;
|
|
31
|
+
readonly report: (report: Report) => void;
|
|
32
|
+
}
|
|
33
|
+
interface Rule {
|
|
34
|
+
readonly meta: {
|
|
35
|
+
readonly description: string;
|
|
36
|
+
};
|
|
37
|
+
readonly check: (context: RuleContext) => void;
|
|
38
|
+
}
|
|
39
|
+
interface Plugin {
|
|
40
|
+
readonly rules?: Readonly<Record<string, Rule>>;
|
|
41
|
+
}
|
|
42
|
+
interface WismConfig {
|
|
43
|
+
readonly plugins?: Readonly<Record<string, Plugin>>;
|
|
44
|
+
readonly rules?: Readonly<Record<string, RuleEntry>>;
|
|
45
|
+
readonly ignores?: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
interface Diagnostic {
|
|
48
|
+
readonly path: string;
|
|
49
|
+
readonly line: number;
|
|
50
|
+
readonly column: number;
|
|
51
|
+
readonly rule: string;
|
|
52
|
+
readonly message: string;
|
|
53
|
+
readonly severity: Exclude<Severity, "off">;
|
|
54
|
+
}
|
|
55
|
+
export { Report as a, WismConfig as c, Severity as d, Plugin as i, RuleEntry as l, GraphEdge as n, Rule as o, ImportTarget as r, RuleContext as s, Diagnostic as t, RuleOptions as u };
|
|
56
|
+
//# sourceMappingURL=index-wGGk2Etn.d.mts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { a as Report, c as WismConfig, d as Severity, i as Plugin, l as RuleEntry, n as GraphEdge, o as Rule, r as ImportTarget, s as RuleContext, t as Diagnostic, u as RuleOptions } from "./index-wGGk2Etn.mjs";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
export declare const defineRule: (rule: Rule) => Rule;
|
|
4
|
+
export declare const definePlugin: (plugin: Plugin) => Plugin;
|
|
5
|
+
export declare const format: (diagnostic: Diagnostic) => string;
|
|
6
|
+
declare const WismError_base: Schema.Class<WismError, Schema.TaggedStruct<"WismError", {
|
|
7
|
+
readonly message: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError & {
|
|
9
|
+
readonly brand: unique symbol;
|
|
10
|
+
}>;
|
|
11
|
+
export declare class WismError extends WismError_base {}
|
|
12
|
+
interface LintInput {
|
|
13
|
+
readonly root: string;
|
|
14
|
+
readonly files: readonly string[];
|
|
15
|
+
readonly config?: WismConfig;
|
|
16
|
+
}
|
|
17
|
+
export declare const lint: (input: LintInput) => Effect.Effect<Diagnostic[], WismError, never>;
|
|
18
|
+
export declare const wismSection: (config: unknown) => WismConfig;
|
|
19
|
+
interface PathspecRequest {
|
|
20
|
+
readonly config: WismConfig;
|
|
21
|
+
readonly patterns?: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export declare const wismPathspecs: ({ config, patterns }: PathspecRequest) => readonly string[];
|
|
24
|
+
export type { Diagnostic, GraphEdge, ImportTarget, LintInput, Plugin, Report, Rule, RuleContext, RuleEntry, RuleOptions, Severity, WismConfig };
|
|
25
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as WismError, c as definePlugin, l as defineRule, o as format, r as lint, t as wismPathspecs, n as wismSection } from "./app-Cz0XYkP8.mjs";
|
package/dist/vite.d.mts
ADDED
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/logo.svg
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
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="#1E1E2E"/>
|
|
3
|
+
<g transform="rotate(-14 256 256)"><rect x="-300" y="-300" width="132" height="132" fill="#E31C79" transform="rotate(10 -234 -234)"/><rect x="-150" y="-300" width="132" height="132" fill="#30304A" transform="rotate(10 -84 -234)"/><rect x="0" y="-300" width="132" height="132" fill="#E31C79" transform="rotate(10 66 -234)"/><rect x="150" y="-300" width="132" height="132" fill="#30304A" transform="rotate(10 216 -234)"/><rect x="300" y="-300" width="132" height="132" fill="#E31C79" transform="rotate(10 366 -234)"/><rect x="450" y="-300" width="132" height="132" fill="#30304A" transform="rotate(10 516 -234)"/><rect x="600" y="-300" width="132" height="132" fill="#E31C79" transform="rotate(10 666 -234)"/><rect x="750" y="-300" width="132" height="132" fill="#30304A" transform="rotate(10 816 -234)"/><rect x="-300" y="-150" width="132" height="132" fill="#30304A" transform="rotate(10 -234 -84)"/><rect x="-150" y="-150" width="132" height="132" fill="#E31C79" transform="rotate(10 -84 -84)"/><rect x="0" y="-150" width="132" height="132" fill="#30304A" transform="rotate(10 66 -84)"/><rect x="150" y="-150" width="132" height="132" fill="#E31C79" transform="rotate(10 216 -84)"/><rect x="300" y="-150" width="132" height="132" fill="#30304A" transform="rotate(10 366 -84)"/><rect x="450" y="-150" width="132" height="132" fill="#E31C79" transform="rotate(10 516 -84)"/><rect x="600" y="-150" width="132" height="132" fill="#30304A" transform="rotate(10 666 -84)"/><rect x="750" y="-150" width="132" height="132" fill="#E31C79" transform="rotate(10 816 -84)"/><rect x="-300" y="0" width="132" height="132" fill="#E31C79" transform="rotate(10 -234 66)"/><rect x="-150" y="0" width="132" height="132" fill="#30304A" transform="rotate(10 -84 66)"/><rect x="0" y="0" width="132" height="132" fill="#E31C79" transform="rotate(10 66 66)"/><rect x="150" y="0" width="132" height="132" fill="#30304A" transform="rotate(10 216 66)"/><rect x="300" y="0" width="132" height="132" fill="#E31C79" transform="rotate(10 366 66)"/><rect x="450" y="0" width="132" height="132" fill="#30304A" transform="rotate(10 516 66)"/><rect x="600" y="0" width="132" height="132" fill="#E31C79" transform="rotate(10 666 66)"/><rect x="750" y="0" width="132" height="132" fill="#30304A" transform="rotate(10 816 66)"/><rect x="-300" y="150" width="132" height="132" fill="#30304A" transform="rotate(10 -234 216)"/><rect x="-150" y="150" width="132" height="132" fill="#E31C79" transform="rotate(10 -84 216)"/><rect x="0" y="150" width="132" height="132" fill="#30304A" transform="rotate(10 66 216)"/><rect x="150" y="150" width="132" height="132" fill="#E31C79" transform="rotate(10 216 216)"/><rect x="300" y="150" width="132" height="132" fill="#30304A" transform="rotate(10 366 216)"/><rect x="450" y="150" width="132" height="132" fill="#E31C79" transform="rotate(10 516 216)"/><rect x="600" y="150" width="132" height="132" fill="#30304A" transform="rotate(10 666 216)"/><rect x="750" y="150" width="132" height="132" fill="#E31C79" transform="rotate(10 816 216)"/><rect x="-300" y="300" width="132" height="132" fill="#E31C79" transform="rotate(10 -234 366)"/><rect x="-150" y="300" width="132" height="132" fill="#30304A" transform="rotate(10 -84 366)"/><rect x="0" y="300" width="132" height="132" fill="#E31C79" transform="rotate(10 66 366)"/><rect x="150" y="300" width="132" height="132" fill="#30304A" transform="rotate(10 216 366)"/><rect x="300" y="300" width="132" height="132" fill="#E31C79" transform="rotate(10 366 366)"/><rect x="450" y="300" width="132" height="132" fill="#30304A" transform="rotate(10 516 366)"/><rect x="600" y="300" width="132" height="132" fill="#E31C79" transform="rotate(10 666 366)"/><rect x="750" y="300" width="132" height="132" fill="#30304A" transform="rotate(10 816 366)"/><rect x="-300" y="450" width="132" height="132" fill="#30304A" transform="rotate(10 -234 516)"/><rect x="-150" y="450" width="132" height="132" fill="#E31C79" transform="rotate(10 -84 516)"/><rect x="0" y="450" width="132" height="132" fill="#30304A" transform="rotate(10 66 516)"/><rect x="150" y="450" width="132" height="132" fill="#E31C79" transform="rotate(10 216 516)"/><rect x="300" y="450" width="132" height="132" fill="#30304A" transform="rotate(10 366 516)"/><rect x="450" y="450" width="132" height="132" fill="#E31C79" transform="rotate(10 516 516)"/><rect x="600" y="450" width="132" height="132" fill="#30304A" transform="rotate(10 666 516)"/><rect x="750" y="450" width="132" height="132" fill="#E31C79" transform="rotate(10 816 516)"/><rect x="-300" y="600" width="132" height="132" fill="#E31C79" transform="rotate(10 -234 666)"/><rect x="-150" y="600" width="132" height="132" fill="#30304A" transform="rotate(10 -84 666)"/><rect x="0" y="600" width="132" height="132" fill="#E31C79" transform="rotate(10 66 666)"/><rect x="150" y="600" width="132" height="132" fill="#30304A" transform="rotate(10 216 666)"/><rect x="300" y="600" width="132" height="132" fill="#E31C79" transform="rotate(10 366 666)"/><rect x="450" y="600" width="132" height="132" fill="#30304A" transform="rotate(10 516 666)"/><rect x="600" y="600" width="132" height="132" fill="#E31C79" transform="rotate(10 666 666)"/><rect x="750" y="600" width="132" height="132" fill="#30304A" transform="rotate(10 816 666)"/><rect x="-300" y="750" width="132" height="132" fill="#30304A" transform="rotate(10 -234 816)"/><rect x="-150" y="750" width="132" height="132" fill="#E31C79" transform="rotate(10 -84 816)"/><rect x="0" y="750" width="132" height="132" fill="#30304A" transform="rotate(10 66 816)"/><rect x="150" y="750" width="132" height="132" fill="#E31C79" transform="rotate(10 216 816)"/><rect x="300" y="750" width="132" height="132" fill="#30304A" transform="rotate(10 366 816)"/><rect x="450" y="750" width="132" height="132" fill="#E31C79" transform="rotate(10 516 816)"/><rect x="600" y="750" width="132" height="132" fill="#30304A" transform="rotate(10 666 816)"/><rect x="750" y="750" width="132" height="132" fill="#E31C79" transform="rotate(10 816 816)"/></g>
|
|
4
|
+
<metadata><c2pa:manifest>AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTpiZDZmNDg4MC04MWQxLTRkMTYtOTllMi0yNGMxMzBjNzU2ZjYAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncmVkaWVudC52MwAAAAAYYzJzaPFzmrR48GZth4VDKrxIpP4AAABwY2JvcqNpZGM6Zm9ybWF0bWltYWdlL3N2Zyt4bWxqaW5zdGFuY2VJRHgseG1wOmlpZDplYTIwYjllOC03OWRmLTQ4MmMtOTZiZC03NGMzMDBkMjExOGRscmVsYXRpb25zaGlwaHBhcmVudE9mAAAB4mp1bWIAAABBanVtZGNib3IAEQAQgAAAqgA4m3ETYzJwYS5hY3Rpb25zLnYyAAAAABhjMnNouhC+W9z4C4b/VKXVDSv/7AAAAZljYm9yomdhY3Rpb25zgqJmYWN0aW9ua2MycGEub3BlbmVkanBhcmFtZXRlcnOha2luZ3JlZGllbnRzgaJj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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQFcdkDKIYEMltdWyKdNKxaUml1isCV96yTZb9MP4+An7UGtcoLXEO3ic+fH/0w5V5U2azoP4Lk9pjv+0Kj7IQpg=</c2pa:manifest></metadata></svg>
|
package/package.json
CHANGED
|
@@ -1,15 +1,82 @@
|
|
|
1
1
|
{
|
|
2
|
+
"name": "@r_masseater/wism",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A structure and dependency linter for TypeScript, Rust and Markdown, written in Rust and configured from vite.config.ts: directory kinds chosen by marker files, allowed layouts, FSD layers and import rules.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"architecture",
|
|
7
|
+
"feature-sliced-design",
|
|
8
|
+
"lint",
|
|
9
|
+
"structure",
|
|
10
|
+
"tanstack-intent",
|
|
11
|
+
"vite-plus"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/masseater/masseater.dev/tree/main/libs/wism#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/masseater/masseater.dev/issues"
|
|
16
|
+
},
|
|
2
17
|
"license": "MIT",
|
|
3
18
|
"repository": {
|
|
4
19
|
"type": "git",
|
|
5
20
|
"url": "git+https://github.com/masseater/masseater.dev.git",
|
|
6
21
|
"directory": "libs/wism"
|
|
7
22
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"url": "https://github.com/masseater/masseater.dev/issues"
|
|
23
|
+
"bin": {
|
|
24
|
+
"wism": "./dist/cli.mjs"
|
|
11
25
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
"files": [
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"dist",
|
|
29
|
+
"logo.svg",
|
|
30
|
+
"skills/lint-structure"
|
|
31
|
+
],
|
|
32
|
+
"type": "module",
|
|
33
|
+
"imports": {
|
|
34
|
+
"#/*": "./src/*"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.mts",
|
|
39
|
+
"default": "./dist/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./vite": {
|
|
42
|
+
"types": "./dist/vite.d.mts",
|
|
43
|
+
"default": "./dist/vite.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public",
|
|
49
|
+
"provenance": true
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@effect/platform-node": "4.1.4"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@masseater.dev/lint-host": "0.0.0",
|
|
56
|
+
"@r_masseater/vitest-otlp": "0.2.0",
|
|
57
|
+
"@types/node": "26.6.6",
|
|
58
|
+
"effect": "4.1.4",
|
|
59
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
|
|
60
|
+
"vite-plus": "1.7.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"effect": "^4.1.2",
|
|
64
|
+
"vite": "*",
|
|
65
|
+
"vite-plus": ">=1.5.0"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=26"
|
|
69
|
+
},
|
|
70
|
+
"native": {
|
|
71
|
+
"binary": "wism",
|
|
72
|
+
"targets": [
|
|
73
|
+
"linux-x64-gnu",
|
|
74
|
+
"win32-x64-msvc"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"optionalDependencies": {
|
|
78
|
+
"@r_masseater/wism-linux-x64-gnu": "0.2.0",
|
|
79
|
+
"@r_masseater/wism-win32-x64-msvc": "0.2.0"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {}
|
|
15
82
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-structure
|
|
3
|
+
description: >
|
|
4
|
+
Use when setting up @r_masseater/wism in vite.config.ts, writing a structure or dependency rule
|
|
5
|
+
in TypeScript with defineRule and definePlugin, reading the import graph a rule receives, or
|
|
6
|
+
running wism on a repository.
|
|
7
|
+
metadata:
|
|
8
|
+
type: core
|
|
9
|
+
library: "@r_masseater/wism"
|
|
10
|
+
library_version: 0.2.0
|
|
11
|
+
sources:
|
|
12
|
+
- src/app/index.ts
|
|
13
|
+
- src/shared/config/types.ts
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# lint-structure
|
|
17
|
+
|
|
18
|
+
wism is an engine. It reads the import graph of the files git tracks and runs the TypeScript rules
|
|
19
|
+
that plugins give it. It reports nothing on its own: add a plugin such as `@r_masseater/wism-fsd`.
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
vp add -D @r_masseater/wism @r_masseater/wism-fsd
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import "@r_masseater/wism/vite";
|
|
29
|
+
import { fsdPreset, rustCrate, skill, workspace } from "@r_masseater/wism-fsd";
|
|
30
|
+
import { defineConfig } from "vite-plus";
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
wism: {
|
|
34
|
+
...fsdPreset({ kinds: [workspace({ paths: ["apps/*", "libs/*"] }), rustCrate(), skill()] }),
|
|
35
|
+
ignores: ["**/fixtures/**"],
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run `wism` in the repository root. It checks the files git tracks, leaving out files marked
|
|
41
|
+
`linguist-vendored`, `linguist-generated` or `linguist-documentation` and the `ignores` globs. It
|
|
42
|
+
prints `path:line:column severity rule message` and exits with 1 when any error is reported.
|
|
43
|
+
|
|
44
|
+
## Rules in TypeScript
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { definePlugin, defineRule } from "@r_masseater/wism";
|
|
48
|
+
|
|
49
|
+
const noOrphans = defineRule({
|
|
50
|
+
meta: { description: "Every TypeScript file is imported by something" },
|
|
51
|
+
check: ({ files, edges, report }) => {
|
|
52
|
+
const used = new Set(edges.map((edge) => edge.target.value));
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
if (file.endsWith(".ts") && !used.has(file)) {
|
|
55
|
+
report({ path: file, message: "is never imported" });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const local = definePlugin({ rules: { "no-orphans": noOrphans } });
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Register it as `plugins: { local }` and turn it on with `"local/no-orphans": "error"`. Every rule is
|
|
65
|
+
named `plugin/rule`; a rule name without a configured plugin is an error.
|
|
66
|
+
|
|
67
|
+
A rule gets the repository `root`, every tracked file and every edge. An edge has `from`, the
|
|
68
|
+
written `specifier`, its `line` and `column`, `wildcard` for `export *`, and a `target` that is
|
|
69
|
+
either `{ type: "file", value: path }` for a resolved script import or a Markdown link, or
|
|
70
|
+
`{ type: "module", value: ["features", "sync"] }` for a Rust `crate::`, `self::` or `super::` path
|
|
71
|
+
inside its crate.
|