@r_masseater/wism 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  ![wism logo](logo.svg)
4
4
 
5
- A structure and dependency linter for TypeScript, Rust and Markdown, written in Rust and
6
- configured from `vite.config.ts`.
5
+ The engine of a structure and dependency linter for TypeScript, Rust and Markdown, configured from
6
+ `vite.config.ts`.
7
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.
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.
12
11
 
13
12
  ```ts
14
- import { definePlugin, defineRule, fsd, skill } from "@r_masseater/wism";
15
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
16
  import { defineConfig } from "vite-plus";
17
17
 
18
18
  const noSharedToApp = defineRule({
@@ -26,11 +26,16 @@ const noSharedToApp = defineRule({
26
26
  },
27
27
  });
28
28
 
29
+ const structure = fsdPreset({ kinds: [workspace({ paths: ["libs/*"] }), skill()] });
30
+
29
31
  export default defineConfig({
30
32
  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" },
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" },
34
39
  ignores: ["**/fixtures/**"],
35
40
  },
36
41
  });
@@ -6,6 +6,9 @@ import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
6
  import { FetchHttpClient } from "effect/http";
7
7
  import { Otlp, OtlpSerialization } from "effect/observability";
8
8
  import { resolveConfigFromFile } from "vite-plus";
9
+ // src/entities/rule/model/define.ts
10
+ const defineRule = (rule) => rule;
11
+ const definePlugin = (plugin) => plugin;
9
12
  // ../lint-host/src/entities/rule/model/setting.ts
10
13
  const NO_OPTIONS = {};
11
14
  const settingOf = (entry) => Match.value(entry).pipe(Match.when(Match.string, (severity) => ({
@@ -145,98 +148,6 @@ const flagsOf = (sampled) => Boolean.match(sampled, {
145
148
  const traceparent = Effect.currentSpan.pipe(Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`), Effect.option);
146
149
  const byPosition = Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.mapInput(Order.Number, (found) => found.line));
147
150
  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
151
  // src/entities/rule/model/resolve.ts
241
152
  const SEPARATOR = "/";
242
153
  const NAME_START = 1;
@@ -248,16 +159,11 @@ const scriptOf = (plugins) => ([id, entry]) => pipe(Record.get(plugins, pluginOf
248
159
  rule,
249
160
  setting: settingOf(entry)
250
161
  })), 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
- };
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)));
259
166
  };
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
167
  // src/app/format.ts
262
168
  const format = (diagnostic) => `${diagnostic.path}:${String(diagnostic.line)}:${String(diagnostic.column)} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}`;
263
169
  // src/features/run-rules/model/run.ts
