@shivaedev/quality 0.31.1 → 0.32.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +19 -4
  3. package/dist/baseline/installDriver.d.ts +5 -0
  4. package/dist/baseline/installDriver.d.ts.map +1 -0
  5. package/dist/baseline/installDriver.js +11 -0
  6. package/dist/baseline/installDriver.js.map +1 -0
  7. package/dist/baseline/merge.d.ts +4 -0
  8. package/dist/baseline/merge.d.ts.map +1 -0
  9. package/dist/baseline/merge.js +28 -0
  10. package/dist/baseline/merge.js.map +1 -0
  11. package/dist/baseline/rewrite.d.ts.map +1 -1
  12. package/dist/baseline/rewrite.js +0 -1
  13. package/dist/baseline/rewrite.js.map +1 -1
  14. package/dist/baseline/shards.d.ts +13 -0
  15. package/dist/baseline/shards.d.ts.map +1 -0
  16. package/dist/baseline/shards.js +48 -0
  17. package/dist/baseline/shards.js.map +1 -0
  18. package/dist/cli/args.d.ts +8 -1
  19. package/dist/cli/args.d.ts.map +1 -1
  20. package/dist/cli/args.js +9 -0
  21. package/dist/cli/args.js.map +1 -1
  22. package/dist/cli/baseline.d.ts.map +1 -1
  23. package/dist/cli/baseline.js +6 -7
  24. package/dist/cli/baseline.js.map +1 -1
  25. package/dist/cli/messages.d.ts +1 -1
  26. package/dist/cli/messages.d.ts.map +1 -1
  27. package/dist/cli/messages.js +6 -2
  28. package/dist/cli/messages.js.map +1 -1
  29. package/dist/cli/migrate.d.ts.map +1 -1
  30. package/dist/cli/migrate.js +10 -6
  31. package/dist/cli/migrate.js.map +1 -1
  32. package/dist/cli/program.d.ts.map +1 -1
  33. package/dist/cli/program.js +6 -0
  34. package/dist/cli/program.js.map +1 -1
  35. package/dist/config/load.js +1 -1
  36. package/dist/engine/baselineFile.d.ts +2 -1
  37. package/dist/engine/baselineFile.d.ts.map +1 -1
  38. package/dist/engine/baselineFile.js +23 -6
  39. package/dist/engine/baselineFile.js.map +1 -1
  40. package/docs/debt-and-hooks.md +6 -3
  41. package/package.json +1 -1
  42. package/src/baseline/installDriver.ts +12 -0
  43. package/src/baseline/merge.ts +34 -0
  44. package/src/baseline/rewrite.ts +0 -1
  45. package/src/baseline/shards.ts +60 -0
  46. package/src/cli/args.ts +11 -0
  47. package/src/cli/baseline.ts +6 -10
  48. package/src/cli/messages.ts +6 -2
  49. package/src/cli/migrate.ts +10 -6
  50. package/src/cli/program.ts +6 -0
  51. package/src/config/load.ts +1 -1
  52. package/src/engine/baselineFile.ts +24 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.32.0 - 2026-10-19
4
+
5
+ ### Changed
6
+
7
+ - Store baseline debt in package shards and a root `quality-baseline.jsonl`, remove empty shards, and keep tighten, prune and lint on the same records. Migrate a single-file baseline with `quality baseline migrate --from quality/baseline.jsonl`.
8
+ - Merge baseline entries by path and rule: removals win, retained counts take the minimum and additions from both sides survive. Configure the checkout with `quality baseline install-driver` and register `merge=quality-baseline` for shard files in `.gitattributes`. The source exports are `mergeBaseline(base, ours, theirs)` in `baseline/merge.ts`, `installDriver(cwd, launch)` in `baseline/installDriver.ts`, and `SHARD_NAME`, `Shard`, `shardOf(file, rootFile)`, `shardPaths(config)` and `saveShards(config, before, entries)` in `baseline/shards.ts`.
9
+
10
+ ### Breaking
11
+
12
+ - `BaselineFile` from `engine/baselineFile.ts` exposes `files: ReadonlyMap<string, Shard>` instead of a single `raw` string. Read each shard's `raw` and `entries` from `files`; the combined `entries` field remains available.
13
+
3
14
  ## 0.31.1 - 2026-10-19
4
15
 
5
16
  ### Fixed
package/README.md CHANGED
@@ -31,7 +31,7 @@ The work has three parts: connect the repository to the shared tools once; descr
31
31
 
32
32
  ### 1. Once per repository: connect the shared policy
33
33
 
34
- A new repository needs no `quality.config.ts`. Quality checks sources from the current directory with every built-in rule at its default error level. The default baseline path is `quality/baseline.jsonl`; permanent exceptions belong in `quality.config.ts`.
34
+ A new repository needs no `quality.config.ts`. Quality checks sources from the current directory with every built-in rule at its default error level. Baseline entries for `packages/<package>/...` live in `packages/<package>/quality-baseline.jsonl`; entries outside packages live in the root `quality-baseline.jsonl`. A package with no entries has no shard file. Permanent exceptions belong in `quality.config.ts`.
35
35
 
36
36
  Create a root `biome.json`:
37
37
 
@@ -174,7 +174,7 @@ When you fix debt, lower the entries of changed files:
174
174
  quality baseline tighten
