@r_masseater/i68 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 +87 -0
- package/README.md +74 -1
- package/dist/cli-CWRZxhv9.mjs +15 -0
- package/dist/cli-CWRZxhv9.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +9 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index-kobZ-fSv.d.mts +45 -0
- package/dist/index.d.mts +35 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/section-DwA18QK6.mjs +376 -0
- package/dist/section-DwA18QK6.mjs.map +1 -0
- package/dist/vite.d.mts +7 -0
- package/dist/vite.mjs +1 -0
- package/package.json +72 -6
- package/skills/lint-songs/SKILL.md +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 masseater
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
@tanstack/eslint-plugin-start
|
|
26
|
+
|
|
27
|
+
MIT License
|
|
28
|
+
|
|
29
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
33
|
+
in the Software without restriction, including without limitation the rights
|
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
36
|
+
furnished to do so, subject to the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be included in all
|
|
39
|
+
copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
47
|
+
SOFTWARE.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
@typescript-eslint/utils
|
|
52
|
+
|
|
53
|
+
MIT License
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2019 typescript-eslint and other contributors
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
in the Software without restriction, including without limitation the rights
|
|
60
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
furnished to do so, subject to the following conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be included in all
|
|
65
|
+
copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
+
SOFTWARE.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
globals
|
|
78
|
+
|
|
79
|
+
MIT License
|
|
80
|
+
|
|
81
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
1
|
# @r_masseater/i68
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A linter for `.fumx` songs, configured from `vite.config.ts`.
|
|
4
|
+
|
|
5
|
+
`.fumx` writes music as text, so the habits a composer keeps can be checked like code: notes outside the key, a part above what its singer can reach, two parts clashing a semitone apart. i68 reads each song with [`@r_masseater/fumx-parser`](https://www.npmjs.com/package/@r_masseater/fumx-parser), runs rules written in TypeScript over its notes, and prints each finding with its file, line and column.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
vp add -D @r_masseater/i68 @r_masseater/i68-presets effect
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import "@r_masseater/i68/vite";
|
|
13
|
+
import { recommended } from "@r_masseater/i68-presets";
|
|
14
|
+
import { defineConfig } from "vite-plus";
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
i68: {
|
|
18
|
+
extends: [recommended({ ranges: { lead: ["A3", "E5"] } })],
|
|
19
|
+
rules: { "harmony/chord-above-melody": "off" },
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
vp exec i68 # every .fumx file git tracks
|
|
26
|
+
vp exec i68 songs/ # only these paths
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The official rules live in [`@r_masseater/i68-presets`](https://www.npmjs.com/package/@r_masseater/i68-presets), one preset per concern.
|
|
30
|
+
|
|
31
|
+
## Rules
|
|
32
|
+
|
|
33
|
+
A rule gets the song, the notes that sound (with their track role, source line and column) and its options, and reports what it finds.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { definePlugin, defineRule } from "@r_masseater/i68";
|
|
37
|
+
|
|
38
|
+
const noHighBass = defineRule({
|
|
39
|
+
meta: { description: "The bass stays at or below C3" },
|
|
40
|
+
check: (context) => {
|
|
41
|
+
for (const note of context.soundings) {
|
|
42
|
+
if (note.track === "bass" && note.midi > 48) {
|
|
43
|
+
context.report({ line: note.line, column: note.column, message: "The bass is too high" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const local = definePlugin({ rules: { "no-high-bass": noHighBass } });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Register a plugin under a name in `plugins` and its rules become `<name>/<rule>`. A rule is on as an error unless `rules` sets it to `"warn"`, `"off"` or `["warn", { ...options }]`. A later config that sets only the severity keeps the options an earlier one gave, as in ESLint. Naming a plugin or a rule that is not registered, or a rule that throws, stops the run with an error.
|
|
53
|
+
|
|
54
|
+
## Ignoring a finding
|
|
55
|
+
|
|
56
|
+
When a passage breaks a rule on purpose, say so in the file, and write why after `--`:
|
|
57
|
+
|
|
58
|
+
```fumx
|
|
59
|
+
lead: C5 1/2, F#5 1/2 // i68-ignore pop/out-of-key -- borrowed from the parallel minor
|
|
60
|
+
// i68-ignore-next-line harmony/semitone-clash
|
|
61
|
+
pad: [B4 C5] 1/1
|
|
62
|
+
// i68-disable pop/melody-leap -- the chorus jumps on purpose
|
|
63
|
+
...
|
|
64
|
+
// i68-enable pop/melody-leap
|
|
65
|
+
// i68-ignore-file classical/parallel-perfects
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Directives follow ESLint's: they start the comment, `//` or `/* */`, and separate rule names with commas. `i68-ignore` covers its own line, `i68-ignore-next-line` the line after it, and `i68-ignore-file` the whole file. `i68-disable` covers everything after it until the matching `i68-enable`, or to the end of the file. A comment without rule names covers every rule.
|
|
69
|
+
|
|
70
|
+
## Programmatic use
|
|
71
|
+
|
|
72
|
+
`lint({ root, files, read, config })` lints files through your own `read`. `lintText({ path, text, config })` lints one song held in memory, for editors and tests. Both return diagnostics with `path`, `line`, `column`, `rule`, `severity`, `message` and `detail`.
|
|
73
|
+
|
|
74
|
+
## Agent skills
|
|
75
|
+
|
|
76
|
+
The package ships TanStack Intent skills for coding agents. Load one with `vp exec intent load @r_masseater/i68#<skill>`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { c as runCli$1, n as songPathspecs, o as failedWith, r as lint, s as format, t as i68Section } from "./section-DwA18QK6.mjs";
|
|
2
|
+
// src/app/cli.ts
|
|
3
|
+
const runCli = () => {
|
|
4
|
+
runCli$1({
|
|
5
|
+
name: "i68",
|
|
6
|
+
section: i68Section,
|
|
7
|
+
pathspecs: songPathspecs,
|
|
8
|
+
lint,
|
|
9
|
+
format,
|
|
10
|
+
failWith: failedWith
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { runCli };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=cli-CWRZxhv9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-CWRZxhv9.mjs","names":[],"sources":["../src/app/cli.ts"],"sourcesContent":["import { runCli as runLinter } from \"@masseater.dev/lint-host\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { format } from \"./format.ts\";\nimport { lint } from \"./lint.ts\";\nimport { i68Section, songPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"i68\",\n section: i68Section,\n pathspecs: songPathspecs,\n lint,\n format,\n failWith: failedWith,\n });\n};\n"],"mappings":";;AAQA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACN,SAAS;EACT,WAAW;EACX;EACA;EACA,UAAU;CACZ,CAAC;AACH"}
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/cli.mjs
ADDED
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../bin/i68.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\n\nenableCompileCache();\n\nconst { runCli } = await import(\"#/app/cli.ts\");\n\nrunCli();\n"],"mappings":";;;AAGA,mBAAmB;AAEnB,MAAM,EAAE,WAAW,MAAM,OAAO;AAEhC,OAAO"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Effect, FileSystem, Option, Path } from "effect";
|
|
2
|
+
import { Song } from "@r_masseater/fumx-parser";
|
|
3
|
+
import { Sounding } from "@r_masseater/fumx-parser/analysis";
|
|
4
|
+
type Severity = "off" | "warn" | "error";
|
|
5
|
+
type RuleOptions = Readonly<Record<string, unknown>>;
|
|
6
|
+
type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];
|
|
7
|
+
interface Report {
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly line: number;
|
|
10
|
+
readonly column?: number;
|
|
11
|
+
readonly detail?: string;
|
|
12
|
+
}
|
|
13
|
+
interface RuleContext {
|
|
14
|
+
readonly filename: string;
|
|
15
|
+
readonly song: Song;
|
|
16
|
+
readonly soundings: readonly Sounding[];
|
|
17
|
+
readonly options: RuleOptions;
|
|
18
|
+
readonly report: (report: Report) => void;
|
|
19
|
+
}
|
|
20
|
+
interface Rule {
|
|
21
|
+
readonly meta: {
|
|
22
|
+
readonly description: string;
|
|
23
|
+
};
|
|
24
|
+
readonly check: (context: RuleContext) => void;
|
|
25
|
+
}
|
|
26
|
+
interface Plugin {
|
|
27
|
+
readonly rules: Readonly<Record<string, Rule>>;
|
|
28
|
+
}
|
|
29
|
+
interface I68Config {
|
|
30
|
+
readonly extends?: readonly I68Config[];
|
|
31
|
+
readonly plugins?: Readonly<Record<string, Plugin>>;
|
|
32
|
+
readonly rules?: Readonly<Record<string, RuleEntry>>;
|
|
33
|
+
readonly ignores?: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
interface Diagnostic {
|
|
36
|
+
readonly path: string;
|
|
37
|
+
readonly line: number;
|
|
38
|
+
readonly column?: number;
|
|
39
|
+
readonly rule: string;
|
|
40
|
+
readonly message: string;
|
|
41
|
+
readonly detail?: string;
|
|
42
|
+
readonly severity: Exclude<Severity, "off">;
|
|
43
|
+
}
|
|
44
|
+
export { Rule as a, RuleOptions as c, Report as i, Severity as l, I68Config as n, RuleContext as o, Plugin as r, RuleEntry as s, Diagnostic as t };
|
|
45
|
+
//# sourceMappingURL=index-kobZ-fSv.d.mts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { a as Rule, c as RuleOptions, i as Report, l as Severity, n as I68Config, o as RuleContext, r as Plugin, s as RuleEntry, t as Diagnostic } from "./index-kobZ-fSv.mjs";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import "@r_masseater/fumx-parser";
|
|
4
|
+
export declare const defineRule: (rule: Rule) => Rule;
|
|
5
|
+
export declare const definePlugin: (plugin: Plugin) => Plugin;
|
|
6
|
+
export declare const format: (diagnostic: Diagnostic) => string;
|
|
7
|
+
declare const I68Error_base: Schema.Class<I68Error, Schema.TaggedStruct<"I68Error", {
|
|
8
|
+
readonly message: Schema.String;
|
|
9
|
+
}>, import("effect/Cause").YieldableError & {
|
|
10
|
+
readonly brand: unique symbol;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class I68Error extends I68Error_base {}
|
|
13
|
+
type Read = (path: string) => Effect.Effect<string, I68Error>;
|
|
14
|
+
interface LintInput {
|
|
15
|
+
readonly root: string;
|
|
16
|
+
readonly files: readonly string[];
|
|
17
|
+
readonly read: Read;
|
|
18
|
+
readonly config?: I68Config;
|
|
19
|
+
}
|
|
20
|
+
interface TextInput {
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly text: string;
|
|
23
|
+
readonly read?: Read;
|
|
24
|
+
readonly config?: I68Config;
|
|
25
|
+
}
|
|
26
|
+
export declare const lint: (input: LintInput) => Effect.Effect<Diagnostic[], I68Error, never>;
|
|
27
|
+
export declare const lintText: (input: TextInput) => Effect.Effect<Diagnostic[], I68Error, never>;
|
|
28
|
+
export declare const i68Section: (config: unknown) => I68Config;
|
|
29
|
+
interface PathspecInput {
|
|
30
|
+
readonly config: I68Config;
|
|
31
|
+
readonly patterns?: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
export declare const songPathspecs: ({ config, patterns }: PathspecInput) => readonly string[];
|
|
34
|
+
export type { Diagnostic, I68Config, LintInput, PathspecInput, Plugin, Read, Report, Rule, RuleContext, RuleEntry, RuleOptions, Severity, TextInput };
|
|
35
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a as I68Error, i as lintText, n as songPathspecs, r as lint, s as format, t as i68Section } from "./section-DwA18QK6.mjs";
|
|
2
|
+
// src/entities/rule/model/define.ts
|
|
3
|
+
const defineRule = (rule) => rule;
|
|
4
|
+
const definePlugin = (plugin) => plugin;
|
|
5
|
+
export { I68Error, definePlugin, defineRule, format, i68Section, lint, lintText, songPathspecs };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/entities/rule/model/define.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"],"mappings":";;AAEA,MAAa,cAAc,SAAqB;AAEhD,MAAa,gBAAgB,WAA2B"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { Array, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, Schema, String as String$1, pipe } from "effect";
|
|
2
|
+
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
3
|
+
import { layer } from "@effect/platform-node/NodeServices";
|
|
4
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
5
|
+
import { FetchHttpClient } from "effect/http";
|
|
6
|
+
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
7
|
+
import { resolveConfigFromFile } from "vite-plus";
|
|
8
|
+
import { readSong } from "@r_masseater/fumx-parser";
|
|
9
|
+
import { soundingsOf } from "@r_masseater/fumx-parser/analysis";
|
|
10
|
+
// ../lint-host/src/entities/rule/model/setting.ts
|
|
11
|
+
const NO_OPTIONS = {};
|
|
12
|
+
const settingOf = (entry) => Match.value(entry).pipe(Match.when(Match.string, (severity) => ({
|
|
13
|
+
severity,
|
|
14
|
+
options: NO_OPTIONS
|
|
15
|
+
})), Match.orElse(([severity, options]) => ({
|
|
16
|
+
severity,
|
|
17
|
+
options: options ?? NO_OPTIONS
|
|
18
|
+
})));
|
|
19
|
+
const optionsOf = (entry) => Match.value(entry).pipe(Match.when(Match.string, () => Option.none()), Match.orElse(([, options]) => Option.fromUndefinedOr(options)));
|
|
20
|
+
const overridden = (earlier, later) => pipe(optionsOf(later), Option.orElse(() => optionsOf(earlier)), Option.match({
|
|
21
|
+
onNone: () => later,
|
|
22
|
+
onSome: (options) => [settingOf(later).severity, options]
|
|
23
|
+
}));
|
|
24
|
+
const mergedRules = (layers) => {
|
|
25
|
+
const merged = {};
|
|
26
|
+
for (const [name, later] of pipe(layers, Array.flatMap((layer) => Record.toEntries(layer ?? {})))) merged[name] = pipe(Record.get(merged, name), Option.match({
|
|
27
|
+
onNone: () => later,
|
|
28
|
+
onSome: (earlier) => overridden(earlier, later)
|
|
29
|
+
}));
|
|
30
|
+
return merged;
|
|
31
|
+
};
|
|
32
|
+
// ../lint-host/src/entities/rule/model/severity.ts
|
|
33
|
+
const reportedSeverity = (setting) => Match.value(setting.severity).pipe(Match.when("warn", () => "warn"), Match.orElse(() => "error"));
|
|
34
|
+
// ../lint-host/src/shared/lib/target.ts
|
|
35
|
+
const abiOf = (platform) => Match.value(platform).pipe(Match.when("linux", () => "-gnu"), Match.when("win32", () => "-msvc"), Match.orElse(() => ""));
|
|
36
|
+
const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;
|
|
37
|
+
const addonFileOf = (binary) => `${binary}.${platformTarget}.node`;
|
|
38
|
+
// ../lint-host/src/features/build-addon/model/build.ts
|
|
39
|
+
const taggedError$1 = Schema.TaggedError;
|
|
40
|
+
var AddonBuildFailed = class extends taggedError$1()("AddonBuildFailed", { message: Schema.String }) {};
|
|
41
|
+
const LIBRARY = {
|
|
42
|
+
linux: (name) => `lib${name}.so`,
|
|
43
|
+
darwin: (name) => `lib${name}.dylib`,
|
|
44
|
+
win32: (name) => `${name}.dll`
|
|
45
|
+
};
|
|
46
|
+
const SUCCESS = 0;
|
|
47
|
+
const cargo = Effect.fn("cargo")(function* cargo(crate, workspace) {
|
|
48
|
+
const exitCode = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make("cargo", [
|
|
49
|
+
"build",
|
|
50
|
+
"--release",
|
|
51
|
+
"--locked",
|
|
52
|
+
"-p",
|
|
53
|
+
crate
|
|
54
|
+
], {
|
|
55
|
+
cwd: workspace,
|
|
56
|
+
stdout: "inherit",
|
|
57
|
+
stderr: "inherit"
|
|
58
|
+
}));
|
|
59
|
+
const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });
|
|
60
|
+
yield* Effect.when(Effect.fail(failure), Effect.sync(() => Number(exitCode) !== SUCCESS));
|
|
61
|
+
});
|
|
62
|
+
Effect.fn("buildAddon")(function* build(options) {
|
|
63
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
64
|
+
const path = yield* Path.Path;
|
|
65
|
+
const library = yield* Effect.fromOption(Record.get(LIBRARY, process.platform)).pipe(Effect.mapError(() => AddonBuildFailed.make({ message: `no native build for ${process.platform}` })));
|
|
66
|
+
yield* cargo(options.crate, options.workspaceDir);
|
|
67
|
+
const output = path.join(options.packageDir, "native");
|
|
68
|
+
yield* fileSystem.makeDirectory(output, { recursive: true });
|
|
69
|
+
const built = library(String$1.replaceAll("-", "_")(options.crate));
|
|
70
|
+
yield* fileSystem.copyFile(path.join(options.workspaceDir, "target", "release", built), path.join(output, addonFileOf(options.binary)));
|
|
71
|
+
});
|
|
72
|
+
// ../lint-host/src/features/run-cli/model/cli.ts
|
|
73
|
+
const CONFIG_FILES = [
|
|
74
|
+
"vite.config.ts",
|
|
75
|
+
"vite.config.mts",
|
|
76
|
+
"vite.config.js",
|
|
77
|
+
"vite.config.mjs"
|
|
78
|
+
];
|
|
79
|
+
const FAILED = 1;
|
|
80
|
+
const DATA_FIRST_ARITY$1 = 2;
|
|
81
|
+
const ARGUMENTS_START = 2;
|
|
82
|
+
const readSectionIn = (source, root) => Effect.gen(function* readConfig() {
|
|
83
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
84
|
+
const path = yield* Path.Path;
|
|
85
|
+
const found = yield* pipe(CONFIG_FILES, Array.map((name) => path.join(root, name)), Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))));
|
|
86
|
+
const loaded = yield* Option.match(Array.head(found), {
|
|
87
|
+
onNone: () => Effect.succeed({}),
|
|
88
|
+
onSome: (file) => Effect.tryPromise({
|
|
89
|
+
try: () => resolveConfigFromFile(file),
|
|
90
|
+
catch: source.failWith(`could not load ${file}`)
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
return source.section(loaded);
|
|
94
|
+
}).pipe(Effect.withSpan(`${source.name}.config`));
|
|
95
|
+
Function.dual(DATA_FIRST_ARITY$1, readSectionIn);
|
|
96
|
+
const trackedFiles = (root, pathspecs) => Effect.gen(function* listFiles() {
|
|
97
|
+
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
98
|
+
"ls-files",
|
|
99
|
+
"-co",
|
|
100
|
+
"--exclude-standard",
|
|
101
|
+
"-z",
|
|
102
|
+
"--",
|
|
103
|
+
...pathspecs
|
|
104
|
+
], { cwd: root }));
|
|
105
|
+
return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
|
|
106
|
+
});
|
|
107
|
+
const requestOf = (config, patterns) => Array.match(patterns, {
|
|
108
|
+
onEmpty: () => ({ config }),
|
|
109
|
+
onNonEmpty: (given) => ({
|
|
110
|
+
config,
|
|
111
|
+
patterns: given
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
const hasError = (found) => pipe(found, Array.some(({ severity }) => severity === "error"));
|
|
115
|
+
const failWhen = (failed) => Effect.when(Effect.sync(() => {
|
|
116
|
+
process.exitCode = FAILED;
|
|
117
|
+
}), Effect.succeed(failed)).pipe(Effect.asVoid);
|
|
118
|
+
const printAll = (found, format) => Array.match(found, {
|
|
119
|
+
onEmpty: () => Effect.void,
|
|
120
|
+
onNonEmpty: (all) => Console.log(pipe(all, Array.map(format), Array.join("\n")))
|
|
121
|
+
});
|
|
122
|
+
const readerIn = (root, failWith) => Effect.gen(function* reader() {
|
|
123
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
124
|
+
const path = yield* Path.Path;
|
|
125
|
+
return (file) => fileSystem.readFileString(path.resolve(root, file)).pipe(Effect.mapError(failWith(`could not read ${file}`)));
|
|
126
|
+
});
|
|
127
|
+
const mainOf = (cli) => Effect.gen(function* main() {
|
|
128
|
+
const root = process.cwd();
|
|
129
|
+
const config = yield* readSectionIn(cli, root);
|
|
130
|
+
const patterns = process.argv.slice(ARGUMENTS_START);
|
|
131
|
+
const pathspecs = cli.pathspecs(requestOf(config, patterns));
|
|
132
|
+
const { files, projectFiles } = yield* Effect.all({
|
|
133
|
+
files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),
|
|
134
|
+
projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`))
|
|
135
|
+
}, { concurrency: "unbounded" });
|
|
136
|
+
const read = yield* readerIn(root, cli.failWith);
|
|
137
|
+
const found = yield* cli.lint({
|
|
138
|
+
root,
|
|
139
|
+
files,
|
|
140
|
+
projectFiles,
|
|
141
|
+
config,
|
|
142
|
+
read
|
|
143
|
+
});
|
|
144
|
+
yield* printAll(found, cli.format);
|
|
145
|
+
yield* failWhen(hasError(found));
|
|
146
|
+
});
|
|
147
|
+
const runTraced = (name, program) => {
|
|
148
|
+
const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(layer));
|
|
149
|
+
runMain(program.pipe(Effect.provide(services)));
|
|
150
|
+
};
|
|
151
|
+
const runCli = (cli) => {
|
|
152
|
+
runTraced(cli.name, mainOf(cli));
|
|
153
|
+
};
|
|
154
|
+
const present = Function.dual(2, (value, build) => Option.match(value, {
|
|
155
|
+
onNone: () => ({}),
|
|
156
|
+
onSome: build
|
|
157
|
+
}));
|
|
158
|
+
// ../lint-host/src/shared/lib/trace.ts
|
|
159
|
+
const SAMPLED = "01";
|
|
160
|
+
const NOT_SAMPLED = "00";
|
|
161
|
+
const LINE_START$1 = 0;
|
|
162
|
+
const flagsOf = (sampled) => Boolean.match(sampled, {
|
|
163
|
+
onFalse: () => NOT_SAMPLED,
|
|
164
|
+
onTrue: () => SAMPLED
|
|
165
|
+
});
|
|
166
|
+
Effect.currentSpan.pipe(Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`), Effect.option);
|
|
167
|
+
const byPosition = Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.combine(Order.mapInput(Order.Number, (found) => found.line), Order.mapInput(Order.Number, (found) => found.column ?? LINE_START$1)));
|
|
168
|
+
const sortByPosition = (found) => Array.sort(found, byPosition);
|
|
169
|
+
// ../lint-host/src/shared/lib/layers.ts
|
|
170
|
+
const mergedRecords = (records) => pipe(records, Array.flatMap((record) => Record.toEntries(record ?? {})), Record.fromEntries);
|
|
171
|
+
const layersOf = (config) => {
|
|
172
|
+
const { extends: bases = [], ...own } = config;
|
|
173
|
+
return [...pipe(bases, Array.flatMap(layersOf)), own];
|
|
174
|
+
};
|
|
175
|
+
const mergedLayers = (layers) => ({
|
|
176
|
+
plugins: mergedRecords(pipe(layers, Array.map((layer) => layer.plugins))),
|
|
177
|
+
rules: mergedRecords(pipe(layers, Array.map((layer) => layer.rules))),
|
|
178
|
+
ignores: pipe(layers, Array.flatMap((layer) => layer.ignores ?? [])),
|
|
179
|
+
overrides: pipe(layers, Array.flatMap((layer) => layer.overrides ?? []))
|
|
180
|
+
});
|
|
181
|
+
// src/entities/rule/model/extend.ts
|
|
182
|
+
const flattenConfig = (config) => {
|
|
183
|
+
const layers = layersOf(config);
|
|
184
|
+
const { plugins, ignores } = mergedLayers(layers);
|
|
185
|
+
return {
|
|
186
|
+
plugins,
|
|
187
|
+
rules: mergedRules(pipe(layers, Array.map((layer) => layer.rules))),
|
|
188
|
+
ignores
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
// src/entities/rule/model/resolve.ts
|
|
192
|
+
const SEPARATOR$1 = "/";
|
|
193
|
+
const START = 0;
|
|
194
|
+
const ENABLED = settingOf("error");
|
|
195
|
+
const idOf = (plugin, name) => `${plugin}${SEPARATOR$1}${name}`;
|
|
196
|
+
const pluginOf = (id) => pipe(String$1.indexOf(SEPARATOR$1)(id), Option.match({
|
|
197
|
+
onNone: () => id,
|
|
198
|
+
onSome: (slash) => String$1.slice(START, slash)(id)
|
|
199
|
+
}));
|
|
200
|
+
const rulesOf$2 = (config) => ([plugin, value]) => pipe(Record.toEntries(value.rules), Array.map(([name, rule]) => {
|
|
201
|
+
const id = idOf(plugin, name);
|
|
202
|
+
return {
|
|
203
|
+
id,
|
|
204
|
+
rule,
|
|
205
|
+
setting: pipe(config.rules ?? {}, Record.get(id), Option.map(settingOf), Option.getOrElse(() => ENABLED))
|
|
206
|
+
};
|
|
207
|
+
}), Array.filter(({ setting }) => setting.severity !== "off"));
|
|
208
|
+
const resolve = (config) => pipe(Record.toEntries(config.plugins ?? {}), Array.flatMap(rulesOf$2(config)));
|
|
209
|
+
const unknownPlugins = (config) => pipe(Record.keys(config.rules ?? {}), Array.map(pluginOf), Array.filter((plugin) => !Record.has(config.plugins ?? {}, plugin)), Array.dedupe);
|
|
210
|
+
const ruleNameOf = (id) => pipe(String$1.indexOf(SEPARATOR$1)(id), Option.match({
|
|
211
|
+
onNone: () => "",
|
|
212
|
+
onSome: (slash) => String$1.slice(slash + 1)(id)
|
|
213
|
+
}));
|
|
214
|
+
const isKnownRule = (config) => (id) => pipe(Record.get(config.plugins ?? {}, pluginOf(id)), Option.match({
|
|
215
|
+
onNone: () => true,
|
|
216
|
+
onSome: (plugin) => Record.has(plugin.rules, ruleNameOf(id))
|
|
217
|
+
}));
|
|
218
|
+
const unknownRules = (config) => pipe(Record.keys(config.rules ?? {}), Array.filter((id) => !isKnownRule(config)(id)));
|
|
219
|
+
// src/app/format.ts
|
|
220
|
+
const format = (diagnostic) => {
|
|
221
|
+
const column = pipe(Option.fromNullishOr(diagnostic.column), Option.match({
|
|
222
|
+
onNone: () => "",
|
|
223
|
+
onSome: (value) => `:${String(value)}`
|
|
224
|
+
}));
|
|
225
|
+
const detail = pipe([diagnostic.detail], Array.flatMap((part) => Option.toArray(Option.fromNullishOr(part))), Array.map((part) => ` [${part}]`), Array.join(""));
|
|
226
|
+
return `${diagnostic.path}:${String(diagnostic.line)}${column} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}${detail}`;
|
|
227
|
+
};
|
|
228
|
+
// src/features/read-songs/model/read.ts
|
|
229
|
+
const SEPARATOR = "/";
|
|
230
|
+
const readSongFile = Effect.fn("i68.read")(function* readSongFile(input) {
|
|
231
|
+
const path = `${input.root}${SEPARATOR}${input.file}`;
|
|
232
|
+
const source = yield* readSong({
|
|
233
|
+
path,
|
|
234
|
+
read: input.read
|
|
235
|
+
});
|
|
236
|
+
return {
|
|
237
|
+
file: input.file,
|
|
238
|
+
source
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
// src/shared/lib/errors.ts
|
|
242
|
+
const taggedError = Schema.TaggedError;
|
|
243
|
+
var I68Error = class extends taggedError()("I68Error", { message: Schema.String }) {};
|
|
244
|
+
const failedWith = (message) => (cause) => I68Error.make({ message: `${message}: ${String(cause)}` });
|
|
245
|
+
// src/features/run-rules/model/suppressions.ts
|
|
246
|
+
const DIRECTIVE = /^i68-(?<kind>ignore-next-line|ignore-file|ignore|disable|enable)(?:\s(?<rest>[\s\S]*))?$/u;
|
|
247
|
+
const REASON = /\s-{2,}(?:\s|$)/u;
|
|
248
|
+
const BLOCK_START = "/*";
|
|
249
|
+
const BLOCK_END = "*/";
|
|
250
|
+
const LIST = ",";
|
|
251
|
+
const NEXT = 1;
|
|
252
|
+
const LINE_START = 0;
|
|
253
|
+
const kindOf = (text) => Match.value(text).pipe(Match.when("ignore-file", () => "ignore-file"), Match.when("ignore-next-line", () => "ignore-next-line"), Match.when("disable", () => "disable"), Match.when("enable", () => "enable"), Match.orElse(() => "ignore"));
|
|
254
|
+
const bodyOf = (text) => {
|
|
255
|
+
if (String$1.startsWith(BLOCK_START)(text)) return pipe(text, String$1.slice(2), String$1.replace(BLOCK_END, ""), String$1.trim);
|
|
256
|
+
return pipe(text, String$1.slice(2), String$1.trim);
|
|
257
|
+
};
|
|
258
|
+
const rulesOf$1 = (rest) => pipe(String$1.split(` ${rest}`, REASON), Array.head, Option.getOrElse(() => ""), String$1.split(LIST), Array.map(String$1.trim), Array.filter(String$1.isNonEmpty));
|
|
259
|
+
const groupsOf = (text) => pipe(Option.fromNullishOr(DIRECTIVE.exec(text)), Option.flatMap((found) => Option.fromNullishOr(found.groups)));
|
|
260
|
+
const directiveOf = (comment) => pipe(groupsOf(bodyOf(comment.text)), Option.map((groups) => ({
|
|
261
|
+
line: comment.line,
|
|
262
|
+
column: comment.column,
|
|
263
|
+
kind: kindOf(groups["kind"] ?? ""),
|
|
264
|
+
rules: rulesOf$1(groups["rest"] ?? "")
|
|
265
|
+
})));
|
|
266
|
+
const names = (rule) => (directive) => !Array.isReadonlyArrayNonEmpty(directive.rules) || Array.contains(directive.rules, rule);
|
|
267
|
+
const isRange = (directive) => directive.kind === "disable" || directive.kind === "enable";
|
|
268
|
+
const coversLine = (found) => (directive) => names(found.rule)(directive) && Match.value(directive.kind).pipe(Match.when("ignore-file", () => true), Match.when("ignore-next-line", () => directive.line + NEXT === found.line), Match.when("ignore", () => directive.line === found.line), Match.orElse(() => false));
|
|
269
|
+
const isAfter = (found) => (directive) => directive.line < found.line || directive.line === found.line && directive.column <= (found.column ?? LINE_START);
|
|
270
|
+
const insideRange = (directives) => (found) => pipe(directives, Array.filter((directive) => isRange(directive) && isAfter(found)(directive) && names(found.rule)(directive)), Array.last, Option.exists((directive) => directive.kind === "disable"));
|
|
271
|
+
const suppressionsOf = (comments) => {
|
|
272
|
+
const directives = pipe(comments, Array.map(directiveOf), Array.getSomes);
|
|
273
|
+
return (found) => pipe(directives, Array.some(coversLine(found))) || insideRange(directives)(found);
|
|
274
|
+
};
|
|
275
|
+
// src/features/run-rules/model/run.ts
|
|
276
|
+
const diagnosticOf = (path, rule) => (report) => ({
|
|
277
|
+
path,
|
|
278
|
+
line: report.line,
|
|
279
|
+
rule: rule.id,
|
|
280
|
+
message: report.message,
|
|
281
|
+
severity: reportedSeverity(rule.setting),
|
|
282
|
+
...present(Option.fromNullishOr(report.column), (column) => ({ column })),
|
|
283
|
+
...present(Option.fromNullishOr(report.detail), (detail) => ({ detail }))
|
|
284
|
+
});
|
|
285
|
+
const runOne = (input, soundings) => Effect.fn("i68.rule")(function* run(rule) {
|
|
286
|
+
yield* Effect.annotateCurrentSpan({ "i68.rule": rule.id });
|
|
287
|
+
const reports = [];
|
|
288
|
+
yield* Effect.try({
|
|
289
|
+
try: () => {
|
|
290
|
+
rule.rule.check({
|
|
291
|
+
filename: input.path,
|
|
292
|
+
song: input.song,
|
|
293
|
+
soundings,
|
|
294
|
+
options: rule.setting.options,
|
|
295
|
+
report: (report) => {
|
|
296
|
+
reports.push(report);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
catch: failedWith(`${rule.id} failed`)
|
|
301
|
+
});
|
|
302
|
+
return pipe(reports, Array.map(diagnosticOf(input.path, rule)));
|
|
303
|
+
});
|
|
304
|
+
const runRules = Effect.fn("i68.rules")(function* runRules(input) {
|
|
305
|
+
const soundings = soundingsOf(input.song);
|
|
306
|
+
const suppressed = suppressionsOf(input.comments);
|
|
307
|
+
const found = yield* pipe(input.rules, Effect.forEach(runOne(input, soundings), { concurrency: 1 }));
|
|
308
|
+
return pipe(Array.flatten(found), Array.filter((diagnostic) => !suppressed(diagnostic)));
|
|
309
|
+
});
|
|
310
|
+
// src/app/lint.ts
|
|
311
|
+
const PARSE_RULE = "i68/parse";
|
|
312
|
+
const failIfAny = (problem) => (names) => Array.match(names, {
|
|
313
|
+
onEmpty: () => Effect.void,
|
|
314
|
+
onNonEmpty: (found) => Effect.fail(I68Error.make({ message: `${problem}: ${Array.join(found, ", ")}` }))
|
|
315
|
+
});
|
|
316
|
+
const UNKNOWN_PLUGINS = failIfAny("rules name plugins that are not configured");
|
|
317
|
+
const UNKNOWN_RULES = failIfAny("rules name rules that their plugins do not have");
|
|
318
|
+
const checkPlugins = (config) => {
|
|
319
|
+
const rules = UNKNOWN_RULES(unknownRules(config));
|
|
320
|
+
return UNKNOWN_PLUGINS(unknownPlugins(config)).pipe(Effect.andThen(rules));
|
|
321
|
+
};
|
|
322
|
+
const rulesOf = (config) => {
|
|
323
|
+
const flat = flattenConfig(config ?? {});
|
|
324
|
+
return checkPlugins(flat).pipe(Effect.as(resolve(flat)));
|
|
325
|
+
};
|
|
326
|
+
const parseDiagnosticsOf = (file) => (issues) => pipe(issues, Array.map((issue) => ({
|
|
327
|
+
path: file,
|
|
328
|
+
line: issue.line,
|
|
329
|
+
column: issue.column,
|
|
330
|
+
rule: PARSE_RULE,
|
|
331
|
+
message: issue.message,
|
|
332
|
+
severity: "error"
|
|
333
|
+
})));
|
|
334
|
+
const lintFile = (rules) => (song) => {
|
|
335
|
+
if (song.source.status === "invalid") return Effect.succeed(parseDiagnosticsOf(song.file)(song.source.issues));
|
|
336
|
+
return runRules({
|
|
337
|
+
path: song.file,
|
|
338
|
+
comments: song.source.outline.comments,
|
|
339
|
+
song: song.source.song,
|
|
340
|
+
rules
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
const lint = Effect.fn("i68.lint")(function* lint(input) {
|
|
344
|
+
const rules = yield* rulesOf(input.config);
|
|
345
|
+
const found = yield* Effect.all(pipe(input.files, Array.map((file) => readSongFile({
|
|
346
|
+
root: input.root,
|
|
347
|
+
file,
|
|
348
|
+
read: input.read
|
|
349
|
+
}).pipe(Effect.flatMap(lintFile(rules))))), { concurrency: "unbounded" });
|
|
350
|
+
return sortByPosition(Array.flatten(found));
|
|
351
|
+
});
|
|
352
|
+
const notFound = (path) => Effect.fail(I68Error.make({ message: `could not read ${path}` }));
|
|
353
|
+
const readerOf = (input) => (path) => {
|
|
354
|
+
if (path === input.path) return Effect.succeed(input.text);
|
|
355
|
+
return (input.read ?? notFound)(path);
|
|
356
|
+
};
|
|
357
|
+
const lintText = Effect.fn("i68.lintText")(function* lintText(input) {
|
|
358
|
+
const rules = yield* rulesOf(input.config);
|
|
359
|
+
const source = yield* readSong({
|
|
360
|
+
path: input.path,
|
|
361
|
+
read: readerOf(input)
|
|
362
|
+
});
|
|
363
|
+
const found = yield* lintFile(rules)({
|
|
364
|
+
file: input.path,
|
|
365
|
+
source
|
|
366
|
+
});
|
|
367
|
+
return sortByPosition(found);
|
|
368
|
+
});
|
|
369
|
+
// src/app/section.ts
|
|
370
|
+
const SONGS = "*.fumx";
|
|
371
|
+
const hasSection = (value) => Predicate.hasProperty(value, "i68") && Predicate.isObject(value.i68);
|
|
372
|
+
const i68Section = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => flattenConfig(value.i68)), Option.getOrElse(() => ({})));
|
|
373
|
+
const songPathspecs = ({ config, patterns = [SONGS] }) => [...patterns, ...pipe(config.ignores ?? [], Array.map((glob) => `:(glob,exclude)${glob}`))];
|
|
374
|
+
export { I68Error as a, runCli as c, lintText as i, songPathspecs as n, failedWith as o, lint as r, format as s, i68Section as t };
|
|
375
|
+
|
|
376
|
+
//# sourceMappingURL=section-DwA18QK6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-DwA18QK6.mjs","names":["Arr","Rec","taggedError","Rec","Str","DATA_FIRST_ARITY","Arr","Fn","Str","nodeServices","Fn","LINE_START","Bool","Arr","Arr","Rec","Arr","SEPARATOR","Str","rulesOf","Rec","Arr","Arr","Str","rulesOf","Arr","Arr","Arr","Arr"],"sources":["../../lint-host/src/entities/rule/model/setting.ts","../../lint-host/src/entities/rule/model/severity.ts","../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../../lint-host/src/shared/lib/layers.ts","../src/entities/rule/model/extend.ts","../src/entities/rule/model/resolve.ts","../src/app/format.ts","../src/features/read-songs/model/read.ts","../src/shared/lib/errors.ts","../src/features/run-rules/model/suppressions.ts","../src/features/run-rules/model/run.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Record as Rec, pipe } from \"effect\";\n\nexport type Severity = \"off\" | \"warn\" | \"error\";\n\nexport type RuleOptions = Readonly<Record<string, unknown>>;\n\nexport type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];\n\nexport interface Setting {\n readonly severity: Severity;\n readonly options: RuleOptions;\n}\n\nconst NO_OPTIONS: RuleOptions = {};\n\nexport const settingOf = (entry: RuleEntry): Setting =>\n Match.value(entry).pipe(\n Match.when(Match.string, (severity): Setting => ({ severity, options: NO_OPTIONS })),\n Match.orElse(([severity, options]): Setting => ({\n severity,\n options: options ?? NO_OPTIONS,\n })),\n );\n\nconst optionsOf = (entry: RuleEntry): Option.Option<RuleOptions> =>\n Match.value(entry).pipe(\n Match.when(Match.string, () => Option.none()),\n Match.orElse(([, options]) => Option.fromUndefinedOr(options)),\n );\n\nconst overridden = (earlier: RuleEntry, later: RuleEntry): RuleEntry =>\n pipe(\n optionsOf(later),\n Option.orElse(() => optionsOf(earlier)),\n Option.match({\n onNone: () => later,\n onSome: (options): RuleEntry => [settingOf(later).severity, options],\n }),\n );\n\nexport const mergedRules = (\n layers: readonly (Readonly<Record<string, RuleEntry>> | undefined)[],\n): Readonly<Record<string, RuleEntry>> => {\n const merged: Record<string, RuleEntry> = {};\n for (const [name, later] of pipe(\n layers,\n Arr.flatMap((layer) => Rec.toEntries(layer ?? {})),\n )) {\n merged[name] = pipe(\n Rec.get(merged, name),\n Option.match({\n onNone: () => later,\n onSome: (earlier) => overridden(earlier, later),\n }),\n );\n }\n return merged;\n};\n","import { Match } from \"effect\";\n\nimport type { Setting, Severity } from \"./setting.ts\";\n\nexport const reportedSeverity = (setting: Setting): Exclude<Severity, \"off\"> =>\n Match.value(setting.severity).pipe(\n Match.when(\"warn\", (): Exclude<Severity, \"off\"> => \"warn\"),\n Match.orElse((): Exclude<Severity, \"off\"> => \"error\"),\n );\n","import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(nodeServices)));\n};\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure>;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly args: readonly string[];\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure> =>\n fileSystem\n .readFileString(path.resolve(root, file))\n .pipe(Effect.mapError(failWith(`could not read ${file}`)));\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf = <Config, Found, Failure>(\n tool: Tool<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, args: process.argv.slice(ARGUMENTS_START) });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(nodeServices),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n runTraced(cli.name, mainOf(cli));\n};\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n runTraced(tool.name, toolMainOf(tool));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n readonly column?: number;\n}\n\nconst LINE_START = 0;\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.combine(\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n Order.mapInput(Order.Number, (found: Positioned) => found.column ?? LINE_START),\n ),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Array as Arr, Record as Rec, pipe } from \"effect\";\n\nexport interface Layer<Plugin, Entry, Override> {\n readonly plugins?: Readonly<Record<string, Plugin>>;\n readonly rules?: Readonly<Record<string, Entry>>;\n readonly ignores?: readonly string[];\n readonly overrides?: readonly Override[];\n}\n\nexport interface Merged<Plugin, Entry, Override> {\n readonly plugins: Readonly<Record<string, Plugin>>;\n readonly rules: Readonly<Record<string, Entry>>;\n readonly ignores: readonly string[];\n readonly overrides: readonly Override[];\n}\n\nexport const mergedRecords = <Value>(\n records: readonly (Readonly<Record<string, Value>> | undefined)[],\n): Readonly<Record<string, Value>> =>\n pipe(\n records,\n Arr.flatMap((record) => Rec.toEntries(record ?? {})),\n Rec.fromEntries,\n );\n\nexport const layersOf = <Config extends { readonly extends?: readonly Config[] }>(\n config: Config,\n): readonly Omit<Config, \"extends\">[] => {\n const { extends: bases = [], ...own } = config;\n return [...pipe(bases, Arr.flatMap(layersOf)), own];\n};\n\nexport const mergedLayers = <Plugin, Entry, Override>(\n layers: readonly Layer<Plugin, Entry, Override>[],\n): Merged<Plugin, Entry, Override> => ({\n plugins: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.plugins),\n ),\n ),\n rules: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.rules),\n ),\n ),\n ignores: pipe(\n layers,\n Arr.flatMap((layer) => layer.ignores ?? []),\n ),\n overrides: pipe(\n layers,\n Arr.flatMap((layer) => layer.overrides ?? []),\n ),\n});\n","import { layersOf, mergedLayers, mergedRules } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport const flattenConfig = (config: I68Config): I68Config => {\n const layers = layersOf(config);\n const { plugins, ignores } = mergedLayers(layers);\n const rules = mergedRules(\n pipe(\n layers,\n Arr.map((layer) => layer.rules),\n ),\n );\n return { plugins, rules, ignores };\n};\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 { I68Config, Plugin, Rule } from \"#/shared/config/index.ts\";\n\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst ENABLED: Setting = settingOf(\"error\");\n\nexport interface ResolvedRule {\n readonly id: string;\n readonly rule: Rule;\n readonly setting: Setting;\n}\n\ntype PluginEntry = readonly [string, Plugin];\n\nconst idOf = (plugin: string, name: string): string => `${plugin}${SEPARATOR}${name}`;\n\nconst pluginOf = (id: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: () => id,\n onSome: (slash) => Str.slice(START, slash)(id),\n }),\n );\n\nconst rulesOf =\n (config: I68Config) =>\n ([plugin, value]: PluginEntry): readonly ResolvedRule[] =>\n pipe(\n Rec.toEntries(value.rules),\n Arr.map(([name, rule]): ResolvedRule => {\n const id = idOf(plugin, name);\n return {\n id,\n rule,\n setting: pipe(\n config.rules ?? {},\n Rec.get(id),\n Option.map(settingOf),\n Option.getOrElse(() => ENABLED),\n ),\n };\n }),\n Arr.filter(({ setting }) => setting.severity !== \"off\"),\n );\n\nexport const resolve = (config: I68Config): readonly ResolvedRule[] =>\n pipe(Rec.toEntries(config.plugins ?? {}), Arr.flatMap(rulesOf(config)));\n\nexport const unknownPlugins = (config: I68Config): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.map(pluginOf),\n Arr.filter((plugin) => !Rec.has(config.plugins ?? {}, plugin)),\n Arr.dedupe,\n );\n\nconst ruleNameOf = (id: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: () => \"\",\n onSome: (slash) => Str.slice(slash + SEPARATOR.length)(id),\n }),\n );\n\nconst isKnownRule =\n (config: I68Config) =>\n (id: string): boolean =>\n pipe(\n Rec.get(config.plugins ?? {}, pluginOf(id)),\n Option.match({\n onNone: () => true,\n onSome: (plugin) => Rec.has(plugin.rules, ruleNameOf(id)),\n }),\n );\n\nexport const unknownRules = (config: I68Config): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.filter((id) => !isKnownRule(config)(id)),\n );\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\n\nexport const format = (diagnostic: Diagnostic): string => {\n const column = pipe(\n Option.fromNullishOr(diagnostic.column),\n Option.match({ onNone: () => \"\", onSome: (value) => `:${String(value)}` }),\n );\n const detail = pipe(\n [diagnostic.detail],\n Arr.flatMap((part) => Option.toArray(Option.fromNullishOr(part))),\n Arr.map((part) => ` [${part}]`),\n Arr.join(\"\"),\n );\n return `${diagnostic.path}:${String(diagnostic.line)}${column} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}${detail}`;\n};\n","import { readSong } from \"@r_masseater/fumx-parser\";\nimport type { SongSource } from \"@r_masseater/fumx-parser\";\nimport { Effect } from \"effect\";\n\nimport type { I68Error } from \"#/shared/lib/errors.ts\";\n\nconst SEPARATOR = \"/\";\n\nexport interface SongFile {\n readonly file: string;\n readonly source: SongSource;\n}\n\nexport type Read = (path: string) => Effect.Effect<string, I68Error>;\n\nexport interface ReadInput {\n readonly root: string;\n readonly file: string;\n readonly read: Read;\n}\n\nexport const readSongFile = Effect.fn(\"i68.read\")(function* readSongFile(input: ReadInput) {\n const path = `${input.root}${SEPARATOR}${input.file}`;\n const source = yield* readSong({ path, read: input.read });\n return { file: input.file, source } satisfies SongFile;\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class I68Error extends taggedError<I68Error, { readonly brand: unique symbol }>()(\n \"I68Error\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): I68Error =>\n I68Error.make({ message: `${message}: ${String(cause)}` });\n","import type { SourceComment } from \"@r_masseater/fumx-parser\";\nimport { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\n\nconst DIRECTIVE =\n /^i68-(?<kind>ignore-next-line|ignore-file|ignore|disable|enable)(?:\\s(?<rest>[\\s\\S]*))?$/u;\nconst REASON = /\\s-{2,}(?:\\s|$)/u;\nconst LINE_MARK = \"//\";\nconst BLOCK_START = \"/*\";\nconst BLOCK_END = \"*/\";\nconst LIST = \",\";\nconst NEXT = 1;\nconst LINE_START = 0;\n\ntype Kind = \"ignore\" | \"ignore-next-line\" | \"ignore-file\" | \"disable\" | \"enable\";\n\ninterface Directive {\n readonly line: number;\n readonly column: number;\n readonly kind: Kind;\n readonly rules: readonly string[];\n}\n\nexport interface Suppressed {\n readonly line: number;\n readonly column?: number;\n readonly rule: string;\n}\n\nconst kindOf = (text: string): Kind =>\n Match.value(text).pipe(\n Match.when(\"ignore-file\", (): Kind => \"ignore-file\"),\n Match.when(\"ignore-next-line\", (): Kind => \"ignore-next-line\"),\n Match.when(\"disable\", (): Kind => \"disable\"),\n Match.when(\"enable\", (): Kind => \"enable\"),\n Match.orElse((): Kind => \"ignore\"),\n );\n\nconst bodyOf = (text: string): string => {\n if (Str.startsWith(BLOCK_START)(text)) {\n return pipe(text, Str.slice(BLOCK_START.length), Str.replace(BLOCK_END, \"\"), Str.trim);\n }\n return pipe(text, Str.slice(LINE_MARK.length), Str.trim);\n};\n\nconst rulesOf = (rest: string): readonly string[] =>\n pipe(\n Str.split(` ${rest}`, REASON),\n Arr.head,\n Option.getOrElse(() => \"\"),\n Str.split(LIST),\n Arr.map(Str.trim),\n Arr.filter(Str.isNonEmpty),\n );\n\nconst groupsOf = (text: string): Option.Option<Partial<Record<string, string>>> =>\n pipe(\n Option.fromNullishOr(DIRECTIVE.exec(text)),\n Option.flatMap((found) => Option.fromNullishOr(found.groups)),\n );\n\nconst directiveOf = (comment: SourceComment): Option.Option<Directive> =>\n pipe(\n groupsOf(bodyOf(comment.text)),\n Option.map((groups) => ({\n line: comment.line,\n column: comment.column,\n kind: kindOf(groups[\"kind\"] ?? \"\"),\n rules: rulesOf(groups[\"rest\"] ?? \"\"),\n })),\n );\n\nconst names =\n (rule: string) =>\n (directive: Directive): boolean =>\n !Arr.isReadonlyArrayNonEmpty(directive.rules) || Arr.contains(directive.rules, rule);\n\nconst isRange = (directive: Directive): boolean =>\n directive.kind === \"disable\" || directive.kind === \"enable\";\n\nconst coversLine =\n (found: Suppressed) =>\n (directive: Directive): boolean =>\n names(found.rule)(directive) &&\n Match.value(directive.kind).pipe(\n Match.when(\"ignore-file\", () => true),\n Match.when(\"ignore-next-line\", () => directive.line + NEXT === found.line),\n Match.when(\"ignore\", () => directive.line === found.line),\n Match.orElse(() => false),\n );\n\nconst isAfter =\n (found: Suppressed) =>\n (directive: Directive): boolean =>\n directive.line < found.line ||\n (directive.line === found.line && directive.column <= (found.column ?? LINE_START));\n\nconst insideRange =\n (directives: readonly Directive[]) =>\n (found: Suppressed): boolean =>\n pipe(\n directives,\n Arr.filter(\n (directive) =>\n isRange(directive) && isAfter(found)(directive) && names(found.rule)(directive),\n ),\n Arr.last,\n Option.exists((directive) => directive.kind === \"disable\"),\n );\n\nexport const suppressionsOf = (\n comments: readonly SourceComment[],\n): ((found: Suppressed) => boolean) => {\n const directives = pipe(comments, Arr.map(directiveOf), Arr.getSomes);\n return (found) => pipe(directives, Arr.some(coversLine(found))) || insideRange(directives)(found);\n};\n","import { present, reportedSeverity } from \"@masseater.dev/lint-host\";\nimport type { Song, SourceComment } from \"@r_masseater/fumx-parser\";\nimport { soundingsOf } from \"@r_masseater/fumx-parser/analysis\";\nimport type { Sounding } from \"@r_masseater/fumx-parser/analysis\";\nimport { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { ResolvedRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic, Report } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { I68Error } from \"#/shared/lib/errors.ts\";\n\nimport { suppressionsOf } from \"./suppressions.ts\";\n\nexport interface RunInput {\n readonly path: string;\n readonly comments: readonly SourceComment[];\n readonly song: Song;\n readonly rules: readonly ResolvedRule[];\n}\n\nconst diagnosticOf =\n (path: string, rule: ResolvedRule) =>\n (report: Report): Diagnostic => ({\n path,\n line: report.line,\n rule: rule.id,\n message: report.message,\n severity: reportedSeverity(rule.setting),\n ...present(Option.fromNullishOr(report.column), (column) => ({ column })),\n ...present(Option.fromNullishOr(report.detail), (detail) => ({ detail })),\n });\n\nconst runOne = (\n input: RunInput,\n soundings: readonly Sounding[],\n): ((rule: ResolvedRule) => Effect.Effect<readonly Diagnostic[], I68Error>) =>\n Effect.fn(\"i68.rule\")(function* run(rule: ResolvedRule) {\n yield* Effect.annotateCurrentSpan({ \"i68.rule\": rule.id });\n const reports: Report[] = [];\n yield* Effect.try({\n try: () => {\n rule.rule.check({\n filename: input.path,\n song: input.song,\n soundings,\n options: rule.setting.options,\n report: (report) => {\n reports.push(report);\n },\n });\n },\n catch: failedWith(`${rule.id} failed`),\n });\n return pipe(reports, Arr.map(diagnosticOf(input.path, rule)));\n });\n\nexport const runRules = Effect.fn(\"i68.rules\")(function* runRules(input: RunInput) {\n const soundings = soundingsOf(input.song);\n const suppressed = suppressionsOf(input.comments);\n const found = yield* pipe(\n input.rules,\n Effect.forEach(runOne(input, soundings), { concurrency: 1 }),\n );\n return pipe(\n Arr.flatten(found),\n Arr.filter((diagnostic) => !suppressed(diagnostic)),\n );\n});\n","import { sortByPosition } from \"@masseater.dev/lint-host\";\nimport { readSong } from \"@r_masseater/fumx-parser\";\nimport type { SourceIssue } from \"@r_masseater/fumx-parser\";\nimport { Array as Arr, Effect, pipe } from \"effect\";\n\nimport { flattenConfig, resolve, unknownPlugins, unknownRules } from \"#/entities/rule/index.ts\";\nimport type { ResolvedRule } from \"#/entities/rule/index.ts\";\nimport { readSongFile } from \"#/features/read-songs/index.ts\";\nimport type { Read, SongFile } from \"#/features/read-songs/index.ts\";\nimport { runRules } from \"#/features/run-rules/index.ts\";\nimport type { Diagnostic, I68Config } from \"#/shared/config/index.ts\";\nimport { I68Error } from \"#/shared/lib/errors.ts\";\n\nconst PARSE_RULE = \"i68/parse\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly read: Read;\n readonly config?: I68Config;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly read?: Read;\n readonly config?: I68Config;\n}\n\nconst failIfAny =\n (problem: string) =>\n (names: readonly string[]): Effect.Effect<void, I68Error> =>\n Arr.match(names, {\n onEmpty: () => Effect.void,\n onNonEmpty: (found) =>\n Effect.fail(I68Error.make({ message: `${problem}: ${Arr.join(found, \", \")}` })),\n });\n\nconst UNKNOWN_PLUGINS = failIfAny(\"rules name plugins that are not configured\");\nconst UNKNOWN_RULES = failIfAny(\"rules name rules that their plugins do not have\");\n\nconst checkPlugins = (config: I68Config): Effect.Effect<void, I68Error> => {\n const rules = UNKNOWN_RULES(unknownRules(config));\n return UNKNOWN_PLUGINS(unknownPlugins(config)).pipe(Effect.andThen(rules));\n};\n\nconst rulesOf = (\n config: I68Config | undefined,\n): Effect.Effect<readonly ResolvedRule[], I68Error> => {\n const flat = flattenConfig(config ?? {});\n return checkPlugins(flat).pipe(Effect.as(resolve(flat)));\n};\n\nconst parseDiagnosticsOf =\n (file: string) =>\n (issues: readonly SourceIssue[]): readonly Diagnostic[] =>\n pipe(\n issues,\n Arr.map((issue): Diagnostic => ({\n path: file,\n line: issue.line,\n column: issue.column,\n rule: PARSE_RULE,\n message: issue.message,\n severity: \"error\",\n })),\n );\n\nconst lintFile =\n (rules: readonly ResolvedRule[]) =>\n (song: SongFile): Effect.Effect<readonly Diagnostic[], I68Error> => {\n if (song.source.status === \"invalid\") {\n return Effect.succeed(parseDiagnosticsOf(song.file)(song.source.issues));\n }\n return runRules({\n path: song.file,\n comments: song.source.outline.comments,\n song: song.source.song,\n rules,\n });\n };\n\nexport const lint = Effect.fn(\"i68.lint\")(function* lint(input: LintInput) {\n const rules = yield* rulesOf(input.config);\n const found = yield* Effect.all(\n pipe(\n input.files,\n Arr.map((file) =>\n readSongFile({ root: input.root, file, read: input.read }).pipe(\n Effect.flatMap(lintFile(rules)),\n ),\n ),\n ),\n { concurrency: \"unbounded\" },\n );\n return sortByPosition<Diagnostic>(Arr.flatten(found));\n});\n\nconst notFound = (path: string): Effect.Effect<string, I68Error> =>\n Effect.fail(I68Error.make({ message: `could not read ${path}` }));\n\nconst readerOf =\n (input: TextInput): Read =>\n (path) => {\n if (path === input.path) {\n return Effect.succeed(input.text);\n }\n return (input.read ?? notFound)(path);\n };\n\nexport const lintText = Effect.fn(\"i68.lintText\")(function* lintText(input: TextInput) {\n const rules = yield* rulesOf(input.config);\n const source = yield* readSong({ path: input.path, read: readerOf(input) });\n const found = yield* lintFile(rules)({ file: input.path, source });\n return sortByPosition<Diagnostic>(found);\n});\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport { flattenConfig } from \"#/entities/rule/index.ts\";\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nconst SONGS = \"*.fumx\";\n\nconst hasSection = (value: unknown): value is { readonly i68: I68Config } =>\n Predicate.hasProperty(value, \"i68\") && Predicate.isObject(value.i68);\n\nexport const i68Section = (config: unknown): I68Config =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => flattenConfig(value.i68)),\n Option.getOrElse((): I68Config => ({})),\n );\n\nexport interface PathspecInput {\n readonly config: I68Config;\n readonly patterns?: readonly string[];\n}\n\nexport const songPathspecs = ({ config, patterns = [SONGS] }: PathspecInput): readonly string[] => [\n ...patterns,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `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cAAc,QAAQ,UAAU,GACvC,OAAO,KAAK,UAAU,cAAc,MAAM,GAAG,CAAC,GAC9C,OAAO,iBAA4B,CAAC,EAAE,CACxC;AAOF,MAAa,iBAAiB,EAAE,QAAQ,WAAW,CAAC,KAAK,QAA0C,CACjG,GAAG,UACH,GAAG,KACD,OAAO,WAAW,CAAC,GACnBC,MAAI,KAAK,SAAS,kBAAkB,MAAM,CAC5C,CACF"}
|
package/dist/vite.d.mts
ADDED
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/i68",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A linter for .fumx songs that checks musical rules such as notes outside the key, part ranges, voicing clashes and parallel fifths, configured from vite.config.ts with rules written in TypeScript.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fumx",
|
|
7
|
+
"lint",
|
|
8
|
+
"music",
|
|
9
|
+
"music-theory",
|
|
10
|
+
"tanstack-intent",
|
|
11
|
+
"vite-plus",
|
|
12
|
+
"voicing"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/masseater/masseater.dev/tree/main/libs/i68#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/masseater/masseater.dev/issues"
|
|
17
|
+
},
|
|
5
18
|
"license": "MIT",
|
|
6
19
|
"repository": {
|
|
7
20
|
"type": "git",
|
|
8
21
|
"url": "git+https://github.com/masseater/masseater.dev.git",
|
|
9
22
|
"directory": "libs/i68"
|
|
10
23
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
"bin": {
|
|
25
|
+
"i68": "./dist/cli.mjs"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"dist",
|
|
30
|
+
"skills/lint-songs"
|
|
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
|
+
"@r_masseater/fumx-parser": "^0.2.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@effect/vitest": "4.1.4",
|
|
57
|
+
"@masseater.dev/lint-host": "0.0.0",
|
|
58
|
+
"@r_masseater/vitest-otlp": "0.2.0",
|
|
59
|
+
"@types/node": "26.6.6",
|
|
60
|
+
"effect": "4.1.4",
|
|
61
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
|
|
62
|
+
"vite-plus": "1.7.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"effect": "^4.1.2",
|
|
66
|
+
"vite": "*",
|
|
67
|
+
"vite-plus": ">=1.5.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"vite": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"vite-plus": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": "v26.13.1"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {}
|
|
15
81
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-songs
|
|
3
|
+
description: >
|
|
4
|
+
Use when setting up @r_masseater/i68 in vite.config.ts, running it on .fumx songs, writing a
|
|
5
|
+
music rule in TypeScript with defineRule, or silencing a finding with an i68-ignore comment.
|
|
6
|
+
metadata:
|
|
7
|
+
type: core
|
|
8
|
+
library: "@r_masseater/i68"
|
|
9
|
+
library_version: 0.1.0
|
|
10
|
+
sources:
|
|
11
|
+
- src/app/index.ts
|
|
12
|
+
- src/shared/config/types.ts
|
|
13
|
+
- src/features/run-rules/model/suppressions.ts
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# lint-songs
|
|
17
|
+
|
|
18
|
+
i68 lints `.fumx` songs. Each rule sees the song as data and reports findings by file line and column.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import "@r_masseater/i68/vite";
|
|
24
|
+
import { recommended } from "@r_masseater/i68-presets";
|
|
25
|
+
import { defineConfig } from "vite-plus";
|
|
26
|
+
|
|
27
|
+
export default defineConfig({ i68: { extends: [recommended()] } });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run `vp exec i68`. It lints every `.fumx` file git tracks, or the paths given. It exits non-zero only when a rule set to `"error"` reports.
|
|
31
|
+
|
|
32
|
+
## Config
|
|
33
|
+
|
|
34
|
+
| Key | Holds |
|
|
35
|
+
| --------- | ------------------------------------------------------------------------- |
|
|
36
|
+
| `extends` | Configs applied first; later entries and the config's own keys win |
|
|
37
|
+
| `plugins` | `{ name: plugin }`; a plugin's rules become `name/rule` and run as errors |
|
|
38
|
+
| `rules` | `"off"`, `"warn"`, `"error"` or `[severity, options]` per `plugin/rule` |
|
|
39
|
+
| `ignores` | Globs of files to skip |
|
|
40
|
+
|
|
41
|
+
Naming a plugin in `rules` that `plugins` does not register fails the run.
|
|
42
|
+
|
|
43
|
+
## Write a rule
|
|
44
|
+
|
|
45
|
+
`check(context)` gets `song` (the parsed `Song`), `soundings` (notes of unmuted tracks with `track`, `role`, `midi`, `start`, `end`, `bar`, `line`, `column`), `options` and `report({ line, column, message, detail })`. Times are ticks. `end` already accounts for the note's gate. Keys and chords come from `@r_masseater/fumx-parser/analysis`.
|
|
46
|
+
|
|
47
|
+
Report with the sounding's `line` and `column` so the finding points at the note in the file.
|
|
48
|
+
|
|
49
|
+
## Ignore a finding
|
|
50
|
+
|
|
51
|
+
`// i68-ignore rule-a, rule-b` on the line, `// i68-ignore-next-line` on the line above, `// i68-ignore-file` anywhere, or `// i68-disable rule-a` ... `// i68-enable rule-a` around a passage. Without rule names it covers every rule. Write the reason after `--`, for example `// i68-disable pop/melody-leap -- the chorus jumps on purpose`.
|