@@ -287,8 +193,68 @@ const runScriptRules = (rules) => (graph) => pipe(rules, Array.flatMap(runOne(gr
287
193
  const taggedError = Schema.TaggedError;
288
194
  var WismError = class extends taggedError()("WismError", { message: Schema.String }) {};
289
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
+ };
290
256
  // 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);
257
+ const isNative = (value) => Predicate.hasProperty(value, "collect") && Predicate.isFunction(value.collect) && Predicate.hasProperty(value, "flushTelemetry") && Predicate.isFunction(value.flushTelemetry);
292
258
  const native = loadAddon({
293
259
  packageName: "@r_masseater/wism",
294
260
  binary: "wism",
@@ -297,37 +263,34 @@ const native = loadAddon({
297
263
  failWith: failedWith
298
264
  });
299
265
  // src/app/lint.ts
300
- const checkPlugins = (config) => Array.match(unknownPlugins(config), {
266
+ const checkRules = (config) => Array.match(unknownRules(config), {
301
267
  onEmpty: () => Effect.void,
302
- onNonEmpty: (names) => Effect.fail(WismError.make({ message: `rules name plugins that are not configured: ${Array.join(names, ", ")}` }))
268
+ onNonEmpty: (names) => Effect.fail(WismError.make({ message: `rules that no configured plugin defines: ${Array.join(names, ", ")}. Name each rule plugin/rule.` }))
303
269
  });
304
- const lint = Effect.fn("wism.lint")(function* lint(input) {
305
- const config = input.config ?? {};
306
- yield* checkPlugins(config);
307
- const resolved = resolve(config);
270
+ const collectEdges = Effect.fn("wism.collect_edges")(function* collectEdges(input) {
308
271
  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({
272
+ const options = present(parent, (value) => ({ traceparent: value }));
273
+ const words = yield* callAddon({
319
274
  addon: native,
320
275
  name: "wism",
321
276
  files: input.files.length,
322
- call: (addon) => addon.lint(input.root, input.files, options),
277
+ call: (addon) => addon.collect(input.root, input.files, options),
323
278
  failWith: failedWith
324
279
  });
325
- const scripted = runScriptRules(resolved.scripts)({
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,
326
290
  files: input.files,
327
- nodes: report.nodes ?? [],
328
- edges: report.edges ?? []
329
- });
330
- return sortByPosition([...report.diagnostics, ...scripted]);
291
+ edges
292
+ })).pipe(Effect.withSpan("wism.script_rules", { attributes: { "wism.edges": edges.length } }));
293
+ return sortByPosition(found);
331
294
  });
332
295
  // src/app/section.ts
333
296
  const UNOWNED = [
@@ -345,6 +308,6 @@ const wismPathspecs = ({ config, patterns = [] }) => [
345
308
  ...UNOWNED,
346
309
  ...pipe(config.ignores ?? [], Array.map((glob) => `:(glob,exclude)${glob}`))
347
310
  ];
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 };
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 };
349
312
 
350
- //# sourceMappingURL=app-DhY6I-dr.mjs.map
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, { onEmpty: () => [\".\"], onNonEmpty: (given) => given }),\n ...UNOWNED,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n];\n"],"mappings":";;;;;;;;;AAEA,MAAa,cAAc,SAAqB;AAEhD,MAAa,gBAAgB,WAA2B;;ACSxD,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,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,UAA8D;CAClE,QAAQ,SAAS,MAAM,KAAK;CAC5B,SAAS,SAAS,MAAM,KAAK;CAC7B,QAAQ,SAAS,GAAG,KAAK;AAC3B;AAEA,MAAM,UAAU;AAShB,MAAM,QAAQ,OAAO,GAAG,OAAO,CAAC,CAAC,UAAU,MAAM,OAAe,WAAmB;CAEjF,MAAM,WAAW,QAAO,OADD,oBAAoB,oBAAA,CACX,SAC9B,aAAa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,CAAC;CAC3F,OAAO,eAA2B,KAAK;AACzC,CAAC;;AClDD,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.mjs CHANGED
@@ -1,5 +1,5 @@
1
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";
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
3
  // src/app/cli.ts
4
4
  const runCli = () => {
5
5
  runCli$1({
@@ -2,37 +2,6 @@ import { Effect, Option } from "effect";
2
2
  type Severity = "off" | "warn" | "error";
3
3
  type RuleOptions = Readonly<Record<string, unknown>>;
4
4
  type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];
5
- interface 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
5
  type ImportTarget = {
37
6
  readonly type: "file";
38
7
  readonly value: string;
@@ -55,8 +24,8 @@ interface Report {
55
24
  readonly column?: number;
56
25
  }
57
26
  interface RuleContext {
27
+ readonly root: string;
58
28
  readonly files: readonly string[];
59
- readonly nodes: readonly GraphNode[];
60
29
  readonly edges: readonly GraphEdge[];
61
30
  readonly options: RuleOptions;
62
31
  readonly report: (report: Report) => void;
@@ -71,7 +40,6 @@ interface Plugin {
71
40
  readonly rules?: Readonly<Record<string, Rule>>;
72
41
  }
73
42
  interface WismConfig {
74
- readonly kinds?: readonly Kind[];
75
43
  readonly plugins?: Readonly<Record<string, Plugin>>;
76
44
  readonly rules?: Readonly<Record<string, RuleEntry>>;
77
45
  readonly ignores?: readonly string[];
@@ -84,5 +52,5 @@ interface Diagnostic {
84
52
  readonly message: string;
85
53
  readonly severity: Exclude<Severity, "off">;
86
54
  }
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
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 CHANGED
@@ -1,13 +1,5 @@
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";
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
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
3
  export declare const defineRule: (rule: Rule) => Rule;
12
4
  export declare const definePlugin: (plugin: Plugin) => Plugin;
13
5
  export declare const format: (diagnostic: Diagnostic) => string;
@@ -29,5 +21,5 @@ interface PathspecRequest {
29
21
  readonly patterns?: readonly string[];
30
22
  }
31
23
  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 };
24
+ export type { Diagnostic, GraphEdge, ImportTarget, LintInput, Plugin, Report, Rule, RuleContext, RuleEntry, RuleOptions, Severity, WismConfig };
33
25
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1 +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";
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 CHANGED
@@ -1,4 +1,4 @@
1
- import { f as WismConfig } from "./index-D-NgzYu4.mjs";
1
+ import { c as WismConfig } from "./index-wGGk2Etn.mjs";
2
2
  declare module "vite" {
3
3
  interface UserConfig {
4
4
  readonly wism?: WismConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/wism",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
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
5
  "keywords": [
6
6
  "architecture",
@@ -75,8 +75,8 @@
75
75
  ]
76
76
  },
77
77
  "optionalDependencies": {
78
- "@r_masseater/wism-linux-x64-gnu": "0.1.0",
79
- "@r_masseater/wism-win32-x64-msvc": "0.1.0"
78
+ "@r_masseater/wism-linux-x64-gnu": "0.2.0",
79
+ "@r_masseater/wism-win32-x64-msvc": "0.2.0"
80
80
  },
81
81
  "scripts": {}
82
82
  }
@@ -1,38 +1,37 @@
1
1
  ---
2
2
  name: lint-structure
3
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.
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
7
  metadata:
8
8
  type: core
9
9
  library: "@r_masseater/wism"
10
- library_version: 0.1.0
10
+ library_version: 0.2.0
11
11
  sources:
12
12
  - src/app/index.ts
13
13
  - src/shared/config/types.ts
14
- - src/entities/kind/model/presets.ts
15
14
  ---
16
15
 
17
16
  # lint-structure
18
17
 
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.
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`.
21
20
 
22
21
  ## Setup
23
22
 
24
23
  ```sh
25
- vp add -D @r_masseater/wism
24
+ vp add -D @r_masseater/wism @r_masseater/wism-fsd
26
25
  ```
27
26
 
28
27
  ```ts
29
- import { rustCrate, skill, workspace } from "@r_masseater/wism";
30
28
  import "@r_masseater/wism/vite";
29
+ import { fsdPreset, rustCrate, skill, workspace } from "@r_masseater/wism-fsd";
31
30
  import { defineConfig } from "vite-plus";
32
31
 
33
32
  export default defineConfig({
34
33
  wism: {
35
- kinds: [workspace({ paths: ["apps/*", "libs/*"] }), rustCrate(), skill()],
34
+ ...fsdPreset({ kinds: [workspace({ paths: ["apps/*", "libs/*"] }), rustCrate(), skill()] }),
36
35
  ignores: ["**/fixtures/**"],
37
36
  },
38
37
  });
@@ -42,42 +41,18 @@ Run `wism` in the repository root. It checks the files git tracks, leaving out f
42
41
  `linguist-vendored`, `linguist-generated` or `linguist-documentation` and the `ignores` globs. It
43
42
  prints `path:line:column severity rule message` and exits with 1 when any error is reported.
44
43
 
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
44
  ## Rules in TypeScript
70
45
 
71
46
  ```ts
72
47
  import { definePlugin, defineRule } from "@r_masseater/wism";
73
48
 
74
49
  const noOrphans = defineRule({
75
- meta: { description: "Every slice is imported by something" },
76
- check: ({ nodes, edges, report }) => {
50
+ meta: { description: "Every TypeScript file is imported by something" },
51
+ check: ({ files, edges, report }) => {
77
52
  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" });
53
+ for (const file of files) {
54
+ if (file.endsWith(".ts") && !used.has(file)) {
55
+ report({ path: file, message: "is never imported" });
81
56
  }
82
57
  }
83
58
  },
@@ -86,5 +61,11 @@ const noOrphans = defineRule({
86
61
  export const local = definePlugin({ rules: { "no-orphans": noOrphans } });
87
62
  ```
88
63
 
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.
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.
@@ -1 +0,0 @@
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,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,K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