175
175
  ```
176
176
 
177
- `tighten` lowers entries for files changed since `HEAD`; `--staged` restricts those updates to staged files. `prune` considers every baseline entry. Both only lower or remove counts and can carry entries when git detects tracked moves.
177
+ `tighten` lowers entries for files changed since `HEAD`; `--staged` restricts those updates to staged files. `prune` considers every baseline entry. Both read all shards, only lower or remove counts and carry entries to the destination shard when git detects tracked moves. They also remove empty shards left by content merges. Unchanged entries stay in their existing shards, with unrelated lines preserved.
178
178
 
179
179
  When a Quality upgrade adds a check, or a reviewed change needs to record one rule's findings again:
180
180
 
@@ -184,6 +184,19 @@ quality baseline write --rule tests/story-setup
184
184
 
185
185
  Keep the default error level. The command replaces that rule's entries and leaves other rules' entries alone. Any new or raised count belongs in the review and the pull request's Callouts. The [debt and hook guide](https://github.com/ShivaeDev/platform/blob/main/packages/quality/docs/debt-and-hooks.md) covers the baseline format, exception subjects, limit changes, renames and commit checks.
186
186
 
187
+ ### Baseline merges
188
+
189
+ Register the driver in `.gitattributes`:
190
+
191
+ ```gitattributes
192
+ /quality-baseline.jsonl merge=quality-baseline
193
+ /packages/*/quality-baseline.jsonl merge=quality-baseline
194
+ ```
195
+
196
+ Run `quality baseline install-driver` from your checkout's setup script. It sets only repository-local `merge.quality-baseline.driver`; it leaves other Git settings alone. Platform's `pnpm run setup` includes this step. Each checkout needs the setting because Git does not copy local configuration when cloning.
197
+
198
+ Git calls `quality baseline merge <ancestor> <current> <other>`. Entries are keyed by path and rule. Removing an ancestor entry on either side removes it from the result; retained counts take the minimum of the two sides, and entries newly added on either side survive. The command writes the result to `<current>`, so parallel reductions of neighbouring entries merge without a text conflict.
199
+
187
200
  ### What the rules check
188
201
 
189
202
  `quality lint` prints each failing rule's guidance with its findings, so the finding is the reference for what to change. The built-in rules fall into these groups:
@@ -218,7 +231,7 @@ Import names from their defining module; there is no root entry. The package's `
218
231
  | --- | --- | --- |
219
232
  | `sources` | `["."]` | Directories or files the source rules check, relative to the repository root. |
220
233
  | `extensions` | `.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.jsx`, `.mjs`, `.cjs` | Source extensions. |
221
- | `baseline` | `quality/baseline.jsonl` | Counts of existing findings. |
234
+ | `baseline` | `quality-baseline.jsonl` | Root shard for paths outside packages; package shards use `packages/<package>/quality-baseline.jsonl`. |
222
235
  | `exceptions` | `[]` | Permanent exceptions as `{ files, rules, reason, subject? }`. |
223
236
  | `registry` | `quality/registry.json` | Legacy input for upgrades; run `quality exceptions migrate`. |
224
237
  | `local` | `[]` | Exposed extension API for rules made with `defineRule`; not required for adoption. |
@@ -249,6 +262,8 @@ Register it with `defineConfig({ local: [noLog] })`. Its check receives `root`,
249
262
  quality lint [--config <file>]
250
263
  quality fix [--config <file>]
251
264
  quality exceptions migrate [--config <file>] [--from <registry>]
265
+ quality baseline merge <ancestor> <current> <other>
266
+ quality baseline install-driver
252
267
  quality baseline write [--config <file>] [--rule <id>]...
253
268
  quality baseline prune [--config <file>] [--against <ref>]
254
269
  quality baseline tighten [--config <file>] [--staged]
@@ -259,7 +274,7 @@ quality hooks status
259
274
  quality hooks pre-commit [--config <file>]
260
275
  ```
261
276
 
262
- `quality` alone runs lint. The commands above use the default error-level policy. `prune --against` follows renames since the target's merge base; without a target it tries `origin/HEAD`, `origin/main`, then `origin/master`, and prunes without following moves when no merge base is available. An explicit target with unavailable history fails; fetch the needed history before rerunning. `migrate` converts a JSON baseline into the current JSON Lines format.
277
+ `quality` alone runs lint. The commands above use the default error-level policy. `prune --against` follows renames since the target's merge base; without a target it tries `origin/HEAD`, `origin/main`, then `origin/master`, and prunes without following moves when no merge base is available. An explicit target with unavailable history fails; fetch the needed history before rerunning. `migrate` splits a single JSON Lines baseline into shards, or converts an earlier JSON baseline into sharded JSON Lines. Use `--from quality/baseline.jsonl` for an existing single-file baseline. It removes the source after writing the shards.
263
278
 
264
279
  | Exit code | Meaning |
265
280
  | --- | --- |
@@ -0,0 +1,5 @@
1
+ import { Effect } from "effect";
2
+ import type { SetupFailure } from "#failure.ts";
3
+ import { type Launch } from "#hooks/command.ts";
4
+ export declare const installDriver: (cwd: string, launch: Launch) => Effect.Effect<void, SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
5
+ //# sourceMappingURL=installDriver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDriver.d.ts","sourceRoot":"","sources":["../../src/baseline/installDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAe,KAAK,MAAM,EAAc,MAAM,mBAAmB,CAAC;AAEzE,eAAO,MAAM,aAAa,sIAMxB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Console, Effect } from "effect";
2
+ import { gitOrFail } from "#git/command.ts";
3
+ import { hookCommand, shellWords } from "#hooks/command.ts";
4
+ export const installDriver = Effect.fn("Baseline.installDriver")(function* (cwd, launch) {
5
+ const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
6
+ const command = hookCommand(root, launch, undefined);
7
+ const driver = `${shellWords([...command.runner, command.launcher, "baseline", "merge"])} "%O" "%A" "%B"`;
8
+ yield* gitOrFail(root, ["config", "--local", "merge.quality-baseline.driver", driver]);
9
+ yield* Console.log("quality: configured the repository-local quality-baseline merge driver.");
10
+ });
11
+ //# sourceMappingURL=installDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDriver.js","sourceRoot":"","sources":["../../src/baseline/installDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAY,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAW,EAAE,MAAc;IACtG,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,iBAAiB,CAAC;IAC1G,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,+BAA+B,EAAE,MAAM,CAAC,CAAC,CAAC;IACvF,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;AAC/F,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Effect, FileSystem } from "effect";
2
+ import { SetupFailure } from "#failure.ts";
3
+ export declare const mergeBaseline: (base: string, ours: string, theirs: string) => Effect.Effect<void, SetupFailure, FileSystem.FileSystem>;
4
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/baseline/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiB3C,eAAO,MAAM,aAAa,0GAYzB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Effect, FileSystem } from "effect";
2
+ import { decodeBaseline, encodeBaseline } from "#baseline/format.ts";
3
+ import { validOrFail } from "#decoded.ts";
4
+ import { keyOf } from "#engine/violation.ts";
5
+ import { SetupFailure } from "#failure.ts";
6
+ function mergeEntries(base, ours, theirs) {
7
+ const original = new Set(base.map((entry) => keyOf(entry.rule, entry.file)));
8
+ const left = new Map(ours.map((entry) => [keyOf(entry.rule, entry.file), entry]));
9
+ const right = new Map(theirs.map((entry) => [keyOf(entry.rule, entry.file), entry]));
10
+ return [...new Set([...left.keys(), ...right.keys()])].flatMap((key) => {
11
+ const a = left.get(key);
12
+ const b = right.get(key);
13
+ if (original.has(key) && (a === undefined || b === undefined)) {
14
+ return [];
15
+ }
16
+ const entry = a ?? b;
17
+ return entry === undefined ? [] : [{ ...entry, count: Math.min(a?.count ?? entry.count, b?.count ?? entry.count) }];
18
+ });
19
+ }
20
+ export const mergeBaseline = Effect.fn("Baseline.mergeBaseline")(function* (base, ours, theirs) {
21
+ const fs = yield* FileSystem.FileSystem;
22
+ const entries = yield* Effect.forEach([base, ours, theirs], (path) => Effect.gen(function* () {
23
+ const raw = yield* fs.readFileString(path);
24
+ return yield* validOrFail(path, yield* Effect.promise(() => decodeBaseline(raw)));
25
+ }));
26
+ yield* fs.writeFileString(ours, encodeBaseline(mergeEntries(entries[0] ?? [], entries[1] ?? [], entries[2] ?? [])));
27
+ }, Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
28
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/baseline/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAsB,cAAc,EAAE,cAAc,EAAE,MAAM,qBA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AAC;AACrH,CAAC,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAC5E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/baseline/rewrite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAuC,MAAM,aAAa,CAAC;AAQtF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAclI"}
1
+ {"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/baseline/rewrite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAuC,MAAM,aAAa,CAAC;AAOtF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAclI"}
@@ -1,6 +1,5 @@
1
1
  import { keyOf } from "#engine/violation.ts";
2
2
  import { byPathAndRule, encodeEntry, linesOf } from "./format.js";
3
- // An untouched entry keeps its exact line and a new one goes before the first line that sorts after it, so two branches conflict only on the same or neighbouring entries.
4
3
  export function rewriteBaseline(raw, before, after) {
5
4
  const wanted = new Map(after.map((entry) => [keyOf(entry.rule, entry.file), entry]));
6
5
  const lines = linesOf(raw);
@@ -1 +1 @@
1
- {"version":3,"file":"rewrite.js","sourceRoot":"","sources":["../../src/baseline/rewrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAsB,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOtF,2KAA2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AC,IAAI,CAAC,CAAC,CAAC;QACzC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvI,CAAC,CAAC,CAAC;IACH,KAAK,MAAM,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9D,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Effect, FileSystem } from "effect";
2
+ import type { BaselineEntry } from "#baseline/format.ts";
3
+ import type { ResolvedConfig } from "#config/load.ts";
4
+ import { SetupFailure } from "#failure.ts";
5
+ export declare const SHARD_NAME = "quality-baseline.jsonl";
6
+ export interface Shard {
7
+ readonly entries: readonly BaselineEntry[];
8
+ readonly raw: string;
9
+ }
10
+ export declare function shardOf(file: string, rootFile: string): string;
11
+ export declare const shardPaths: (config: ResolvedConfig) => Effect.Effect<string[], import("#inventory/filesystem.ts").FilesystemFailure | import("effect/PlatformError").PlatformError, FileSystem.FileSystem>;
12
+ export declare const saveShards: (config: ResolvedConfig, before: ReadonlyMap<string, Shard>, entries: readonly BaselineEntry[]) => Effect.Effect<void, SetupFailure, FileSystem.FileSystem>;
13
+ //# sourceMappingURL=shards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shards.d.ts","sourceRoot":"","sources":["../../src/baseline/shards.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,UAAU,2BAA2B,CAAC;AAEnD,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,eAAO,MAAM,UAAU,iLAWrB,CAAC;AAEH,eAAO,MAAM,UAAU,6JA0BtB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { join } from "node:path";
2
+ import { Effect, FileSystem } from "effect";
3
+ import { rewriteBaseline } from "#baseline/rewrite.ts";
4
+ import { SetupFailure } from "#failure.ts";
5
+ import { orWhenAbsent, writeText } from "#inventory/filesystem.ts";
6
+ export const SHARD_NAME = "quality-baseline.jsonl";
7
+ export function shardOf(file, rootFile) {
8
+ const [folder, name, ...rest] = file.split("/");
9
+ return folder === "packages" && name !== undefined && rest.length > 0 ? `packages/${name}/${SHARD_NAME}` : rootFile;
10
+ }
11
+ export const shardPaths = Effect.fn("Baseline.shardPaths")(function* (config) {
12
+ const fs = yield* FileSystem.FileSystem;
13
+ const folder = join(config.root, "packages");
14
+ const names = yield* orWhenAbsent(folder, fs.readDirectory(folder), []);
15
+ const paths = [config.baseline];
16
+ for (const name of names) {
17
+ if ((yield* fs.stat(join(folder, name))).type === "Directory") {
18
+ paths.push(`packages/${name}/${SHARD_NAME}`);
19
+ }
20
+ }
21
+ return paths;
22
+ });
23
+ export const saveShards = Effect.fn("Baseline.saveShards")(function* (config, before, entries) {
24
+ const fs = yield* FileSystem.FileSystem;
25
+ const grouped = new Map();
26
+ for (const entry of entries) {
27
+ const path = shardOf(entry.file, config.baseline);
28
+ const group = grouped.get(path) ?? [];
29
+ group.push(entry);
30
+ grouped.set(path, group);
31
+ }
32
+ for (const path of new Set([...before.keys(), ...grouped.keys()])) {
33
+ const old = before.get(path);
34
+ const next = grouped.get(path) ?? [];
35
+ if (next.length === 0) {
36
+ if (old !== undefined) {
37
+ yield* fs.remove(join(config.root, path));
38
+ }
39
+ }
40
+ else {
41
+ const text = rewriteBaseline(old?.raw, old?.entries ?? [], next);
42
+ if (text !== old?.raw) {
43
+ yield* writeText(join(config.root, path), text);
44
+ }
45
+ }
46
+ }
47
+ }, Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
48
+ //# sourceMappingURL=shards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shards.js","sourceRoot":"","sources":["../../src/baseline/shards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,CAAC,MAAM,UAA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,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACjD,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAC5E,CAAC"}
@@ -8,6 +8,13 @@ export type Command = {
8
8
  } | {
9
9
  readonly _tag: "Fix";
10
10
  readonly config: string | undefined;
11
+ } | {
12
+ readonly _tag: "BaselineMerge";
13
+ readonly base: string;
14
+ readonly ours: string;
15
+ readonly theirs: string;
16
+ } | {
17
+ readonly _tag: "BaselineInstallDriver";
11
18
  } | {
12
19
  readonly _tag: "BaselineWrite";
13
20
  readonly config: string | undefined;
@@ -45,6 +52,6 @@ export type Parsed = {
45
52
  readonly _tag: "Usage";
46
53
  readonly problem: string;
47
54
  };
48
- export declare const USAGE = "Usage:\n quality lint [--config <file>]\n quality fix [--config <file>]\n quality exceptions migrate [--config <file>] [--from <registry>]\n quality baseline write [--config <file>] [--rule <id>]...\n quality baseline prune [--config <file>] [--against <ref>]\n quality baseline tighten [--config <file>] [--staged]\n quality baseline migrate [--config <file>] [--from <file>]\n quality hooks install [--config <file>] [--force]\n quality hooks uninstall\n quality hooks status\n quality hooks pre-commit [--config <file>]\n\nlint Run every rule. Exits 1 on an error-level violation, a file over its baseline, a stale registry entry\n or a baseline entry for an unknown rule.\nfix Sort every package.json, apply Biome's lint fixes, unsafe ones included, its assist actions and formatting, then format again.\nexceptions migrate Move legacy registry entries and Biome declarations into quality.config.ts exceptions and remove matching root overrides.\nbaseline write Record current error-level violations. Creates the baseline, or records the named rules again, replacing their entries.\nbaseline prune Drop fixed debt, lower entries to what is left and carry entries to files git saw move. Never adds or raises an entry.\nbaseline tighten Prune only the entries of files changed since HEAD, or with --staged, in the index.\nbaseline migrate Move a baseline from the earlier JSON format (--from, quality/baseline.json by default) to the configured file.\nhooks install Install the git pre-commit hook, shared by every worktree, that runs hooks pre-commit. Keeps a hook that is not quality's\n unless --force replaces it.\nhooks uninstall Remove quality's pre-commit hook. Keeps a hook that is not quality's.\nhooks status Check that git's effective hooks path runs Quality's pre-commit hook and report global chaining.\nhooks pre-commit What the hook runs: lint, then package.json scripts typecheck and quality:commit when present.\n\n--config <file> Config file; its directory is the repository root. Without this option, uses ./quality.config.ts when present, otherwise defaults.\n--against <ref> The branch the work merges into, whose merge base prune follows moves from. Defaults to origin/HEAD, then origin/main, then origin/master.\nExit codes: 0 passed, 1 failed the gate, 2 could not run.";
55
+ export declare const USAGE = "Usage:\n quality lint [--config <file>]\n quality fix [--config <file>]\n quality exceptions migrate [--config <file>] [--from <registry>]\n quality baseline merge <ancestor> <current> <other>\n quality baseline install-driver\n quality baseline write [--config <file>] [--rule <id>]...\n quality baseline prune [--config <file>] [--against <ref>]\n quality baseline tighten [--config <file>] [--staged]\n quality baseline migrate [--config <file>] [--from <file>]\n quality hooks install [--config <file>] [--force]\n quality hooks uninstall\n quality hooks status\n quality hooks pre-commit [--config <file>]\n\nlint Run every rule. Exits 1 on an error-level violation, a file over its baseline, a stale registry entry\n or a baseline entry for an unknown rule.\nfix Sort every package.json, apply Biome's lint fixes, unsafe ones included, its assist actions and formatting, then format again.\nexceptions migrate Move legacy registry entries and Biome declarations into quality.config.ts exceptions and remove matching root overrides.\nbaseline merge Merge Git baseline versions into <current>: deletions win and counts take the minimum.\nbaseline install-driver Configure only the repository-local merge.quality-baseline.driver setting.\nbaseline write Record current error-level violations. Creates the baseline, or records the named rules again, replacing their entries.\nbaseline prune Drop fixed debt, lower entries to what is left and carry entries to files git saw move. Never adds or raises an entry.\nbaseline tighten Prune only the entries of files changed since HEAD, or with --staged, in the index.\nbaseline migrate Move a JSON or JSON Lines baseline (--from, quality/baseline.json by default) into root and package shards.\nhooks install Install the git pre-commit hook, shared by every worktree, that runs hooks pre-commit. Keeps a hook that is not quality's\n unless --force replaces it.\nhooks uninstall Remove quality's pre-commit hook. Keeps a hook that is not quality's.\nhooks status Check that git's effective hooks path runs Quality's pre-commit hook and report global chaining.\nhooks pre-commit What the hook runs: lint, then package.json scripts typecheck and quality:commit when present.\n\n--config <file> Config file; its directory is the repository root. Without this option, uses ./quality.config.ts when present, otherwise defaults.\n--against <ref> The branch the work merges into, whose merge base prune follows moves from. Defaults to origin/HEAD, then origin/main, then origin/master.\nExit codes: 0 passed, 1 failed the gate, 2 could not run.";
49
56
  export declare function parseCommand(args: readonly string[]): Parsed;
50
57
  //# sourceMappingURL=args.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC9D;IAAE,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC9G;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC7D;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1G;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC7G;IAAE,QAAQ,CA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,GAAG,SAAS,CAAA;CAAE,GAC5G;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC/F;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACnC;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACxE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7B,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnI,eAAO,MAAM,KAAK,8nFAAgB,CAAC;AAiFnC,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CA0B5D"}
package/dist/cli/args.js CHANGED
@@ -19,6 +19,7 @@ function parsed(command) {
19
19
  }
20
20
  const COMMAND_OPTIONS = ["against", "force", "from", "rule", "staged"];
21
21
  const ACCEPTS = {
22
+ "baseline install-driver": [],
22
23
  "baseline migrate": ["from"],
23
24
  "baseline prune": ["against"],
24
25
  "baseline tighten": ["staged"],
@@ -48,6 +49,8 @@ function commandFor(name, values) {
48
49
  return parsed({ _tag: "ExceptionsMigrate", config, from: values.from });
49
50
  case "fix":
50
51
  return parsed({ _tag: "Fix", config });
52
+ case "baseline install-driver":
53
+ return parsed({ _tag: "BaselineInstallDriver" });
51
54
  case "baseline write":
52
55
  return parsed({ _tag: "BaselineWrite", config, rules: values.rule ?? [] });
53
56
  case "baseline prune":
@@ -79,6 +82,12 @@ export function parseCommand(args) {
79
82
  if (values.help === true || command === "help") {
80
83
  return parsed({ _tag: "Help" });
81
84
  }
85
+ if (command === "baseline" && rest[0] === "merge") {
86
+ const [, base, ours, theirs] = rest;
87
+ return rest.length === 4 && base !== undefined && ours !== undefined && theirs !== undefined
88
+ ? parsed({ _tag: "BaselineMerge", base, ours, theirs })
89
+ : usage("baseline merge takes <ancestor> <current> <other>.");
90
+ }
82
91
  const name = [command, ...rest].join(" ");
83
92
  if (ACCEPTS[name] === undefined) {
84
93
  const subcommands = SUBCOMMANDS[command];
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkBpE,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;AAEnC,MAAM,OAAO,GAAG;IACf,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC3B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;IACrC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;CAClB,CAAC;AAEX,SAAS,KAAK,CAAC,OAAe;IAC7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,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AAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;IACvG,CAAC;IACD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../src/cli/baseline.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAG1D,OAAO,EAA6B,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAe3C,eAAO,MAAM,aAAa,iIAiBxB,CAAC;AAWH,eAAO,MAAM,cAAc,GAA8C,aAAa,8DAGlE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,CAAC,6EAY/E,CAAC"}
1
+ {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../src/cli/baseline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAG1D,OAAO,EAA6B,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAW3C,eAAO,MAAM,aAAa,iIAiBxB,CAAC;AAWH,eAAO,MAAM,cAAc,GAA8C,aAAa,8DAGlE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,CAAC,6EAa/E,CAAC"}
@@ -1,21 +1,19 @@
1
- import { join } from "node:path";
2
1
  import { Console, Effect } from "effect";
3
- import { rewriteBaseline } from "#baseline/rewrite.ts";
2
+ import { saveShards } from "#baseline/shards.ts";
4
3
  import { adopt, prune } from "#baseline/update.ts";
5
4
  import { openSession } from "#engine/session.ts";
6
5
  import { applyRegistry } from "#exceptions/registry.ts";
7
6
  import { SetupFailure } from "#failure.ts";
8
- import { writeText } from "#inventory/filesystem.ts";
9
7
  import { plural } from "#report/plural.ts";
10
8
  function save(session, entries) {
11
- return Effect.mapError(writeText(join(session.config.root, session.config.baseline), rewriteBaseline(session.baseline.raw, session.baseline.entries, entries)), (failure) => new SetupFailure({ message: failure.message }));
9
+ return saveShards(session.config, session.baseline.files, entries);
12
10
  }
13
11
  function unregistered(session) {
14
12
  return applyRegistry(session.violations, session.registry, session.config).kept;
15
13
  }
16
14
  export const writeBaseline = Effect.fn("Cli.writeBaseline")(function* (cwd, config, rules) {
17
15
  const session = yield* openSession(cwd, config);
18
- const existing = session.baseline.raw === undefined ? undefined : session.baseline.entries;
16
+ const existing = session.baseline.files.size === 0 ? undefined : session.baseline.entries;
19
17
  const adoption = adopt(existing, rules, unregistered(session), session.config);
20
18
  if (adoption._tag === "Refused") {
21
19
  return yield* new SetupFailure({ message: `baseline write refused:\n${adoption.reasons.map((reason) => ` - ${reason}`).join("\n")}` });
@@ -37,11 +35,12 @@ function changes(pruned) {
37
35
  }
38
36
  export const shrinkBaseline = Effect.fn("Cli.shrinkBaseline")(function* (cwd, config, scopeOf) {
39
37
  const session = yield* openSession(cwd, config);
40
- if (session.baseline.raw === undefined) {
38
+ if (session.baseline.files.size === 0) {
41
39
  return yield* Console.log(`quality: no baseline at ${session.config.baseline}; nothing to lower.`);
42
40
  }
43
41
  const pruned = prune(session.baseline.entries, unregistered(session), session.config, yield* scopeOf(session));
44
- if (pruned.removed === 0 && pruned.lowered === 0 && pruned.moved === 0) {
42
+ const emptyShard = [...session.baseline.files.values()].some((file) => file.entries.length === 0);
43
+ if (pruned.removed === 0 && pruned.lowered === 0 && pruned.moved === 0 && !emptyShard) {
45
44
  return yield* Console.log(`quality: ${session.config.baseline} is current.`);
46
45
  }
47
46
  yield* save(session, pruned.entries);
@@ -1 +1 @@
1
- {"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../src/cli/baseline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAe,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAgB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,SAAS,IAAI,CAAC,OAAgB,EAAE,OAAiC;IAChE,OAAO,MAAM,CAAC,QAAQ,CACrB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EACvI,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAC3D,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB;IACrC,OAAO,aAA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declare const USAGE = "Usage:\n quality lint [--config <file>]\n quality fix [--config <file>]\n quality exceptions migrate [--config <file>] [--from <registry>]\n quality baseline write [--config <file>] [--rule <id>]...\n quality baseline prune [--config <file>] [--against <ref>]\n quality baseline tighten [--config <file>] [--staged]\n quality baseline migrate [--config <file>] [--from <file>]\n quality hooks install [--config <file>] [--force]\n quality hooks uninstall\n quality hooks status\n quality hooks pre-commit [--config <file>]\n\nlint Run every rule. Exits 1 on an error-level violation, a file over its baseline, a stale registry entry\n or a baseline entry for an unknown rule.\nfix Sort every package.json, apply Biome's lint fixes, unsafe ones included, its assist actions and formatting, then format again.\nexceptions migrate Move legacy registry entries and Biome declarations into quality.config.ts exceptions and remove matching root overrides.\nbaseline write Record current error-level violations. Creates the baseline, or records the named rules again, replacing their entries.\nbaseline prune Drop fixed debt, lower entries to what is left and carry entries to files git saw move. Never adds or raises an entry.\nbaseline tighten Prune only the entries of files changed since HEAD, or with --staged, in the index.\nbaseline migrate Move a baseline from the earlier JSON format (--from, quality/baseline.json by default) to the configured file.\nhooks install Install the git pre-commit hook, shared by every worktree, that runs hooks pre-commit. Keeps a hook that is not quality's\n unless --force replaces it.\nhooks uninstall Remove quality's pre-commit hook. Keeps a hook that is not quality's.\nhooks status Check that git's effective hooks path runs Quality's pre-commit hook and report global chaining.\nhooks pre-commit What the hook runs: lint, then package.json scripts typecheck and quality:commit when present.\n\n--config <file> Config file; its directory is the repository root. Without this option, uses ./quality.config.ts when present, otherwise defaults.\n--against <ref> The branch the work merges into, whose merge base prune follows moves from. Defaults to origin/HEAD, then origin/main, then origin/master.\nExit codes: 0 passed, 1 failed the gate, 2 could not run.";
1
+ export declare const USAGE = "Usage:\n quality lint [--config <file>]\n quality fix [--config <file>]\n quality exceptions migrate [--config <file>] [--from <registry>]\n quality baseline merge <ancestor> <current> <other>\n quality baseline install-driver\n quality baseline write [--config <file>] [--rule <id>]...\n quality baseline prune [--config <file>] [--against <ref>]\n quality baseline tighten [--config <file>] [--staged]\n quality baseline migrate [--config <file>] [--from <file>]\n quality hooks install [--config <file>] [--force]\n quality hooks uninstall\n quality hooks status\n quality hooks pre-commit [--config <file>]\n\nlint Run every rule. Exits 1 on an error-level violation, a file over its baseline, a stale registry entry\n or a baseline entry for an unknown rule.\nfix Sort every package.json, apply Biome's lint fixes, unsafe ones included, its assist actions and formatting, then format again.\nexceptions migrate Move legacy registry entries and Biome declarations into quality.config.ts exceptions and remove matching root overrides.\nbaseline merge Merge Git baseline versions into <current>: deletions win and counts take the minimum.\nbaseline install-driver Configure only the repository-local merge.quality-baseline.driver setting.\nbaseline write Record current error-level violations. Creates the baseline, or records the named rules again, replacing their entries.\nbaseline prune Drop fixed debt, lower entries to what is left and carry entries to files git saw move. Never adds or raises an entry.\nbaseline tighten Prune only the entries of files changed since HEAD, or with --staged, in the index.\nbaseline migrate Move a JSON or JSON Lines baseline (--from, quality/baseline.json by default) into root and package shards.\nhooks install Install the git pre-commit hook, shared by every worktree, that runs hooks pre-commit. Keeps a hook that is not quality's\n unless --force replaces it.\nhooks uninstall Remove quality's pre-commit hook. Keeps a hook that is not quality's.\nhooks status Check that git's effective hooks path runs Quality's pre-commit hook and report global chaining.\nhooks pre-commit What the hook runs: lint, then package.json scripts typecheck and quality:commit when present.\n\n--config <file> Config file; its directory is the repository root. Without this option, uses ./quality.config.ts when present, otherwise defaults.\n--against <ref> The branch the work merges into, whose merge base prune follows moves from. Defaults to origin/HEAD, then origin/main, then origin/master.\nExit codes: 0 passed, 1 failed the gate, 2 could not run.";
2
2
  export declare const SUBCOMMANDS: Readonly<Record<string, string>>;
3
3
  //# sourceMappingURL=messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/cli/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,01EA6BwC,CAAC;AAE3D,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIxD,CAAC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/cli/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,8nFAiCwC,CAAC;AAE3D,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIxD,CAAC"}
@@ -2,6 +2,8 @@ export const USAGE = `Usage:
2
2
  quality lint [--config <file>]
3
3
  quality fix [--config <file>]
4
4
  quality exceptions migrate [--config <file>] [--from <registry>]
5
+ quality baseline merge <ancestor> <current> <other>
6
+ quality baseline install-driver
5
7
  quality baseline write [--config <file>] [--rule <id>]...
6
8
  quality baseline prune [--config <file>] [--against <ref>]
7
9
  quality baseline tighten [--config <file>] [--staged]
@@ -15,10 +17,12 @@ lint Run every rule. Exits 1 on an error-level violation, a file ov
15
17
  or a baseline entry for an unknown rule.
16
18
  fix Sort every package.json, apply Biome's lint fixes, unsafe ones included, its assist actions and formatting, then format again.
17
19
  exceptions migrate Move legacy registry entries and Biome declarations into quality.config.ts exceptions and remove matching root overrides.
20
+ baseline merge Merge Git baseline versions into <current>: deletions win and counts take the minimum.
21
+ baseline install-driver Configure only the repository-local merge.quality-baseline.driver setting.
18
22
  baseline write Record current error-level violations. Creates the baseline, or records the named rules again, replacing their entries.
19
23
  baseline prune Drop fixed debt, lower entries to what is left and carry entries to files git saw move. Never adds or raises an entry.
20
24
  baseline tighten Prune only the entries of files changed since HEAD, or with --staged, in the index.
21
- baseline migrate Move a baseline from the earlier JSON format (--from, quality/baseline.json by default) to the configured file.
25
+ baseline migrate Move a JSON or JSON Lines baseline (--from, quality/baseline.json by default) into root and package shards.
22
26
  hooks install Install the git pre-commit hook, shared by every worktree, that runs hooks pre-commit. Keeps a hook that is not quality's
23
27
  unless --force replaces it.
24
28
  hooks uninstall Remove quality's pre-commit hook. Keeps a hook that is not quality's.
@@ -29,7 +33,7 @@ hooks pre-commit What the hook runs: lint, then package.json scripts typecheck
29
33
  --against <ref> The branch the work merges into, whose merge base prune follows moves from. Defaults to origin/HEAD, then origin/main, then origin/master.
30
34
  Exit codes: 0 passed, 1 failed the gate, 2 could not run.`;
31
35
  export const SUBCOMMANDS = {
32
- baseline: "baseline takes write, prune, tighten or migrate.",
36
+ baseline: "baseline takes write, prune, tighten, migrate, merge or install-driver.",
33
37
  exceptions: "exceptions takes migrate.",
34
38
  hooks: "hooks takes install, uninstall, status or pre-commit.",
35
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/cli/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DA6BqC,CAAC;AAE3D,MAAM,CAAC,MAAM,WAAW,GAAqC;IAC5D,QAAQ,EAAE,kDAAkD;IAC5D,UAAU,EAAE,2BAA2B;IACvC,KAAK,EAAE,uDAAuD;CAC9D,CAAC"}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/cli/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAiCqC,CAAC;AAE3D,MAAM,CAAC,MAAM,WAAW,GAAqC;IAC5D,QAAQ,EAAE,yEAAyE;IACnF,UAAU,EAAE,2BAA2B;IACvC,KAAK,EAAE,uDAAuD;CAC9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/cli/migrate.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOrD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,eAAO,MAAM,eAAe,qIAsB1B,CAAC"}
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/cli/migrate.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQrD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,eAAe,qIA0B1B,CAAC"}
@@ -1,28 +1,32 @@
1
1
  import { join } from "node:path";
2
2
  import { Console, Effect, FileSystem } from "effect";
3
- import { encodeBaseline } from "#baseline/format.ts";
3
+ import { decodeBaseline } from "#baseline/format.ts";
4
4
  import { convertLegacy, decodeLegacyBaseline, LEGACY_BASELINE } from "#baseline/legacy.ts";
5
+ import { saveShards, shardPaths } from "#baseline/shards.ts";
5
6
  import { loadConfig } from "#config/load.ts";
6
7
  import { validOrFail } from "#decoded.ts";
7
8
  import { readInput } from "#engine/baselineFile.ts";
8
9
  import { scan } from "#engine/session.ts";
9
10
  import { SetupFailure } from "#failure.ts";
10
- import { writeText } from "#inventory/filesystem.ts";
11
11
  import { plural } from "#report/plural.ts";
12
12
  export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (cwd, configPath, from) {
13
13
  const config = yield* loadConfig(cwd, configPath);
14
14
  const source = from ?? LEGACY_BASELINE;
15
- if (source === config.baseline || (yield* readInput(config.root, config.baseline)) !== undefined) {
15
+ const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
16
+ const existing = yield* Effect.forEach(paths, (path) => readInput(config.root, path));
17
+ if (source === config.baseline || existing.some((text) => text !== undefined)) {
16
18
  return yield* new SetupFailure({ message: `${config.baseline} already exists. Migrate into a baseline file that does not exist yet.` });
17
19
  }
18
20
  const raw = yield* readInput(config.root, source);
19
21
  if (raw === undefined) {
20
22
  return yield* new SetupFailure({ message: `no baseline at ${source} to migrate. Name it with --from <file>.` });
21
23
  }
22
- const legacy = yield* validOrFail(source, yield* Effect.promise(() => decodeLegacyBaseline(raw)));
23
- const entries = convertLegacy(legacy, (yield* scan(config)).violations);
24
+ const legacy = source.endsWith(".jsonl")
25
+ ? yield* validOrFail(source, yield* Effect.promise(() => decodeBaseline(raw)))
26
+ : yield* validOrFail(source, yield* Effect.promise(() => decodeLegacyBaseline(raw)));
27
+ const entries = source.endsWith(".jsonl") ? legacy : convertLegacy(legacy, (yield* scan(config)).violations);
24
28
  const fs = yield* FileSystem.FileSystem;
25
- const written = Effect.andThen(writeText(join(config.root, config.baseline), encodeBaseline(entries)), fs.remove(join(config.root, source)));
29
+ const written = Effect.andThen(saveShards(config, new Map(), entries), fs.remove(join(config.root, source)));
26
30
  yield* Effect.mapError(written, (failure) => new SetupFailure({ message: failure.message }));
27
31
  const fixed = legacy.length - entries.length;
28
32
  const dropped = fixed > 0 ? `, dropping ${plural(fixed, "fixed entry", "fixed entries")}` : "";
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/cli/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,EACxE,GAAW,EACX,UAA8B,EAC9B,IAAwB;IAExB,MAAM,M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AC,CAAC,cAAc,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/F,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,MAAM,OAAO,MAAM,CAAC,QAAQ,GAAG,OAAO,GAAG,CAAC,CAAC;AACpI,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,OAAO,kOAgClB,CAAC"}
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,OAAO,kOAoClB,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { Console, Effect } from "effect";
2
+ import { installDriver } from "#baseline/installDriver.ts";
3
+ import { mergeBaseline } from "#baseline/merge.ts";
2
4
  import { parseCommand, USAGE } from "#cli/args.ts";
3
5
  import { writeBaseline } from "#cli/baseline.ts";
4
6
  import { fix } from "#cli/fix.ts";
@@ -24,6 +26,10 @@ export const program = Effect.fn("Cli.program")(function* (args, { cwd, launch }
24
26
  return yield* lint(cwd, command.config);
25
27
  case "Fix":
26
28
  return yield* fix(cwd, command.config);
29
+ case "BaselineMerge":
30
+ return yield* mergeBaseline(command.base, command.ours, command.theirs);
31
+ case "BaselineInstallDriver":
32
+ return yield* installDriver(cwd, launch);
27
33
  case "BaselineWrite":
28
34
  return yield* writeBaseline(cwd, command.config, command.rules);
29
35
  case "BaselinePrune":
@@ -1 +1 @@
1
- {"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,E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AAK,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACjE,KAAK,eAAe;YACnB,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACnE,KAAK,iBAAiB;YACrB,OAAO,KAAK,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACpE,KAAK,mBAAmB;YACvB,OAAO,KAAK,CAAC,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpE,KAAK,iBAAiB;YACrB,OAAO,KAAK,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAClE,KAAK,cAAc;YAClB,OAAO,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1F,KAAK,gBAAgB;YACpB,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAClC,KAAK,aAAa;YACjB,OAAO,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,gBAAgB;YACpB,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;AACF,CAAC,CAAC,CAAC"}
@@ -36,7 +36,7 @@ function biomeDeclarations(config) {
36
36
  function resolved(root, file, config, rules) {
37
37
  return {
38
38
  ...rules,
39
- baseline: config.baseline ?? "quality/baseline.jsonl",
39
+ baseline: config.baseline ?? "quality-baseline.jsonl",
40
40
  biomeDeclarations: biomeDeclarations(config),
41
41
  exceptions: config.exceptions ?? [],
42
42
  exclude: [],
@@ -1,10 +1,11 @@
1
1
  import { Effect, type FileSystem } from "effect";
2
2
  import { type BaselineEntry } from "#baseline/format.ts";
3
+ import { type Shard } from "#baseline/shards.ts";
3
4
  import type { ResolvedConfig } from "#config/load.ts";
4
5
  import { SetupFailure } from "#failure.ts";
5
6
  export interface BaselineFile {
6
7
  readonly entries: readonly BaselineEntry[];
7
- readonly raw: string | undefined;
8
+ readonly files: ReadonlyMap<string, Shard>;
8
9
  }
9
10
  export declare function readInput(root: string, path: string): Effect.Effect<string | undefined, SetupFailure, FileSystem.FileSystem>;
10
11
  export declare const readBaseline: (config: ResolvedConfig) => Effect.Effect<BaselineFile, SetupFailure, FileSystem.FileSystem>;
@@ -1 +1 @@
1
- {"version":3,"file":"baselineFile.d.ts","sourceRoot":"","sources":["../../src/engine/baselineFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,CAE5H;AAED,eAAO,MAAM,YAAY,8FAUvB,CAAC"}
1
+ {"version":3,"file":"baselineFile.d.ts","sourceRoot":"","sources":["../../src/engine/baselineFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,KAAK,KAAK,EAAuB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC3C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,CAE5H;AAED,eAAO,MAAM,YAAY,8FA0BvB,CAAC"}
@@ -2,6 +2,7 @@ import { join } from "node:path";
2
2
  import { Effect } from "effect";
3
3
  import { decodeBaseline } from "#baseline/format.ts";
4
4
  import { LEGACY_BASELINE } from "#baseline/legacy.ts";
5
+ import { shardOf, shardPaths } from "#baseline/shards.ts";
5
6
  import { validOrFail } from "#decoded.ts";
6
7
  import { SetupFailure } from "#failure.ts";
7
8
  import { readOptionalText } from "#inventory/filesystem.ts";
@@ -9,12 +10,28 @@ export function readInput(root, path) {
9
10
  return Effect.mapError(readOptionalText(join(root, path)), (failure) => new SetupFailure({ message: failure.message }));
10
11
  }
11
12
  export const readBaseline = Effect.fn("Engine.readBaseline")(function* (config) {
12
- const raw = yield* readInput(config.root, config.baseline);
13
- if (raw === undefined && config.baseline !== LEGACY_BASELINE && (yield* readInput(config.root, LEGACY_BASELINE)) !== undefined) {
14
- return yield* new SetupFailure({
15
- message: `${LEGACY_BASELINE} holds a baseline in the earlier JSON format. Run \`quality baseline migrate\` to move it to ${config.baseline}.`,
16
- });
13
+ const files = new Map();
14
+ for (const path of yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })))) {
15
+ const raw = yield* readInput(config.root, path);
16
+ if (raw === undefined) {
17
+ continue;
18
+ }
19
+ const entries = yield* validOrFail(path, yield* Effect.promise(() => decodeBaseline(raw)));
20
+ for (const entry of entries) {
21
+ const expected = shardOf(entry.file, config.baseline);
22
+ if (expected !== path) {
23
+ return yield* new SetupFailure({ message: `${entry.file} belongs in ${expected}, not ${path}.` });
24
+ }
25
+ }
26
+ files.set(path, { entries, raw });
17
27
  }
18
- return { entries: yield* validOrFail(config.baseline, yield* Effect.promise(() => decodeBaseline(raw))), raw };
28
+ for (const source of ["quality/baseline.jsonl", LEGACY_BASELINE]) {
29
+ if (source !== config.baseline && (yield* readInput(config.root, source)) !== undefined) {
30
+ return yield* new SetupFailure({
31
+ message: `${source} holds an earlier baseline. Run \`quality baseline migrate --from ${source}\` to move it to ${config.baseline} and package shards.`,
32
+ });
33
+ }
34
+ }
35
+ return { entries: [...files.values()].flatMap((file) => file.entries), files };
19
36
  });
20
37
  //# sourceMappingURL=baselineFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"baselineFile.js","sourceRoot":"","sources":["../../src/engine/baselineFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAsB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAO5D,MAAM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AC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC3F,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACvB,OAAO,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,eAAe,QAAQ,SAAS,IAAI,GAAG,EAAE,CAAC,CAAC;YACnG,CAAC;QACF,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,EAAE,CAAC;QAClE,IAAI,MAAM,KAAK,MAAM,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACzF,OAAO,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC;gBAC9B,OAAO,EAAE,GAAG,MAAM,qEAAqE,MAAM,oBAAoB,MAAM,CAAC,QAAQ,sBAAsB;aACtJ,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC;AAChF,CAAC,CAAC,CAAC"}
@@ -9,23 +9,26 @@ The [README](../README.md) introduces the gate. This page explains how the basel
9
9
  {"path":"src/server/db.ts","rule":"structure/max-lines","count":262}
10
10
  ```
11
11
 
12
- The baseline is a JSON Lines file with one entry per line: the violations of one rule in one file. `count` is how many violations the file may have. For a rule that counts occurrences, such as `comments/no-jsdoc`, that is the number of occurrences. For a rule with a limit, it is the amount over the limit: the entry above lets `src/server/db.ts` have 412 lines under a limit of 150. A new baseline is sorted by path and then rule. Later edits preserve unrelated lines, including their formatting and order, so the diff shows the entries that changed.
12
+ The baseline is sharded: `packages/<package>/quality-baseline.jsonl` holds paths inside that package, and the root `quality-baseline.jsonl` holds all other paths. Packages without entries have no file. Each shard is JSON Lines with one entry per line: the violations of one rule in one file. `count` is how many violations the file may have. For a rule that counts occurrences, such as `comments/no-jsdoc`, that is the number of occurrences. For a rule with a limit, it is the amount over the limit: the entry above lets `src/server/db.ts` have 412 lines under a limit of 150. A new baseline is sorted by path and then rule. Later edits preserve unrelated lines, including their formatting and order, so the diff shows the entries that changed.
13
13
 
14
14
  `quality lint` fails when a baselined file has more violations than its `count`; the report then lists all of that file's violations for the rule. A file at or below its entry passes. An entry that allows more than is left, including a file with no violations left, is listed as a note and does not fail, so fixing debt never breaks the build; `tighten` and `prune` lower it. An entry for an unknown rule fails until it is pruned.
15
15
 
16
16
  - `quality baseline write` records every error-level violation when there is no baseline yet. Once a baseline exists it refuses, unless `--rule <id>` names the rules to record: it then replaces the entries of those rules with what the files have now, and leaves every other entry as it is.
17
17
  - `quality baseline tighten` lowers and removes the entries of files changed since `HEAD`, and with `--staged`, of the files staged for the next commit. It carries the entry of a file that git sees as moved to the new path. Every other line stays byte for byte.
18
18
  - `quality baseline prune` does the same for every entry. It carries the entries of files moved since the merge base (see `--against` under [Command line](../README.md#command-line)), and prunes without following moves outside a git work tree.
19
- - `quality baseline migrate` moves a baseline from the earlier JSON format, `quality/baseline.json` or the file `--from` names, to the configured file, and removes the old one. An old entry that stored a size, such as a line count, becomes that size less the rule's current limit; an entry whose file is now within the limit is dropped.
19
+ - `quality baseline migrate` moves a baseline from the earlier JSON format, `quality/baseline.json` or the file `--from` names, to the root and package shards, and removes the old one. `--from quality/baseline.jsonl` splits a single JSON Lines baseline without changing its counts. An old entry that stored a size, such as a line count, becomes that size less the rule's current limit; an entry whose file is now within the limit is dropped.
20
20
 
21
21
  Neither `tighten` nor `prune` ever adds or raises an entry. They lower an entry to what its file has now, and remove it when that is 0. A moved file's entry keeps the lower of its old count and what the file has now. A move is seen when both of its sides are tracked, as after `git mv`; git's rename detection decides what counts as a move.
22
22
 
23
+ Git merges shards through the driver described in the [README](../README.md#baseline-merges). `quality baseline install-driver` configures the current checkout; deletions win and retained counts take the minimum.
24
+
23
25
  ### Pre-commit
24
26
 
25
27
  Lowering entries in the commit that fixes them keeps the baseline current. Run these commands explicitly before committing:
26
28
 
27
29
  ```sh
28
- quality baseline tighten --staged && git add quality/baseline.jsonl
30
+ quality baseline tighten --staged
31
+ git add -- '**/quality-baseline.jsonl' quality-baseline.jsonl
29
32
  quality lint
