@r_masseater/wism 0.0.0 → 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 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,43 @@
1
+ # @r_masseater/wism
2
+
3
+ ![wism logo](logo.svg)
4
+
5
+ A structure and dependency linter for TypeScript, Rust and Markdown, written in Rust and
6
+ configured from `vite.config.ts`.
7
+
8
+ A marker file such as `package.json`, `Cargo.toml` or `SKILL.md` gives its directory a kind.
9
+ Each kind declares where files may sit and, optionally, the layers its source is split into.
10
+ wism then reads every import, `use` and Markdown link into one graph and checks it against
11
+ those layers, the way steiger checks Feature-Sliced Design.
12
+
13
+ ```ts
14
+ import { definePlugin, defineRule, fsd, skill } from "@r_masseater/wism";
15
+ import "@r_masseater/wism/vite";
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
+ export default defineConfig({
30
+ wism: {
31
+ kinds: [...fsd({ paths: ["apps/*", "libs/*"] }), skill()],
32
+ plugins: { local: definePlugin({ rules: { "no-shared-to-app": noSharedToApp } }) },
33
+ rules: { "local/no-shared-to-app": "error", "link-target": "warn" },
34
+ ignores: ["**/fixtures/**"],
35
+ },
36
+ });
37
+ ```
38
+
39
+ Run `wism` to check the files git tracks, or call `lint` from code.
40
+
41
+ ## Agent skills
42
+
43
+ The package ships TanStack Intent skills for coding agents. Load one with `vp exec intent load @r_masseater/wism#<skill>`.
@@ -0,0 +1,350 @@
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
+ // ../lint-host/src/entities/rule/model/setting.ts
10
+ const NO_OPTIONS = {};
11
+ const settingOf = (entry) => Match.value(entry).pipe(Match.when(Match.string, (severity) => ({
12
+ severity,
13
+ options: NO_OPTIONS
14
+ })), Match.orElse(([severity, options]) => ({
15
+ severity,
16
+ options: options ?? NO_OPTIONS
17
+ })));
18
+ // ../lint-host/src/shared/lib/target.ts
19
+ const abiOf = (platform) => Match.value(platform).pipe(Match.when("linux", () => "-gnu"), Match.when("win32", () => "-msvc"), Match.orElse(() => ""));
20
+ const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;
21
+ const addonFileOf = (binary) => `${binary}.${platformTarget}.node`;
22
+ // ../lint-host/src/features/build-addon/model/build.ts
23
+ const taggedError$1 = Schema.TaggedError;
24
+ var AddonBuildFailed = class extends taggedError$1()("AddonBuildFailed", { message: Schema.String }) {};
25
+ const LIBRARY = {
26
+ linux: (name) => `lib${name}.so`,
27
+ darwin: (name) => `lib${name}.dylib`,
28
+ win32: (name) => `${name}.dll`
29
+ };
30
+ const SUCCESS = 0;
31
+ const cargo = Effect.fn("cargo")(function* cargo(crate, workspace) {
32
+ const exitCode = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make("cargo", [
33
+ "build",
34
+ "--release",
35
+ "--locked",
36
+ "-p",
37
+ crate
38
+ ], {
39
+ cwd: workspace,
40
+ stdout: "inherit",
41
+ stderr: "inherit"
42
+ }));
43
+ const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });
44
+ yield* Effect.when(Effect.fail(failure), Effect.sync(() => Number(exitCode) !== SUCCESS));
45
+ });
46
+ Effect.fn("buildAddon")(function* build(options) {
47
+ const fileSystem = yield* FileSystem.FileSystem;
48
+ const path = yield* Path.Path;
49
+ const library = yield* Effect.fromOption(Record.get(LIBRARY, process.platform)).pipe(Effect.mapError(() => AddonBuildFailed.make({ message: `no native build for ${process.platform}` })));
50
+ yield* cargo(options.crate, options.workspaceDir);
51
+ const output = path.join(options.packageDir, "native");
52
+ yield* fileSystem.makeDirectory(output, { recursive: true });
53
+ const built = library(String$1.replaceAll("-", "_")(options.crate));
54
+ yield* fileSystem.copyFile(path.join(options.workspaceDir, "target", "release", built), path.join(output, addonFileOf(options.binary)));
55
+ });
56
+ // ../lint-host/src/features/load-addon/model/load.ts
57
+ const loadAddon = ({ packageName, binary, from, isAddon, failWith }) => {
58
+ const requireFrom = createRequire(from);
59
+ const loadFrom = (specifier) => Effect.try({
60
+ try: () => requireFrom(specifier),
61
+ catch: failWith(`could not load ${specifier}`)
62
+ });
63
+ return loadFrom(`${packageName}-${platformTarget}`).pipe(Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)), Effect.filterOrFail(isAddon, (found) => failWith(`no ${binary} addon for ${platformTarget}`)(found)));
64
+ };
65
+ const callAddon = ({ addon, name, files, call, failWith }) => addon.pipe(Effect.flatMap((loaded) => Effect.try({
66
+ try: () => call(loaded),
67
+ catch: failWith(`${name} could not lint`)
68
+ }).pipe(Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())))), Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }));
69
+ // ../lint-host/src/features/run-cli/model/cli.ts
70
+ const CONFIG_FILES = [
71
+ "vite.config.ts",
72
+ "vite.config.mts",
73
+ "vite.config.js",
74
+ "vite.config.mjs"
75
+ ];
76
+ const FAILED = 1;
77
+ const ARGUMENTS_START = 2;
78
+ const configOf = (cli, root) => Effect.gen(function* readConfig() {
79
+ const fileSystem = yield* FileSystem.FileSystem;
80
+ const path = yield* Path.Path;
81
+ const found = yield* pipe(CONFIG_FILES, Array.map((name) => path.join(root, name)), Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))));
82
+ const loaded = yield* Option.match(Array.head(found), {
83
+ onNone: () => Effect.succeed({}),
84
+ onSome: (file) => Effect.tryPromise({
85
+ try: () => resolveConfigFromFile(file),
86
+ catch: cli.failWith(`could not load ${file}`)
87
+ })
88
+ });
89
+ return cli.section(loaded);
90
+ }).pipe(Effect.withSpan(`${cli.name}.config`));
91
+ const trackedFiles = (root, pathspecs) => Effect.gen(function* listFiles() {
92
+ const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
93
+ "ls-files",
94
+ "-co",
95
+ "--exclude-standard",
96
+ "-z",
97
+ "--",
98
+ ...pathspecs
99
+ ], { cwd: root }));
100
+ return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
101
+ });
102
+ const requestOf = (config, patterns) => Array.match(patterns, {
103
+ onEmpty: () => ({ config }),
104
+ onNonEmpty: (given) => ({
105
+ config,
106
+ patterns: given
107
+ })
108
+ });
109
+ const hasError = (found) => pipe(found, Array.some(({ severity }) => severity === "error"));
110
+ const mainOf = (cli) => Effect.gen(function* main() {
111
+ const root = process.cwd();
112
+ const config = yield* configOf(cli, root);
113
+ const patterns = process.argv.slice(ARGUMENTS_START);
114
+ const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(Effect.withSpan(`${cli.name}.files`));
115
+ const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));
116
+ const found = yield* cli.lint({
117
+ root,
118
+ files,
119
+ projectFiles,
120
+ config
121
+ });
122
+ yield* Array.match(found, {
123
+ onEmpty: () => Effect.void,
124
+ onNonEmpty: (all) => Console.log(pipe(all, Array.map(cli.format), Array.join("\n")))
125
+ });
126
+ yield* Effect.when(Effect.sync(() => {
127
+ process.exitCode = FAILED;
128
+ }), Effect.sync(() => hasError(found)));
129
+ });
130
+ const runCli = (cli) => {
131
+ const services = Otlp.layerFromConfig({ resource: { serviceName: cli.name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(NodeServices.layer));
132
+ runMain(mainOf(cli).pipe(Effect.provide(services)));
133
+ };
134
+ const present = Function.dual(2, (value, build) => Option.match(value, {
135
+ onNone: () => ({}),
136
+ onSome: build
137
+ }));
138
+ // ../lint-host/src/shared/lib/trace.ts
139
+ const SAMPLED = "01";
140
+ const NOT_SAMPLED = "00";
141
+ const flagsOf = (sampled) => Boolean.match(sampled, {
142
+ onFalse: () => NOT_SAMPLED,
143
+ onTrue: () => SAMPLED
144
+ });
145
+ const traceparent = Effect.currentSpan.pipe(Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`), Effect.option);
146
+ const byPosition = Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.mapInput(Order.Number, (found) => found.line));
147
+ const sortByPosition = (found) => Array.sort(found, byPosition);
148
+ // src/entities/kind/model/presets.ts
149
+ const FSD_LAYERS = [
150
+ "app",
151
+ "pages",
152
+ "widgets",
153
+ "features",
154
+ "entities",
155
+ "shared"
156
+ ];
157
+ const SLICED = [
158
+ "pages",
159
+ "widgets",
160
+ "features",
161
+ "entities"
162
+ ];
163
+ const SCRIPTS = ["**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}"];
164
+ const RUST = ["**/*.rs"];
165
+ const pathsOf = ({ paths }) => present(Option.fromUndefinedOr(paths), (value) => ({ paths: value }));
166
+ const workspace = (options = {}) => ({
167
+ name: "workspace",
168
+ marker: "package.json",
169
+ ...pathsOf(options),
170
+ placements: [{
171
+ files: SCRIPTS,
172
+ allow: [
173
+ "src/**",
174
+ "bin/**",
175
+ "*.config.{ts,mts,js,mjs}",
176
+ "alchemy.*.ts",
177
+ "*.d.{ts,mts,cts}"
178
+ ],
179
+ message: "sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root."
180
+ }],
181
+ layers: {
182
+ dir: "src",
183
+ files: SCRIPTS,
184
+ order: FSD_LAYERS,
185
+ sliced: SLICED,
186
+ segmented: ["shared"],
187
+ entries: ["index.*"],
188
+ open: ["shared/lib/**", "shared/ui/**"],
189
+ cross: "@x"
190
+ }
191
+ });
192
+ const rustCrate = (options = {}) => ({
193
+ name: "crate",
194
+ marker: "Cargo.toml",
195
+ ...pathsOf(options),
196
+ placements: [{
197
+ files: RUST,
198
+ allow: [
199
+ "src/**",
200
+ "build.rs",
201
+ "benches/**",
202
+ "tests/**"
203
+ ],
204
+ message: "sits outside src/. Put every module of a crate under src/ in an FSD layer; only build.rs, benches/ and tests/ may stay outside."
205
+ }],
206
+ layers: {
207
+ dir: "src",
208
+ files: RUST,
209
+ order: FSD_LAYERS,
210
+ sliced: SLICED,
211
+ segmented: ["shared"],
212
+ loose: [
213
+ "lib.rs",
214
+ "main.rs",
215
+ "bin/**"
216
+ ],
217
+ moduleFiles: true
218
+ }
219
+ });
220
+ const skill = (options = {}) => ({
221
+ name: "skill",
222
+ marker: "SKILL.md",
223
+ ...pathsOf(options),
224
+ placements: [{
225
+ files: ["**"],
226
+ allow: [
227
+ "SKILL.md",
228
+ "usecases/**",
229
+ "references/**",
230
+ "scripts/**",
231
+ "assets/**"
232
+ ],
233
+ message: "is not part of an Agent Skill's layout. A skill holds SKILL.md, usecases/, references/, scripts/ and assets/."
234
+ }]
235
+ });
236
+ const fsd = (options = {}) => [workspace(options), rustCrate(options)];
237
+ // src/entities/rule/model/define.ts
238
+ const defineRule = (rule) => rule;
239
+ const definePlugin = (plugin) => plugin;
240
+ // src/entities/rule/model/resolve.ts
241
+ const SEPARATOR = "/";
242
+ const NAME_START = 1;
243
+ const isPluginRule = (id) => String$1.includes(SEPARATOR)(id);
244
+ const pluginOf = (id) => Array.headNonEmpty(String$1.split(id, SEPARATOR));
245
+ const nameOf = (id) => pipe(String$1.split(id, SEPARATOR), Array.drop(NAME_START), Array.join(SEPARATOR));
246
+ const scriptOf = (plugins) => ([id, entry]) => pipe(Record.get(plugins, pluginOf(id)), Option.flatMap((plugin) => Record.get(plugin.rules ?? {}, nameOf(id))), Option.map((rule) => ({
247
+ id,
248
+ rule,
249
+ setting: settingOf(entry)
250
+ })), Option.filter(({ setting }) => setting.severity !== "off"));
251
+ const resolve = (config) => {
252
+ const entries = Record.toEntries(config.rules ?? {});
253
+ const builtin = pipe(entries, Array.filter(([id]) => !isPluginRule(id)));
254
+ const plugged = pipe(entries, Array.filter(([id]) => isPluginRule(id)));
255
+ return {
256
+ builtin: pipe(builtin, Array.map(([id, entry]) => [id, settingOf(entry).severity]), Record.fromEntries),
257
+ scripts: pipe(plugged, Array.map(scriptOf(config.plugins ?? {})), Array.getSomes)
258
+ };
259
+ };
260
+ const unknownPlugins = (config) => pipe(Record.keys(config.rules ?? {}), Array.filter(isPluginRule), Array.map(pluginOf), Array.filter((plugin) => !Record.has(config.plugins ?? {}, plugin)), Array.dedupe);
261
+ // src/app/format.ts
262
+ const format = (diagnostic) => `${diagnostic.path}:${String(diagnostic.line)}:${String(diagnostic.column)} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}`;
263
+ // src/features/run-rules/model/run.ts
264
+ const FIRST = 1;
265
+ const severityOf = (rule) => Match.value(rule.setting.severity).pipe(Match.when("warn", () => "warn"), Match.orElse(() => "error"));
266
+ const diagnosticOf = (rule) => (report) => ({
267
+ path: report.path,
268
+ line: Option.getOrElse(Option.fromNullishOr(report.line), () => FIRST),
269
+ column: Option.getOrElse(Option.fromNullishOr(report.column), () => FIRST),
270
+ rule: rule.id,
271
+ message: report.message,
272
+ severity: severityOf(rule)
273
+ });
274
+ const runOne = (graph) => (rule) => {
275
+ const reports = [];
276
+ rule.rule.check({
277
+ ...graph,
278
+ options: rule.setting.options,
279
+ report: (report) => {
280
+ reports.push(report);
281
+ }
282
+ });
283
+ return pipe(reports, Array.map(diagnosticOf(rule)));
284
+ };
285
+ const runScriptRules = (rules) => (graph) => pipe(rules, Array.flatMap(runOne(graph)));
286
+ // src/shared/lib/errors.ts
287
+ const taggedError = Schema.TaggedError;
288
+ var WismError = class extends taggedError()("WismError", { message: Schema.String }) {};
289
+ const failedWith = (message) => (cause) => WismError.make({ message: `${message}: ${String(cause)}` });
290
+ // src/shared/native/index.ts
291
+ const isNative = (value) => Predicate.hasProperty(value, "lint") && Predicate.isFunction(value.lint) && Predicate.hasProperty(value, "flushTelemetry") && Predicate.isFunction(value.flushTelemetry);
292
+ const native = loadAddon({
293
+ packageName: "@r_masseater/wism",
294
+ binary: "wism",
295
+ from: import.meta.url,
296
+ isAddon: isNative,
297
+ failWith: failedWith
298
+ });
299
+ // src/app/lint.ts
300
+ const checkPlugins = (config) => Array.match(unknownPlugins(config), {
301
+ onEmpty: () => Effect.void,
302
+ onNonEmpty: (names) => Effect.fail(WismError.make({ message: `rules name plugins that are not configured: ${Array.join(names, ", ")}` }))
303
+ });
304
+ const lint = Effect.fn("wism.lint")(function* lint(input) {
305
+ const config = input.config ?? {};
306
+ yield* checkPlugins(config);
307
+ const resolved = resolve(config);
308
+ const parent = yield* traceparent;
309
+ const keepGraph = Array.isReadonlyArrayNonEmpty(resolved.scripts);
310
+ const options = {
311
+ config: {
312
+ kinds: config.kinds ?? [],
313
+ rules: resolved.builtin
314
+ },
315
+ keepGraph,
316
+ ...present(parent, (value) => ({ traceparent: value }))
317
+ };
318
+ const report = yield* callAddon({
319
+ addon: native,
320
+ name: "wism",
321
+ files: input.files.length,
322
+ call: (addon) => addon.lint(input.root, input.files, options),
323
+ failWith: failedWith
324
+ });
325
+ const scripted = runScriptRules(resolved.scripts)({
326
+ files: input.files,
327
+ nodes: report.nodes ?? [],
328
+ edges: report.edges ?? []
329
+ });
330
+ return sortByPosition([...report.diagnostics, ...scripted]);
331
+ });
332
+ // src/app/section.ts
333
+ const UNOWNED = [
334
+ ":(exclude,attr:linguist-vendored)",
335
+ ":(exclude,attr:linguist-generated)",
336
+ ":(exclude,attr:linguist-documentation)"
337
+ ];
338
+ const hasSection = (value) => Predicate.hasProperty(value, "wism") && Predicate.isObject(value.wism);
339
+ const wismSection = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => value.wism), Option.getOrElse(() => ({})));
340
+ const wismPathspecs = ({ config, patterns = [] }) => [
341
+ ...Array.match(patterns, {
342
+ onEmpty: () => ["."],
343
+ onNonEmpty: (given) => given
344
+ }),
345
+ ...UNOWNED,
346
+ ...pipe(config.ignores ?? [], Array.map((glob) => `:(glob,exclude)${glob}`))
347
+ ];
348
+ export { failedWith as a, defineRule as c, rustCrate as d, skill as f, WismError as i, FSD_LAYERS as l, runCli as m, wismSection as n, format as o, workspace as p, lint as r, definePlugin as s, wismPathspecs as t, fsd as u };
349
+
350
+ //# sourceMappingURL=app-DhY6I-dr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-DhY6I-dr.mjs","names":["taggedError","Rec","Str","Arr","Str","Fn","Bool","Arr","Str","Arr","Rec","Arr","Arr","Arr"],"sources":["../../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/kind/model/presets.ts","../src/entities/rule/model/define.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/index.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["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 { present } from \"@masseater.dev/lint-host\";\nimport { Option } from \"effect\";\n\nimport type { Kind } from \"#/shared/config/index.ts\";\n\nexport const FSD_LAYERS: readonly string[] = [\n \"app\",\n \"pages\",\n \"widgets\",\n \"features\",\n \"entities\",\n \"shared\",\n];\n\nconst SLICED: readonly string[] = [\"pages\", \"widgets\", \"features\", \"entities\"];\nconst SCRIPTS: readonly string[] = [\"**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}\"];\nconst RUST: readonly string[] = [\"**/*.rs\"];\n\nexport interface PresetOptions {\n readonly paths?: readonly string[];\n}\n\nconst pathsOf = ({ paths }: PresetOptions): Pick<Kind, \"paths\"> =>\n present(Option.fromUndefinedOr(paths), (value) => ({ paths: value }));\n\nexport const workspace = (options: PresetOptions = {}): Kind => ({\n name: \"workspace\",\n marker: \"package.json\",\n ...pathsOf(options),\n placements: [\n {\n files: SCRIPTS,\n allow: [\"src/**\", \"bin/**\", \"*.config.{ts,mts,js,mjs}\", \"alchemy.*.ts\", \"*.d.{ts,mts,cts}\"],\n message:\n \"sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root.\",\n },\n ],\n layers: {\n dir: \"src\",\n files: SCRIPTS,\n order: FSD_LAYERS,\n sliced: SLICED,\n segmented: [\"shared\"],\n entries: [\"index.*\"],\n open: [\"shared/lib/**\", \"shared/ui/**\"],\n cross: \"@x\",\n },\n});\n\nexport const rustCrate = (options: PresetOptions = {}): Kind => ({\n name: \"crate\",\n marker: \"Cargo.toml\",\n ...pathsOf(options),\n placements: [\n {\n files: RUST,\n allow: [\"src/**\", \"build.rs\", \"benches/**\", \"tests/**\"],\n message:\n \"sits outside src/. Put every module of a crate under src/ in an FSD layer; only build.rs, benches/ and tests/ may stay outside.\",\n },\n ],\n layers: {\n dir: \"src\",\n files: RUST,\n order: FSD_LAYERS,\n sliced: SLICED,\n segmented: [\"shared\"],\n loose: [\"lib.rs\", \"main.rs\", \"bin/**\"],\n moduleFiles: true,\n },\n});\n\nexport const skill = (options: PresetOptions = {}): Kind => ({\n name: \"skill\",\n marker: \"SKILL.md\",\n ...pathsOf(options),\n placements: [\n {\n files: [\"**\"],\n allow: [\"SKILL.md\", \"usecases/**\", \"references/**\", \"scripts/**\", \"assets/**\"],\n message:\n \"is not part of an Agent Skill's layout. A skill holds SKILL.md, usecases/, references/, scripts/ and assets/.\",\n },\n ],\n});\n\nexport const fsd = (options: PresetOptions = {}): readonly Kind[] => [\n workspace(options),\n rustCrate(options),\n];\n","import type { Plugin, Rule } from \"#/shared/config/index.ts\";\n\nexport const defineRule = (rule: Rule): Rule => rule;\n\nexport const definePlugin = (plugin: Plugin): Plugin => plugin;\n","import { 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, Severity, 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\nexport interface Resolved {\n readonly builtin: Readonly<Record<string, Severity>>;\n readonly scripts: readonly ScriptRule[];\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): Resolved => {\n const entries = Rec.toEntries(config.rules ?? {});\n const builtin = pipe(\n entries,\n Arr.filter(([id]) => !isPluginRule(id)),\n );\n const plugged = pipe(\n entries,\n Arr.filter(([id]) => isPluginRule(id)),\n );\n return {\n builtin: pipe(\n builtin,\n Arr.map(([id, entry]) => [id, settingOf(entry).severity] as const),\n Rec.fromEntries,\n ),\n scripts: pipe(plugged, Arr.map(scriptOf(config.plugins ?? {})), Arr.getSomes),\n };\n};\n\nexport const unknownPlugins = (config: WismConfig): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.filter(isPluginRule),\n Arr.map(pluginOf),\n Arr.filter((plugin) => !Rec.has(config.plugins ?? {}, plugin)),\n Arr.dedupe,\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, GraphNode, Report } from \"#/shared/config/index.ts\";\n\nconst FIRST = 1;\n\nexport interface Graph {\n readonly files: readonly string[];\n readonly nodes: readonly GraphNode[];\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 { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { Diagnostic, GraphEdge, GraphNode, Kind, Severity } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { WismError } from \"#/shared/lib/errors.ts\";\n\nexport interface NativeOptions {\n readonly config: {\n readonly kinds: readonly Kind[];\n readonly rules: Readonly<Record<string, Severity>>;\n };\n readonly keepGraph?: boolean;\n readonly traceparent?: string;\n}\n\nexport interface NativeReport {\n readonly diagnostics: readonly Diagnostic[];\n readonly nodes?: readonly GraphNode[];\n readonly edges?: readonly GraphEdge[];\n}\n\nexport interface Native {\n readonly lint: (root: string, files: readonly string[], options: NativeOptions) => NativeReport;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"lint\") &&\n Predicate.isFunction(value.lint) &&\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});\n","import { callAddon, present, sortByPosition, traceparent } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect } from \"effect\";\n\nimport { resolve, unknownPlugins } 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 { 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 checkPlugins = (config: WismConfig): Effect.Effect<void, WismError> =>\n Arr.match(unknownPlugins(config), {\n onEmpty: () => Effect.void,\n onNonEmpty: (names) =>\n Effect.fail(\n WismError.make({\n message: `rules name plugins that are not configured: ${Arr.join(names, \", \")}`,\n }),\n ),\n });\n\nexport const lint = Effect.fn(\"wism.lint\")(function* lint(input: LintInput) {\n const config = input.config ?? {};\n yield* checkPlugins(config);\n const resolved = resolve(config);\n const parent = yield* traceparent;\n const keepGraph = Arr.isReadonlyArrayNonEmpty(resolved.scripts);\n const options: NativeOptions = {\n config: { kinds: config.kinds ?? [], rules: resolved.builtin },\n keepGraph,\n ...present(parent, (value) => ({ traceparent: value })),\n };\n const report = yield* callAddon({\n addon: native,\n name: \"wism\",\n files: input.files.length,\n call: (addon) => addon.lint(input.root, input.files, options),\n failWith: failedWith,\n });\n const scripted = runScriptRules(resolved.scripts)({\n files: input.files,\n nodes: report.nodes ?? [],\n edges: report.edges ?? [],\n });\n return sortByPosition<Diagnostic>([...report.diagnostics, ...scripted]);\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, { onEmpty: () => [\".\"], onNonEmpty: (given) => given }),\n ...UNOWNED,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n];\n"],"mappings":";;;;;;;;;AAaA,MAAM,aAA0B,CAAC;AAEjC,MAAa,aAAa,UACxB,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,MAAM,SAAS,cAAuB;CAAE;CAAU,SAAS;AAAW,EAAE,GACnF,MAAM,QAAQ,CAAC,UAAU,cAAuB;CAC9C;CACA,SAAS,WAAW;AACtB,EAAE,CACJ;;ACpBF,MAAM,SAAS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;CACD,MAAM,WAAW,eAAe,SAAS,OAAO,CAAC,CAAC;EAChD,OAAO,MAAM;EACb,OAAO,OAAO,SAAS,CAAC;EACxB,OAAO,OAAO,SAAS,CAAC;CAC1B,CAAC;CACD,OAAO,eAA2B,CAAC,GAAG,OAAO,aAAa,GAAG,QAAQ,CAAC;AACxE,CAAC;;AC/CD,MAAM,UAA6B;CACjC;CACA;CACA;AACF;AAEA,MAAM,cAAc,UAClB,UAAU,YAAY,OAAO,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, m as runCli$1, n as wismSection, o as format, r as lint, t as wismPathspecs } from "./app-DhY6I-dr.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
@@ -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,88 @@
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
+ interface Placement {
6
+ readonly files: readonly string[];
7
+ readonly allow: readonly string[];
8
+ readonly message?: string;
9
+ }
10
+ interface Layers {
11
+ readonly dir: string;
12
+ readonly files: readonly string[];
13
+ readonly order: readonly string[];
14
+ readonly sliced?: readonly string[];
15
+ readonly segmented?: readonly string[];
16
+ readonly loose?: readonly string[];
17
+ readonly entries?: readonly string[];
18
+ readonly open?: readonly string[];
19
+ readonly moduleFiles?: boolean;
20
+ readonly cross?: string;
21
+ }
22
+ interface Kind {
23
+ readonly name: string;
24
+ readonly marker: string;
25
+ readonly paths?: readonly string[];
26
+ readonly placements?: readonly Placement[];
27
+ readonly layers?: Layers;
28
+ }
29
+ interface GraphNode {
30
+ readonly path: string;
31
+ readonly kind: string;
32
+ readonly dir: string;
33
+ readonly layer: string | null;
34
+ readonly slice: string | null;
35
+ }
36
+ type ImportTarget = {
37
+ readonly type: "file";
38
+ readonly value: string;
39
+ } | {
40
+ readonly type: "module";
41
+ readonly value: readonly string[];
42
+ };
43
+ interface GraphEdge {
44
+ readonly from: string;
45
+ readonly specifier: string;
46
+ readonly target: ImportTarget;
47
+ readonly line: number;
48
+ readonly column: number;
49
+ readonly wildcard: boolean;
50
+ }
51
+ interface Report {
52
+ readonly message: string;
53
+ readonly path: string;
54
+ readonly line?: number;
55
+ readonly column?: number;
56
+ }
57
+ interface RuleContext {
58
+ readonly files: readonly string[];
59
+ readonly nodes: readonly GraphNode[];
60
+ readonly edges: readonly GraphEdge[];
61
+ readonly options: RuleOptions;
62
+ readonly report: (report: Report) => void;
63
+ }
64
+ interface Rule {
65
+ readonly meta: {
66
+ readonly description: string;
67
+ };
68
+ readonly check: (context: RuleContext) => void;
69
+ }
70
+ interface Plugin {
71
+ readonly rules?: Readonly<Record<string, Rule>>;
72
+ }
73
+ interface WismConfig {
74
+ readonly kinds?: readonly Kind[];
75
+ readonly plugins?: Readonly<Record<string, Plugin>>;
76
+ readonly rules?: Readonly<Record<string, RuleEntry>>;
77
+ readonly ignores?: readonly string[];
78
+ }
79
+ interface Diagnostic {
80
+ readonly path: string;
81
+ readonly line: number;
82
+ readonly column: number;
83
+ readonly rule: string;
84
+ readonly message: string;
85
+ readonly severity: Exclude<Severity, "off">;
86
+ }
87
+ export { Kind as a, Plugin as c, RuleContext as d, WismConfig as f, Severity as h, ImportTarget as i, Report as l, RuleOptions as m, GraphEdge as n, Layers as o, RuleEntry as p, GraphNode as r, Placement as s, Diagnostic as t, Rule as u };
88
+ //# sourceMappingURL=index-D-NgzYu4.d.mts.map
@@ -0,0 +1,33 @@
1
+ import { a as Kind, c as Plugin, d as RuleContext, f as WismConfig, h as Severity, i as ImportTarget, l as Report, m as RuleOptions, n as GraphEdge, o as Layers, p as RuleEntry, r as GraphNode, s as Placement, t as Diagnostic, u as Rule } from "./index-D-NgzYu4.mjs";
2
+ import { Effect, Schema } from "effect";
3
+ export declare const FSD_LAYERS: readonly string[];
4
+ interface PresetOptions {
5
+ readonly paths?: readonly string[];
6
+ }
7
+ export declare const workspace: (options?: PresetOptions) => Kind;
8
+ export declare const rustCrate: (options?: PresetOptions) => Kind;
9
+ export declare const skill: (options?: PresetOptions) => Kind;
10
+ export declare const fsd: (options?: PresetOptions) => readonly Kind[];
11
+ export declare const defineRule: (rule: Rule) => Rule;
12
+ export declare const definePlugin: (plugin: Plugin) => Plugin;
13
+ export declare const format: (diagnostic: Diagnostic) => string;
14
+ declare const WismError_base: Schema.Class<WismError, Schema.TaggedStruct<"WismError", {
15
+ readonly message: Schema.String;
16
+ }>, import("effect/Cause").YieldableError & {
17
+ readonly brand: unique symbol;
18
+ }>;
19
+ export declare class WismError extends WismError_base {}
20
+ interface LintInput {
21
+ readonly root: string;
22
+ readonly files: readonly string[];
23
+ readonly config?: WismConfig;
24
+ }
25
+ export declare const lint: (input: LintInput) => Effect.Effect<Diagnostic[], WismError, never>;
26
+ export declare const wismSection: (config: unknown) => WismConfig;
27
+ interface PathspecRequest {
28
+ readonly config: WismConfig;
29
+ readonly patterns?: readonly string[];
30
+ }
31
+ export declare const wismPathspecs: ({ config, patterns }: PathspecRequest) => readonly string[];
32
+ export type { Diagnostic, GraphEdge, GraphNode, ImportTarget, Kind, Layers, LintInput, Placement, Plugin, PresetOptions, Report, Rule, RuleContext, RuleEntry, RuleOptions, Severity, WismConfig };
33
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { l as FSD_LAYERS, i as WismError, s as definePlugin, c as defineRule, o as format, u as fsd, r as lint, d as rustCrate, f as skill, t as wismPathspecs, n as wismSection, p as workspace } from "./app-DhY6I-dr.mjs";
@@ -0,0 +1,7 @@
1
+ import { f as WismConfig } from "./index-D-NgzYu4.mjs";
2
+ declare module "vite" {
3
+ interface UserConfig {
4
+ readonly wism?: WismConfig;
5
+ }
6
+ }
7
+ //# sourceMappingURL=vite.d.mts.map
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>AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTpiZDZmNDg4MC04MWQxLTRkMTYtOTllMi0yNGMxMzBjNzU2ZjYAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRj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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQFcdkDKIYEMltdWyKdNKxaUml1isCV96yTZb9MP4+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.1.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
- "homepage": "https://github.com/masseater/masseater.dev/tree/main/libs/wism#readme",
9
- "bugs": {
10
- "url": "https://github.com/masseater/masseater.dev/issues"
23
+ "bin": {
24
+ "wism": "./dist/cli.mjs"
11
25
  },
12
- "name": "@r_masseater/wism",
13
- "version": "0.0.0",
14
- "description": "Reserves the name until the first release from CI."
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.1.0",
79
+ "@r_masseater/wism-win32-x64-msvc": "0.1.0"
80
+ },
81
+ "scripts": {}
15
82
  }
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: lint-structure
3
+ description: >
4
+ Use when setting up @r_masseater/wism in vite.config.ts, declaring directory kinds with marker
5
+ files, laying out TypeScript workspaces or Rust crates in FSD layers, writing a structure rule in
6
+ TypeScript with defineRule, or fixing what wism reports.
7
+ metadata:
8
+ type: core
9
+ library: "@r_masseater/wism"
10
+ library_version: 0.1.0
11
+ sources:
12
+ - src/app/index.ts
13
+ - src/shared/config/types.ts
14
+ - src/entities/kind/model/presets.ts
15
+ ---
16
+
17
+ # lint-structure
18
+
19
+ wism checks where files sit and what they import. A marker file gives its directory a kind, and
20
+ the kind says which paths may hold files and how its source is layered.
21
+
22
+ ## Setup
23
+
24
+ ```sh
25
+ vp add -D @r_masseater/wism
26
+ ```
27
+
28
+ ```ts
29
+ import { rustCrate, skill, workspace } from "@r_masseater/wism";
30
+ import "@r_masseater/wism/vite";
31
+ import { defineConfig } from "vite-plus";
32
+
33
+ export default defineConfig({
34
+ wism: {
35
+ kinds: [workspace({ paths: ["apps/*", "libs/*"] }), rustCrate(), skill()],
36
+ ignores: ["**/fixtures/**"],
37
+ },
38
+ });
39
+ ```
40
+
41
+ Run `wism` in the repository root. It checks the files git tracks, leaving out files marked
42
+ `linguist-vendored`, `linguist-generated` or `linguist-documentation` and the `ignores` globs. It
43
+ prints `path:line:column severity rule message` and exits with 1 when any error is reported.
44
+
45
+ ## Kinds
46
+
47
+ A kind has a `name`, a `marker` file and optional `paths` globs that the marker's directory must
48
+ match. A file belongs to the innermost directory that holds a marker.
49
+
50
+ - `placements` list which files (`files`) may sit where (`allow`). A file outside them is a
51
+ `placement` error.
52
+ - `layers` split `dir` into the ordered layers `order`. `sliced` layers hold slices, `segmented`
53
+ layers hold segments, `entries` are a slice's public API, `open` globs may be imported directly,
54
+ `cross` names the folder for cross-imports such as `@x`, and `moduleFiles` lets Rust use
55
+ `features.rs` next to `features/`.
56
+
57
+ The presets `workspace`, `rustCrate` and `skill` cover package.json workspaces in FSD, Cargo crates
58
+ in FSD and the Agent Skill layout. `fsd` returns the first two.
59
+
60
+ ## Built-in rules
61
+
62
+ `placement`, `loose-file`, `layer-name`, `layer-import`, `cross-slice`, `public-api`,
63
+ `wildcard-export` and `link-target` are on as errors unless `rules` says otherwise.
64
+
65
+ - Move a module down a layer or into its own slice when `layer-import` or `cross-slice` fires.
66
+ - Import a slice through its `index.*` when `public-api` fires.
67
+ - Track the linked file or fix the path when `link-target` fires.
68
+
69
+ ## Rules in TypeScript
70
+
71
+ ```ts
72
+ import { definePlugin, defineRule } from "@r_masseater/wism";
73
+
74
+ const noOrphans = defineRule({
75
+ meta: { description: "Every slice is imported by something" },
76
+ check: ({ nodes, edges, report }) => {
77
+ const used = new Set(edges.map((edge) => edge.target.value));
78
+ for (const node of nodes) {
79
+ if (node.slice !== null && !used.has(node.path)) {
80
+ report({ path: node.path, message: "is never imported" });
81
+ }
82
+ }
83
+ },
84
+ });
85
+
86
+ export const local = definePlugin({ rules: { "no-orphans": noOrphans } });
87
+ ```
88
+
89
+ Register it as `plugins: { local }` and turn it on with `"local/no-orphans": "error"`. A rule gets
90
+ every file, a node per file with its kind, layer and slice, and every import edge.