30
33
  ```
31
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/quality",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
6
6
  "bugs": {
@@ -0,0 +1,12 @@
1
+ import { Console, Effect } from "effect";
2
+ import type { SetupFailure } from "#failure.ts";
3
+ import { type Git, gitOrFail } from "#git/command.ts";
4
+ import { hookCommand, type Launch, shellWords } from "#hooks/command.ts";
5
+
6
+ export const installDriver = Effect.fn("Baseline.installDriver")(function* (cwd: string, launch: Launch): Effect.fn.Return<void, SetupFailure, Git> {
7
+ const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
8
+ const command = hookCommand(root, launch, undefined);
9
+ const driver = `${shellWords([...command.runner, command.launcher, "baseline", "merge"])} "%O" "%A" "%B"`;
10
+ yield* gitOrFail(root, ["config", "--local", "merge.quality-baseline.driver", driver]);
11
+ yield* Console.log("quality: configured the repository-local quality-baseline merge driver.");
12
+ });
@@ -0,0 +1,34 @@
1
+ import { Effect, FileSystem } from "effect";
2
+ import { type BaselineEntry, decodeBaseline, encodeBaseline } from "#baseline/format.ts";
3
+ import { validOrFail } from "#decoded.ts";
4
+ import { keyOf } from "#engine/violation.ts";
5
+ import { SetupFailure } from "#failure.ts";
6
+
7
+ function mergeEntries(base: readonly BaselineEntry[], ours: readonly BaselineEntry[], theirs: readonly BaselineEntry[]): readonly BaselineEntry[] {
8
+ const original = new Set(base.map((entry) => keyOf(entry.rule, entry.file)));
9
+ const left = new Map(ours.map((entry) => [keyOf(entry.rule, entry.file), entry]));
10
+ const right = new Map(theirs.map((entry) => [keyOf(entry.rule, entry.file), entry]));
11
+ return [...new Set([...left.keys(), ...right.keys()])].flatMap((key) => {
12
+ const a = left.get(key);
13
+ const b = right.get(key);
14
+ if (original.has(key) && (a === undefined || b === undefined)) {
15
+ return [];
16
+ }
17
+ const entry = a ?? b;
18
+ return entry === undefined ? [] : [{ ...entry, count: Math.min(a?.count ?? entry.count, b?.count ?? entry.count) }];
19
+ });
20
+ }
21
+
22
+ export const mergeBaseline = Effect.fn("Baseline.mergeBaseline")(
23
+ function* (base: string, ours: string, theirs: string) {
24
+ const fs = yield* FileSystem.FileSystem;
25
+ const entries = yield* Effect.forEach([base, ours, theirs], (path) =>
26
+ Effect.gen(function* () {
27
+ const raw = yield* fs.readFileString(path);
28
+ return yield* validOrFail(path, yield* Effect.promise(() => decodeBaseline(raw)));
29
+ }),
30
+ );
31
+ yield* fs.writeFileString(ours, encodeBaseline(mergeEntries(entries[0] ?? [], entries[1] ?? [], entries[2] ?? [])));
32
+ },
33
+ Effect.mapError((failure) => new SetupFailure({ message: failure.message })),
34
+ );
@@ -6,7 +6,6 @@ interface Row {
6
6
  readonly text: string;
7
7
  }
8
8
 
9
- // An untouched entry keeps its exact line and a new one goes before the first line that sorts after it, so two branches conflict only on the same or neighbouring entries.
10
9
  export function rewriteBaseline(raw: string | undefined, before: readonly BaselineEntry[], after: readonly BaselineEntry[]): string {
11
10
  const wanted = new Map(after.map((entry) => [keyOf(entry.rule, entry.file), entry]));
12
11
  const lines = linesOf(raw);
@@ -0,0 +1,60 @@
1
+ import { join } from "node:path";
2
+ import { Effect, FileSystem } from "effect";
3
+ import type { BaselineEntry } from "#baseline/format.ts";
4
+ import { rewriteBaseline } from "#baseline/rewrite.ts";
5
+ import type { ResolvedConfig } from "#config/load.ts";
6
+ import { SetupFailure } from "#failure.ts";
7
+ import { orWhenAbsent, writeText } from "#inventory/filesystem.ts";
8
+
9
+ export const SHARD_NAME = "quality-baseline.jsonl";
10
+
11
+ export interface Shard {
12
+ readonly entries: readonly BaselineEntry[];
13
+ readonly raw: string;
14
+ }
15
+
16
+ export function shardOf(file: string, rootFile: string): string {
17
+ const [folder, name, ...rest] = file.split("/");
18
+ return folder === "packages" && name !== undefined && rest.length > 0 ? `packages/${name}/${SHARD_NAME}` : rootFile;
19
+ }
20
+
21
+ export const shardPaths = Effect.fn("Baseline.shardPaths")(function* (config: ResolvedConfig) {
22
+ const fs = yield* FileSystem.FileSystem;
23
+ const folder = join(config.root, "packages");
24
+ const names = yield* orWhenAbsent(folder, fs.readDirectory(folder), []);
25
+ const paths = [config.baseline];
26
+ for (const name of names) {
27
+ if ((yield* fs.stat(join(folder, name))).type === "Directory") {
28
+ paths.push(`packages/${name}/${SHARD_NAME}`);
29
+ }
30
+ }
31
+ return paths;
32
+ });
33
+
34
+ export const saveShards = Effect.fn("Baseline.saveShards")(
35
+ function* (config: ResolvedConfig, before: ReadonlyMap<string, Shard>, entries: readonly BaselineEntry[]) {
36
+ const fs = yield* FileSystem.FileSystem;
37
+ const grouped = new Map<string, BaselineEntry[]>();
38
+ for (const entry of entries) {
39
+ const path = shardOf(entry.file, config.baseline);
40
+ const group = grouped.get(path) ?? [];
41
+ group.push(entry);
42
+ grouped.set(path, group);
43
+ }
44
+ for (const path of new Set([...before.keys(), ...grouped.keys()])) {
45
+ const old = before.get(path);
46
+ const next = grouped.get(path) ?? [];
47
+ if (next.length === 0) {
48
+ if (old !== undefined) {
49
+ yield* fs.remove(join(config.root, path));
50
+ }
51
+ } else {
52
+ const text = rewriteBaseline(old?.raw, old?.entries ?? [], next);
53
+ if (text !== old?.raw) {
54
+ yield* writeText(join(config.root, path), text);
55
+ }
56
+ }
57
+ }
58
+ },
59
+ Effect.mapError((failure) => new SetupFailure({ message: failure.message })),
60
+ );
package/src/cli/args.ts CHANGED
@@ -6,6 +6,8 @@ export type Command =
6
6
  | { readonly _tag: "Lint"; readonly config: string | undefined }
7
7
  | { readonly _tag: "ExceptionsMigrate"; readonly config: string | undefined; readonly from: string | undefined }
8
8
  | { readonly _tag: "Fix"; readonly config: string | undefined }
9
+ | { readonly _tag: "BaselineMerge"; readonly base: string; readonly ours: string; readonly theirs: string }
10
+ | { readonly _tag: "BaselineInstallDriver" }
9
11
  | { readonly _tag: "BaselineWrite"; readonly config: string | undefined; readonly rules: readonly string[] }
10
12
  | { readonly _tag: "BaselinePrune"; readonly config: string | undefined; readonly against: string | undefined }
11
13
  | { readonly _tag: "BaselineTighten"; readonly config: string | undefined; readonly staged: boolean }
@@ -45,6 +47,7 @@ type Option = Exclude<keyof Values, "config" | "help">;
45
47
  const COMMAND_OPTIONS: readonly Option[] = ["against", "force", "from", "rule", "staged"];
46
48
 
47
49
  const ACCEPTS: Readonly<Record<string, readonly Option[]>> = {
50
+ "baseline install-driver": [],
48
51
  "baseline migrate": ["from"],
49
52
  "baseline prune": ["against"],
50
53
  "baseline tighten": ["staged"],
@@ -77,6 +80,8 @@ function commandFor(name: string, values: Values): Parsed {
77
80
  return parsed({ _tag: "ExceptionsMigrate", config, from: values.from });
78
81
  case "fix":
79
82
  return parsed({ _tag: "Fix", config });
83
+ case "baseline install-driver":
84
+ return parsed({ _tag: "BaselineInstallDriver" });
80
85
  case "baseline write":
81
86
  return parsed({ _tag: "BaselineWrite", config, rules: values.rule ?? [] });
82
87
  case "baseline prune":
@@ -109,6 +114,12 @@ export function parseCommand(args: readonly string[]): Parsed {
109
114
  if (values.help === true || command === "help") {
110
115
  return parsed({ _tag: "Help" });
111
116
  }
117
+ if (command === "baseline" && rest[0] === "merge") {
118
+ const [, base, ours, theirs] = rest;
119
+ return rest.length === 4 && base !== undefined && ours !== undefined && theirs !== undefined
120
+ ? parsed({ _tag: "BaselineMerge", base, ours, theirs })
121
+ : usage("baseline merge takes <ancestor> <current> <other>.");
122
+ }
112
123
  const name = [command, ...rest].join(" ");
113
124
  if (ACCEPTS[name] === undefined) {
114
125
  const subcommands = SUBCOMMANDS[command];
@@ -1,19 +1,14 @@
1
- import { join } from "node:path";
2
1
  import { Console, Effect, type FileSystem } from "effect";
3
2
  import type { BaselineEntry } from "#baseline/format.ts";
4
- import { rewriteBaseline } from "#baseline/rewrite.ts";
3
+ import { saveShards } from "#baseline/shards.ts";
5
4
  import { adopt, type Pruned, prune, type Scope } from "#baseline/update.ts";
6
5
  import { openSession, type Session } from "#engine/session.ts";
7
6
  import { applyRegistry } from "#exceptions/registry.ts";
8
7
  import { SetupFailure } from "#failure.ts";
9
- import { writeText } from "#inventory/filesystem.ts";
10
8
  import { plural } from "#report/plural.ts";
11
9
 
12
10
  function save(session: Session, entries: readonly BaselineEntry[]): Effect.Effect<void, SetupFailure, FileSystem.FileSystem> {
13
- return Effect.mapError(
14
- writeText(join(session.config.root, session.config.baseline), rewriteBaseline(session.baseline.raw, session.baseline.entries, entries)),
15
- (failure) => new SetupFailure({ message: failure.message }),
16
- );
11
+ return saveShards(session.config, session.baseline.files, entries);
17
12
  }
18
13
 
19
14
  function unregistered(session: Session) {
@@ -26,7 +21,7 @@ export const writeBaseline = Effect.fn("Cli.writeBaseline")(function* (
26
21
  rules: readonly string[],
27
22
  ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
28
23
  const session = yield* openSession(cwd, config);
29
- const existing = session.baseline.raw === undefined ? undefined : session.baseline.entries;
24
+ const existing = session.baseline.files.size === 0 ? undefined : session.baseline.entries;
30
25
  const adoption = adopt(existing, rules, unregistered(session), session.config);
31
26
  if (adoption._tag === "Refused") {
32
27
  return yield* new SetupFailure({ message: `baseline write refused:\n${adoption.reasons.map((reason) => ` - ${reason}`).join("\n")}` });
@@ -54,11 +49,12 @@ export const shrinkBaseline = Effect.fn("Cli.shrinkBaseline")(function* <TRequir
54
49
  scopeOf: (session: Session) => Effect.Effect<Scope, SetupFailure, TRequirements>,
55
50
  ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem | TRequirements> {
56
51
  const session = yield* openSession(cwd, config);
57
- if (session.baseline.raw === undefined) {
52
+ if (session.baseline.files.size === 0) {
58
53
  return yield* Console.log(`quality: no baseline at ${session.config.baseline}; nothing to lower.`);
59
54
  }
60
55
  const pruned = prune(session.baseline.entries, unregistered(session), session.config, yield* scopeOf(session));
61
- if (pruned.removed === 0 && pruned.lowered === 0 && pruned.moved === 0) {
56
+ const emptyShard = [...session.baseline.files.values()].some((file) => file.entries.length === 0);
57
+ if (pruned.removed === 0 && pruned.lowered === 0 && pruned.moved === 0 && !emptyShard) {
62
58
  return yield* Console.log(`quality: ${session.config.baseline} is current.`);
63
59
  }
64
60
  yield* save(session, pruned.entries);
@@ -2,6 +2,8 @@ export const USAGE = `Usage:
2
2
  quality lint [--config <file>]
3
3
  quality fix [--config <file>]
4
4
  quality exceptions migrate [--config <file>] [--from <registry>]
5
+ quality baseline merge <ancestor> <current> <other>
6
+ quality baseline install-driver
5
7
  quality baseline write [--config <file>] [--rule <id>]...
6
8
  quality baseline prune [--config <file>] [--against <ref>]
7
9
  quality baseline tighten [--config <file>] [--staged]
@@ -15,10 +17,12 @@ lint Run every rule. Exits 1 on an error-level violation, a file ov
15
17
  or a baseline entry for an unknown rule.
16
18
  fix Sort every package.json, apply Biome's lint fixes, unsafe ones included, its assist actions and formatting, then format again.
17
19
  exceptions migrate Move legacy registry entries and Biome declarations into quality.config.ts exceptions and remove matching root overrides.
20
+ baseline merge Merge Git baseline versions into <current>: deletions win and counts take the minimum.
21
+ baseline install-driver Configure only the repository-local merge.quality-baseline.driver setting.
18
22
  baseline write Record current error-level violations. Creates the baseline, or records the named rules again, replacing their entries.
19
23
  baseline prune Drop fixed debt, lower entries to what is left and carry entries to files git saw move. Never adds or raises an entry.
20
24
  baseline tighten Prune only the entries of files changed since HEAD, or with --staged, in the index.
21
- baseline migrate Move a baseline from the earlier JSON format (--from, quality/baseline.json by default) to the configured file.
25
+ baseline migrate Move a JSON or JSON Lines baseline (--from, quality/baseline.json by default) into root and package shards.
22
26
  hooks install Install the git pre-commit hook, shared by every worktree, that runs hooks pre-commit. Keeps a hook that is not quality's
23
27
  unless --force replaces it.
24
28
  hooks uninstall Remove quality's pre-commit hook. Keeps a hook that is not quality's.
@@ -30,7 +34,7 @@ hooks pre-commit What the hook runs: lint, then package.json scripts typecheck
30
34
  Exit codes: 0 passed, 1 failed the gate, 2 could not run.`;
31
35
 
32
36
  export const SUBCOMMANDS: Readonly<Record<string, string>> = {
33
- baseline: "baseline takes write, prune, tighten or migrate.",
37
+ baseline: "baseline takes write, prune, tighten, migrate, merge or install-driver.",
34
38
  exceptions: "exceptions takes migrate.",
35
39
  hooks: "hooks takes install, uninstall, status or pre-commit.",
36
40
  };
@@ -1,13 +1,13 @@
1
1
  import { join } from "node:path";
2
2
  import { Console, Effect, FileSystem } from "effect";
3
- import { encodeBaseline } from "#baseline/format.ts";
3
+ import { decodeBaseline } from "#baseline/format.ts";
4
4
  import { convertLegacy, decodeLegacyBaseline, LEGACY_BASELINE } from "#baseline/legacy.ts";
5
+ import { saveShards, shardPaths } from "#baseline/shards.ts";
5
6
  import { loadConfig } from "#config/load.ts";
6
7
  import { validOrFail } from "#decoded.ts";
7
8
  import { readInput } from "#engine/baselineFile.ts";
8
9
  import { scan } from "#engine/session.ts";
9
10
  import { SetupFailure } from "#failure.ts";
10
- import { writeText } from "#inventory/filesystem.ts";
11
11
  import { plural } from "#report/plural.ts";
12
12
 
13
13
  export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
@@ -17,17 +17,21 @@ export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
17
17
  ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
18
18
  const config = yield* loadConfig(cwd, configPath);
19
19
  const source = from ?? LEGACY_BASELINE;
20
- if (source === config.baseline || (yield* readInput(config.root, config.baseline)) !== undefined) {
20
+ const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
21
+ const existing = yield* Effect.forEach(paths, (path) => readInput(config.root, path));
22
+ if (source === config.baseline || existing.some((text) => text !== undefined)) {
21
23
  return yield* new SetupFailure({ message: `${config.baseline} already exists. Migrate into a baseline file that does not exist yet.` });
22
24
  }
23
25
  const raw = yield* readInput(config.root, source);
24
26
  if (raw === undefined) {
25
27
  return yield* new SetupFailure({ message: `no baseline at ${source} to migrate. Name it with --from <file>.` });
26
28
  }
27
- const legacy = yield* validOrFail(source, yield* Effect.promise(() => decodeLegacyBaseline(raw)));
28
- const entries = convertLegacy(legacy, (yield* scan(config)).violations);
29
+ const legacy = source.endsWith(".jsonl")
30
+ ? yield* validOrFail(source, yield* Effect.promise(() => decodeBaseline(raw)))
31
+ : yield* validOrFail(source, yield* Effect.promise(() => decodeLegacyBaseline(raw)));
32
+ const entries = source.endsWith(".jsonl") ? legacy : convertLegacy(legacy, (yield* scan(config)).violations);
29
33
  const fs = yield* FileSystem.FileSystem;
30
- const written = Effect.andThen(writeText(join(config.root, config.baseline), encodeBaseline(entries)), fs.remove(join(config.root, source)));
34
+ const written = Effect.andThen(saveShards(config, new Map(), entries), fs.remove(join(config.root, source)));
31
35
  yield* Effect.mapError(written, (failure) => new SetupFailure({ message: failure.message }));
32
36
  const fixed = legacy.length - entries.length;
33
37
  const dropped = fixed > 0 ? `, dropping ${plural(fixed, "fixed entry", "fixed entries")}` : "";
@@ -1,4 +1,6 @@
1
1
  import { Console, Effect } from "effect";
2
+ import { installDriver } from "#baseline/installDriver.ts";
3
+ import { mergeBaseline } from "#baseline/merge.ts";
2
4
  import { parseCommand, USAGE } from "#cli/args.ts";
3
5
  import { writeBaseline } from "#cli/baseline.ts";
4
6
  import { fix } from "#cli/fix.ts";
@@ -31,6 +33,10 @@ export const program = Effect.fn("Cli.program")(function* (args: readonly string
31
33
  return yield* lint(cwd, command.config);
32
34
  case "Fix":
33
35
  return yield* fix(cwd, command.config);
36
+ case "BaselineMerge":
37
+ return yield* mergeBaseline(command.base, command.ours, command.theirs);
38
+ case "BaselineInstallDriver":
39
+ return yield* installDriver(cwd, launch);
34
40
  case "BaselineWrite":
35
41
  return yield* writeBaseline(cwd, command.config, command.rules);
36
42
  case "BaselinePrune":
@@ -49,7 +49,7 @@ function biomeDeclarations(config: ConfigInput): readonly Declaration[] {
49
49
  function resolved(root: string, file: string, config: ConfigInput, rules: ResolvedRules): ResolvedConfig {
50
50
  return {
51
51
  ...rules,
52
- baseline: config.baseline ?? "quality/baseline.jsonl",
52
+ baseline: config.baseline ?? "quality-baseline.jsonl",
53
53
  biomeDeclarations: biomeDeclarations(config),
54
54
  exceptions: config.exceptions ?? [],
55
55
  exclude: [],
@@ -2,6 +2,7 @@ import { join } from "node:path";
2
2
  import { Effect, type FileSystem } from "effect";
3
3
  import { type BaselineEntry, decodeBaseline } from "#baseline/format.ts";
4
4
  import { LEGACY_BASELINE } from "#baseline/legacy.ts";
5
+ import { type Shard, shardOf, shardPaths } from "#baseline/shards.ts";
5
6
  import type { ResolvedConfig } from "#config/load.ts";
6
7
  import { validOrFail } from "#decoded.ts";
7
8
  import { SetupFailure } from "#failure.ts";
@@ -9,7 +10,7 @@ import { readOptionalText } from "#inventory/filesystem.ts";
9
10
 
10
11
  export interface BaselineFile {
11
12
  readonly entries: readonly BaselineEntry[];
12
- readonly raw: string | undefined;
13
+ readonly files: ReadonlyMap<string, Shard>;
13
14
  }
14
15
 
15
16
  export function readInput(root: string, path: string): Effect.Effect<string | undefined, SetupFailure, FileSystem.FileSystem> {
@@ -19,11 +20,27 @@ export function readInput(root: string, path: string): Effect.Effect<string | un
19
20
  export const readBaseline = Effect.fn("Engine.readBaseline")(function* (
20
21
  config: ResolvedConfig,
21
22
  ): Effect.fn.Return<BaselineFile, SetupFailure, FileSystem.FileSystem> {
22
- const raw = yield* readInput(config.root, config.baseline);
23
- if (raw === undefined && config.baseline !== LEGACY_BASELINE && (yield* readInput(config.root, LEGACY_BASELINE)) !== undefined) {
24
- return yield* new SetupFailure({
25
- message: `${LEGACY_BASELINE} holds a baseline in the earlier JSON format. Run \`quality baseline migrate\` to move it to ${config.baseline}.`,
26
- });
23
+ const files = new Map<string, Shard>();
24
+ for (const path of yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })))) {
25
+ const raw = yield* readInput(config.root, path);
26
+ if (raw === undefined) {
27
+ continue;
28
+ }
29
+ const entries = yield* validOrFail(path, yield* Effect.promise(() => decodeBaseline(raw)));
30
+ for (const entry of entries) {
31
+ const expected = shardOf(entry.file, config.baseline);
32
+ if (expected !== path) {
33
+ return yield* new SetupFailure({ message: `${entry.file} belongs in ${expected}, not ${path}.` });
34
+ }
35
+ }
36
+ files.set(path, { entries, raw });
27
37
  }
28
- return { entries: yield* validOrFail(config.baseline, yield* Effect.promise(() => decodeBaseline(raw))), raw };
38
+ for (const source of ["quality/baseline.jsonl", LEGACY_BASELINE]) {
39
+ if (source !== config.baseline && (yield* readInput(config.root, source)) !== undefined) {
40
+ return yield* new SetupFailure({
41
+ message: `${source} holds an earlier baseline. Run \`quality baseline migrate --from ${source}\` to move it to ${config.baseline} and package shards.`,
42
+ });
43
+ }
44
+ }
45
+ return { entries: [...files.values()].flatMap((file) => file.entries), files };
29
46
  });