@shivaedev/quality 0.52.0 → 0.53.1
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/CHANGELOG.md +31 -0
- package/README.md +19 -9
- package/biome/declarations.json +0 -5
- package/biome/preset.json +1 -1
- package/dist/baseline/cleanupMergeFiles.d.ts +4 -0
- package/dist/baseline/cleanupMergeFiles.d.ts.map +1 -0
- package/dist/baseline/cleanupMergeFiles.js +23 -0
- package/dist/baseline/cleanupMergeFiles.js.map +1 -0
- package/dist/cli/lint.d.ts +2 -3
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +4 -2
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/config/globs.d.ts +17 -0
- package/dist/config/globs.d.ts.map +1 -0
- package/dist/config/globs.js +18 -0
- package/dist/config/globs.js.map +1 -0
- package/dist/engine/runRules.d.ts +2 -1
- package/dist/engine/runRules.d.ts.map +1 -1
- package/dist/engine/runRules.js +4 -1
- package/dist/engine/runRules.js.map +1 -1
- package/dist/engine/session.d.ts +1 -1
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +9 -5
- package/dist/engine/session.js.map +1 -1
- package/dist/hooks/preCommit.d.ts +2 -1
- package/dist/hooks/preCommit.d.ts.map +1 -1
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/departures.js +13 -0
- package/dist/imports/departures.js.map +1 -1
- package/dist/rule.d.ts +1 -0
- package/dist/rule.d.ts.map +1 -1
- package/dist/rule.js +7 -3
- package/dist/rule.js.map +1 -1
- package/dist/rules/builtIn.d.ts +36 -9
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/files/folderNames.d.ts +8 -2
- package/dist/rules/files/folderNames.d.ts.map +1 -1
- package/dist/rules/files/folderNames.js +7 -5
- package/dist/rules/files/folderNames.js.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts +4 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +10 -8
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/files/otherNames.d.ts +8 -2
- package/dist/rules/files/otherNames.d.ts.map +1 -1
- package/dist/rules/files/otherNames.js +7 -5
- package/dist/rules/files/otherNames.js.map +1 -1
- package/dist/rules/imports/aliased.js +1 -1
- package/dist/rules/imports/aliased.js.map +1 -1
- package/dist/rules/stories/authSql.d.ts +4 -1
- package/dist/rules/stories/authSql.d.ts.map +1 -1
- package/dist/rules/stories/authSql.js +6 -3
- package/dist/rules/stories/authSql.js.map +1 -1
- package/dist/rules/stories/collectionOrigins.d.ts +5 -0
- package/dist/rules/stories/collectionOrigins.d.ts.map +1 -0
- package/dist/rules/stories/collectionOrigins.js +17 -0
- package/dist/rules/stories/collectionOrigins.js.map +1 -0
- package/dist/rules/stories/httpStatus.d.ts +4 -1
- package/dist/rules/stories/httpStatus.d.ts.map +1 -1
- package/dist/rules/stories/httpStatus.js +6 -3
- package/dist/rules/stories/httpStatus.js.map +1 -1
- package/dist/rules/stories/namedValues.d.ts.map +1 -1
- package/dist/rules/stories/namedValues.js +5 -5
- package/dist/rules/stories/namedValues.js.map +1 -1
- package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
- package/dist/rules/stories/noLimitImports.js +4 -2
- package/dist/rules/stories/noLimitImports.js.map +1 -1
- package/dist/rules/stories/origins.d.ts +1 -2
- package/dist/rules/stories/origins.d.ts.map +1 -1
- package/dist/rules/stories/origins.js +12 -6
- package/dist/rules/stories/origins.js.map +1 -1
- package/dist/rules/stories/prerequisites.d.ts.map +1 -1
- package/dist/rules/stories/prerequisites.js +6 -24
- package/dist/rules/stories/prerequisites.js.map +1 -1
- package/dist/rules/stories/program.d.ts.map +1 -1
- package/dist/rules/stories/program.js +8 -1
- package/dist/rules/stories/program.js.map +1 -1
- package/dist/rules/stories/sources.d.ts.map +1 -1
- package/dist/rules/stories/sources.js +19 -7
- package/dist/rules/stories/sources.js.map +1 -1
- package/dist/rules/stories/specHelpers.d.ts.map +1 -1
- package/dist/rules/stories/specHelpers.js +4 -2
- package/dist/rules/stories/specHelpers.js.map +1 -1
- package/dist/rules/stories/specs.js +1 -1
- package/dist/rules/stories/specs.js.map +1 -1
- package/dist/rules/stories/syntax.d.ts +0 -1
- package/dist/rules/stories/syntax.d.ts.map +1 -1
- package/dist/rules/stories/syntax.js +0 -4
- package/dist/rules/stories/syntax.js.map +1 -1
- package/dist/rules/test-names/colocated.d.ts +4 -1
- package/dist/rules/test-names/colocated.d.ts.map +1 -1
- package/dist/rules/test-names/colocated.js +5 -3
- package/dist/rules/test-names/colocated.js.map +1 -1
- package/dist/rules/test-names/follow.d.ts +4 -1
- package/dist/rules/test-names/follow.d.ts.map +1 -1
- package/dist/rules/test-names/follow.js +5 -3
- package/dist/rules/test-names/follow.js.map +1 -1
- package/package.json +3 -2
- package/src/baseline/cleanupMergeFiles.ts +27 -0
- package/src/cli/lint.ts +33 -27
- package/src/cli/program.ts +2 -0
- package/src/config/globs.ts +31 -0
- package/src/engine/runRules.ts +7 -2
- package/src/engine/session.ts +10 -5
- package/src/imports/departures.ts +16 -0
- package/src/rule.ts +12 -2
- package/src/rules/files/folderNames.ts +7 -5
- package/src/rules/files/namedAfterExport.ts +10 -8
- package/src/rules/files/otherNames.ts +7 -5
- package/src/rules/imports/aliased.ts +1 -1
- package/src/rules/stories/authSql.ts +6 -3
- package/src/rules/stories/collectionOrigins.ts +20 -0
- package/src/rules/stories/httpStatus.ts +6 -3
- package/src/rules/stories/namedValues.ts +7 -5
- package/src/rules/stories/noLimitImports.ts +4 -2
- package/src/rules/stories/origins.ts +12 -8
- package/src/rules/stories/prerequisites.ts +6 -25
- package/src/rules/stories/program.ts +9 -1
- package/src/rules/stories/sources.ts +21 -9
- package/src/rules/stories/specHelpers.ts +4 -2
- package/src/rules/stories/specs.ts +1 -1
- package/src/rules/stories/syntax.ts +0 -5
- package/src/rules/test-names/colocated.ts +5 -3
- package/src/rules/test-names/follow.ts +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.53.1 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Allow specific admin file names such as `inboxRoutes.ts` inside a module's `client/admin/` and `server/admin/` folders without treating the module name as a repeated prefix. File names must still match their exports.
|
|
8
|
+
- Allow a module's client or server registration to import its own admin subtree through `./admin/…`. Other relative imports that leave their folder still require aliases.
|
|
9
|
+
- Remove untracked repository-root `.merge_file_*` leftovers older than five minutes when the baseline merge driver starts. Preserve the current merge's inputs, tracked files and recent files.
|
|
10
|
+
|
|
11
|
+
## 0.53.0 - 2026-11-01
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Rules can validate inventory-dependent configuration through `defineRule`'s `validate` callback before checking files.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Generated starters declare auth ownership with reasoned globs for Quality.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Accept a file named after its single exported constant in `files/named-after-export`, applying the existing export-name and folder-prefix checks.
|
|
24
|
+
- Run `quality lint`, including its Biome checks and pre-commit lint, under the shared heavy-process lock so concurrent local heavy commands wait their turn.
|
|
25
|
+
- Enable Biome's `noDelete` as an error while disabling its automatic fix so diagnostics remain visible without rewriting deletion behavior.
|
|
26
|
+
- Check story kits in all packages except test-story, test and types, including test-story's development dependencies. Apply story syntax rules to kit declarations in both `.test` and `.spec` files; keep unit and typecheck tests outside those rules.
|
|
27
|
+
|
|
28
|
+
### Breaking
|
|
29
|
+
|
|
30
|
+
- Glob options (`toolOwned`, `content`, `edge`, `owners` and `suites`) require `{ glob, reason }` declarations. Replace each string with a declaration explaining its purpose, and remove patterns that match no current inventoried file. Stale declarations fail configuration.
|
|
31
|
+
- Lint and baseline commands refuse legacy exception registries. Run `quality exceptions migrate` (or `quality exceptions migrate --from <registry>`) to move entries into config exceptions.
|
|
32
|
+
- Remove `isSpec` from `@shivaedev/quality/rules/stories/syntax.ts`. Consumers selecting story files must use `storySources` from `@shivaedev/quality/rules/stories/sources.ts` and run its Effect with the rule inputs; story kit origins determine coverage instead of a `.spec` suffix.
|
|
33
|
+
|
|
3
34
|
## 0.52.0 - 2026-10-31
|
|
4
35
|
|
|
5
36
|
### Added
|
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The work has three parts: connect the repository to the shared tools once; descr
|
|
|
30
30
|
|
|
31
31
|
### Rule lifecycle
|
|
32
32
|
|
|
33
|
-
`defineRule` accepts synchronous, Promise and Effect checks. Promise checks receive an abort signal as `context.signal`; pass it to cancellable APIs. Effect checks compose filesystem and child-process work in the run's scope. Configured checks return Effects and preserve their service requirements; tool checks read `FileSystem` and `ChildProcessSpawner` from the environment.
|
|
33
|
+
`defineRule` accepts synchronous, Promise and Effect checks. Promise checks receive an abort signal as `context.signal`; pass it to cancellable APIs. Effect checks compose filesystem and child-process work in the run's scope. An optional `validate(context)` callback returns inventory-dependent configuration issues before `check`; those issues stop the run as invalid configuration. Configured checks return Effects and preserve their service requirements; tool checks read `FileSystem` and `ChildProcessSpawner` from the environment.
|
|
34
34
|
|
|
35
35
|
Interrupting a run stops its Biome and knip processes and removes their scoped temporary configs before it ends. A rule crash is a defect; the CLI prints the rule id and original stack. Expected setup failures retain their underlying cause without including it in enumerable error data.
|
|
36
36
|
|
|
@@ -189,7 +189,7 @@ export default defineConfig({
|
|
|
189
189
|
|
|
190
190
|
Keep story kits and fixtures in `src/test-support` and keep each spec specific to its story. [`@shivaedev/test-story`](https://github.com/ShivaeDev/platform/tree/main/packages/test-story#readme) explains how to build the kit, traits and verbs over a real engine.
|
|
191
191
|
|
|
192
|
-
Quality's `tests/story-specs` rule reports a test file that declares tests without a kit's `it`, including plain Vitest `it` and `test` declarations mixed with stories. Typecheck tests are exempt, as are test-story
|
|
192
|
+
Quality's `tests/story-specs` rule reports a test file that declares tests without a kit's `it`, including plain Vitest `it` and `test` declarations mixed with stories. Typecheck tests are exempt, as are only the packages named `@shivaedev/test-story`, `@shivaedev/test` and `@shivaedev/types`, wherever they live in the workspace or at its root. Other dependencies of test-story, including development dependencies, remain checked.
|
|
193
193
|
|
|
194
194
|
Quality's `tests/story-engine` rule reports a kit story with no traits whose body never references its verbs, its story or its test context. Drive the engine through one of the kit's verbs or traits, or, if the code under test is pure, move it to `<stem>.unit.test.ts`, which reaches no engine and mocks nothing. The rule follows the same kit origins and prerequisite exemptions as `tests/story-specs`; unit and typecheck files are exempt.
|
|
195
195
|
|
|
@@ -197,25 +197,35 @@ There is one other honest form. A pure function with no engine behind it gets a
|
|
|
197
197
|
|
|
198
198
|
Every finding names both repairs: drive the engine through the package's story kit, or, when the code under test is pure, move the test to a `.unit` file. Never wrap a pure function in a story that ignores its kit.
|
|
199
199
|
|
|
200
|
-
Every package tests its real engine through its own story kit, so setup and actions share the package's domain vocabulary. To repair a finding, build the kit with `storyKit` from `@shivaedev/test-story/server/storyKit.ts` in `src/test-support`, import it in the spec and replace plain registrations with `kit.it(name, traits, body)`. The rule follows imports, aliases
|
|
200
|
+
Every package tests its real engine through its own story kit, so setup and actions share the package's domain vocabulary. To repair a finding, build the kit with `storyKit` from `@shivaedev/test-story/server/storyKit.ts` in `src/test-support`, import it in the spec and replace plain registrations with `kit.it(name, traits, body)`. The rule follows imports, aliases, conditional registrars and arrays of kits (including tuple loops) back to the kit; it checks declarations, while review and runtime tests establish whether the kit exercises the real engine.
|
|
201
201
|
|
|
202
202
|
Quality's `tests/story-setup` rule reports top-level test functions named with the words `seed`, `make`, `build` or `setup`, and fixture-writing calls imported from Node's `fs` or `fs/promises`. It leaves source and `test-support/` files alone. This is a check for those syntax patterns; a passing test file still needs review of what it tests.
|
|
203
203
|
|
|
204
204
|
Specs keep expectations visible. `tests/spec-helpers` moves all module-level helper functions out of specs and into the kit; `tests/no-expect-in-support` moves `expect` calls into the spec, except in test-support files that register tests at module top level and are not imported by any module, so nested Vitest runs can execute them as test files with real assertions. `tests/named-values` rejects numeric literals passed to `toBe` or `toHaveLength` in specs, except zero and process exit codes asserted on an `exitCode` subject: assert the observed items or use a domain name that comes from the story's inputs or the product. For HTTP statuses, import `* as HttpStatus` from `effect/http/HttpStatus` and use `HttpStatus.fromLiteral("NotFound")`; subjects named `status` or `code` do not exempt numeric assertions. A spec-local numeric const that only feeds these matchers is reported, including aliases for zero and codes. `tests/no-limit-imports` rejects importing `MAX_*` constants from a `limits` module into specs, so a story proves behavior instead of copying an implementation cap.
|
|
205
205
|
|
|
206
|
-
Three more rules keep a spec readable as a story, as the [story-testing skill](https://github.com/ShivaeDev/platform/blob/main/packages/skills/skills/story-testing/SKILL.md) describes.
|
|
206
|
+
Three more rules keep a spec readable as a story, as the [story-testing skill](https://github.com/ShivaeDev/platform/blob/main/packages/skills/skills/story-testing/SKILL.md) describes. Together with `tests/spec-helpers`, `tests/named-values` and `tests/no-limit-imports`, they read files whose test declarations trace to a story kit, whatever their suffix: a `.test` or `.spec` file outside `test-support` that is not a type or unit test, such as `orders.spec.ts`, `pane.dom.test.ts` or `orders.slow.test.ts`. The suffix says where a test sits under `tests/follow`, not whether it is a story, and `tests/story-specs` already holds every such file to the story kit. They exempt the same test-story prerequisites as `tests/story-specs`. `tests/domain-outcomes` reports each use of Effect's `Exit`, `Cause` or `Result` module, each `_tag` read or destructuring, and each object literal tagged `"Success"` or `"Failure"`: the kit's verb or readout returns the outcome in the domain's words, such as `"unauthorized"`, and a trait builds any failing input. A domain's own tagged value, such as `{ _tag: "Resync" }`, passes. `tests/grouped-outcomes` reports each run of two or more consecutive `expect(yield* …)` statements once, at its first statement: write the outcomes as rows of one `outcomes` call. `tests/wait-on-events` reports `Effect.sleep`, `setTimeout` and `setInterval`, calls to an imported `eventually`, Vitest's fake timers, `vi.waitFor`, and `TestClock.adjust` and `TestClock.setTime`: settle on the engine's own signal through a kit verb, and when time passing is the behaviour, advance the clock in a verb named for it.
|
|
207
207
|
|
|
208
208
|
`boundaries/queue-sql` rejects SQL mentioning the private `pgboss.` schema. Apps use their queue definitions and let workers process jobs; there is no queue-purge API by design. `boundaries/auth-sql` rejects SQL accessing Better Auth's `user`, `account`, `session` and `verification` tables. App tables reference users by foreign key: migrations may reference only `user(id)` with `ON DELETE CASCADE` or `ON DELETE SET NULL`. Import `userReference` from `@shivaedev/identity/server/better-auth/userReference.ts` and interpolate `sql(userReference.table)` and `sql(userReference.column)` in the reference. Apps use identity for account data; `options.owners` names platform's own auth implementation and its migrations. These rules inspect SQL templates, literal query calls and query variables, and inventoried `.sql` files. They do not evaluate arbitrary runtime SQL construction.
|
|
209
209
|
|
|
210
210
|
`boundaries/http-status` rejects comparisons with HTTP error status numbers, switch cases and literal status-list membership outside `options.edge`. Domain code handles typed errors; the named HTTP edge translates them into transport responses. Process exit codes remain ordinary domain values.
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
Glob options (`toolOwned`, `content`, `edge`, `owners` and `suites`) use `{ glob, reason }` declarations. Every declaration needs a nonblank reason and must match a current inventoried file; otherwise configuration fails. Remove declarations when their files disappear. Paths and patterns are relative to the config's directory. Naming and suite options use gitignore patterns; `edge` and `owners` use Node glob patterns.
|
|
213
|
+
|
|
214
|
+
Declare these architectural facts in the repository's quality config:
|
|
213
215
|
|
|
214
216
|
```ts
|
|
215
217
|
export default defineConfig({
|
|
216
218
|
rules: {
|
|
217
|
-
"boundaries/auth-sql": {
|
|
218
|
-
|
|
219
|
+
"boundaries/auth-sql": {
|
|
220
|
+
options: {
|
|
221
|
+
owners: [{ glob: "src/auth/**", reason: "This module implements the auth storage API." }],
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
"boundaries/http-status": {
|
|
225
|
+
options: {
|
|
226
|
+
edge: [{ glob: "src/http/**", reason: "These HTTP adapters translate transport statuses into domain errors." }],
|
|
227
|
+
},
|
|
228
|
+
},
|
|
219
229
|
},
|
|
220
230
|
});
|
|
221
231
|
```
|
|
@@ -275,8 +285,8 @@ For adoption, run `quality baseline write --rule code/unused --file src/legacy.t
|
|
|
275
285
|
- **Documentation:** `docs/references` checks every Markdown file in the sources except `CHANGELOG.md`, whose released history keeps the links of its release. Relative links, reference definitions and `href`/`src` attributes reach an existing file or folder inside the repository, and a heading anchor matches one GitHub forms from the target's headings. A link to the repository's own GitHub tree, named by the root `package.json` `repository` field, is checked like a relative one unless it is pinned to a commit or a release tag. A published workspace package's README is shown on npm without the repository around it, so its links that leave the package use absolute URLs. Imports in TypeScript and JavaScript code blocks, workspace module paths such as `@scope/lib/repository.ts` written as inline code, `` `name` from `module` `` phrases and a package README's API rows resolve through the owning package's `exports` to an exported module, and every named import exists in that module unless it re-exports another. A linked document such as `CLAUDE.md` beside `AGENTS.md` is checked once, through its target. `docs/unversioned-installs` rejects a version after a package name in install commands, in shell code blocks and inline code; the package's own version ranges decide what installs, and a written version goes stale with the next release. A dist-tag such as `latest` passes.
|
|
276
286
|
- **Hidden casts:** `suppressions/no-double-cast` also checks code outside `adapters/` and `test-support/` for concrete annotations on `JSON.parse` results, unchecked `Reflect.get` bindings, SQL tagged-template row generics, identity overloads whose implementation returns `unknown`, context retagging through `Context.makeUnsafe(...mapUnsafe)`, and writes to readonly properties or native Scope state. Keep untrusted values as `unknown` and decode them with `Schema.decodeUnknownEffect`; decode SQL rows with `SqlSchema` rather than declaring their shape. Give an identity implementation its declared return type, preserve the Context service type, and use native constructors or lifecycle operations instead of changing native fields. Constructor initialization, mutable object writes and extensions that do not replace readonly fields are accepted. These checks read syntax and TypeScript declarations; they do not prove that arbitrary helper functions validate their input.
|
|
277
287
|
- **Suppressions:** the `suppressions/*` rules reject inline lint and compiler directives, casts through `unknown`, `any` or `never`, Biome settings that weaken a check, recommended Biome rules the preset leaves below `error`, and `ignoreDeprecations`. None of them takes exceptions. A type test (`*.typecheck.test.ts`) may use `@ts-expect-error`; a test that must pass a rejected value at run time calls the API through `Reflect.apply`.
|
|
278
|
-
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder, production imports of test code, runtime folders and fences, as described above.
|
|
279
|
-
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
288
|
+
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder (except a module’s client or server `registration.ts` or `registration.tsx` importing its own `./admin/` subtree), production imports of test code, runtime folders and fences, as described above.
|
|
289
|
+
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` accepts a file named after its single exported constant, such as `liveQueryWindow.ts` exporting `const liveQueryWindow`. It keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. Inside a module’s `client/admin/` or `server/admin/` subtree, file names may repeat words from above `admin/`: `src/modules/inbox/client/admin/inboxRoutes.ts` may export `inboxRoutes`. Names must still match their exports and omit words repeated by folders within the admin subtree. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
280
290
|
- **React:** `react/jsx-conditionals` reports `&&` and ternaries in the JSX children a component returns, including nested decisions and returned `.map` items. Decisions in a `const` above the return, JSX built inside library callbacks and conditional attributes are accepted. A ternary with two plain string or number literal branches, such as `{on ? "On" : "Off"}`, is accepted; branches that select JSX, components or computed values still need a decision before the JSX. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
|
|
281
291
|
- **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
|
|
282
292
|
- **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. Read failures other than `NotFound` fail the scan. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members with exports. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `source`, `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. `manifests/application` keeps an application on its entry points, as described above.
|
package/biome/declarations.json
CHANGED
|
@@ -32,11 +32,6 @@
|
|
|
32
32
|
"reason": "A test defines the helper and harness components it renders, and no test module is hot-reloaded, so the rule's fast-refresh boundary does not apply.",
|
|
33
33
|
"rule": "lint/style/useComponentExportOnlyModules"
|
|
34
34
|
},
|
|
35
|
-
{
|
|
36
|
-
"includes": ["**"],
|
|
37
|
-
"reason": "quality fix applies every Biome lint fix, and this rule's fix changed behavior or did not finish on real code, so the rule is off until it is reviewed.",
|
|
38
|
-
"rule": "lint/performance/noDelete"
|
|
39
|
-
},
|
|
40
35
|
{
|
|
41
36
|
"includes": ["**"],
|
|
42
37
|
"reason": "An unused private member asks whether it is still needed or should be used; deleting it automatically skips that decision.",
|
package/biome/preset.json
CHANGED
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
"performance": {
|
|
343
343
|
"noAccumulatingSpread": "error",
|
|
344
344
|
"noBarrelFile": "error",
|
|
345
|
-
"noDelete": "
|
|
345
|
+
"noDelete": { "fix": "none", "level": "error" },
|
|
346
346
|
"noDynamicNamespaceImportAccess": "error",
|
|
347
347
|
"noReExportAll": "error",
|
|
348
348
|
"noSyncScripts": "error",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Effect, FileSystem } from "effect";
|
|
2
|
+
import { SetupFailure } from "#failure.ts";
|
|
3
|
+
export declare const cleanupMergeFiles: (cwd: string, inputs: readonly string[]) => Effect.Effect<void, SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | FileSystem.FileSystem>;
|
|
4
|
+
//# sourceMappingURL=cleanupMergeFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanupMergeFiles.d.ts","sourceRoot":"","sources":["../../src/baseline/cleanupMergeFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,UAAU,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,eAAO,MAAM,iBAAiB,yKAmB7B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { Clock, Effect, FileSystem, Option } from "effect";
|
|
3
|
+
import { SetupFailure } from "#failure.ts";
|
|
4
|
+
import { gitOrFail } from "#git/command.ts";
|
|
5
|
+
const STALE_AFTER_MS = 5 * 60_000;
|
|
6
|
+
export const cleanupMergeFiles = Effect.fn("Baseline.cleanupMergeFiles")(function* (cwd, inputs) {
|
|
7
|
+
const fs = yield* FileSystem.FileSystem;
|
|
8
|
+
const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
|
|
9
|
+
const active = new Set(inputs.map((path) => resolve(cwd, path)));
|
|
10
|
+
const untracked = yield* gitOrFail(root, ["ls-files", "--others", "--full-name", "-z", "--", ":(top,glob).merge_file_*"]);
|
|
11
|
+
const cutoff = (yield* Clock.currentTimeMillis) - STALE_AFTER_MS;
|
|
12
|
+
for (const name of untracked.split("\0").filter(Boolean)) {
|
|
13
|
+
const path = resolve(root, name);
|
|
14
|
+
if (active.has(path)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const info = yield* fs.stat(path);
|
|
18
|
+
if (info.type === "File" && Option.exists(info.mtime, (mtime) => mtime.getTime() < cutoff)) {
|
|
19
|
+
yield* fs.remove(path);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
|
|
23
|
+
//# sourceMappingURL=cleanupMergeFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanupMergeFiles.js","sourceRoot":"","sources":["../../src/baseline/cleanupMergeFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,cAAc,GAAG,CAAC,GAAG,MAAM,CAAC;AAElC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC,4BAA4B,CAAC,CACvE,QAAQ,CAAC,EAAE,GAAW,EAAE,MAAyB;IAChD,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,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,
|
|
3
|
-
|
|
4
|
-
export declare const lint: (cwd: string, config: string | undefined, staged?: any) => Effect.Effect<void, GateFailed | SetupFailure, RuleServices>;
|
|
2
|
+
import { GateFailed, SetupFailure } from "#failure.ts";
|
|
3
|
+
export declare const lint: (cwd: string, config: string | undefined, staged?: any) => Effect.Effect<void, GateFailed | SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem>;
|
|
5
4
|
//# sourceMappingURL=lint.d.ts.map
|
package/dist/cli/lint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/cli/lint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/cli/lint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIvD,eAAO,MAAM,IAAI,sNA6BhB,CAAC"}
|
package/dist/cli/lint.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
3
|
import { Console, Effect } from "effect";
|
|
4
|
+
import { withHeavyLock } from "@shivaedev/heavy-lock/withHeavyLock.ts";
|
|
3
5
|
import { looseStagedEntries } from "#baseline/looseStagedEntries.ts";
|
|
4
6
|
import { evaluate, passes } from "#engine/evaluate.ts";
|
|
5
7
|
import { openSession } from "#engine/session.ts";
|
|
6
8
|
import { keyOf } from "#engine/violation.ts";
|
|
7
|
-
import { GateFailed } from "#failure.ts";
|
|
9
|
+
import { GateFailed, SetupFailure } from "#failure.ts";
|
|
8
10
|
import { render } from "#report/render.ts";
|
|
9
11
|
export const lint = Effect.fn("Cli.lint")(function* (cwd, config, staged = false) {
|
|
10
12
|
const session = yield* openSession(cwd, config);
|
|
@@ -25,5 +27,5 @@ export const lint = Effect.fn("Cli.lint")(function* (cwd, config, staged = false
|
|
|
25
27
|
if (!passes(outcome)) {
|
|
26
28
|
return yield* new GateFailed();
|
|
27
29
|
}
|
|
28
|
-
});
|
|
30
|
+
}, (effect) => withHeavyLock(effect, { command: "quality lint" }).pipe(Effect.catchTag("HeavyLockError", (cause) => new SetupFailure({ cause, message: cause.message })), Effect.provide(NodePath.layer)));
|
|
29
31
|
//# sourceMappingURL=lint.js.map
|
package/dist/cli/lint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/cli/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/cli/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,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ceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AAazC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQhD,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,OAAO,yMAyClB,CAAC"}
|
package/dist/cli/program.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Console, Effect } from "effect";
|
|
2
|
+
import { cleanupMergeFiles } from "#baseline/cleanupMergeFiles.ts";
|
|
2
3
|
import { installDriver } from "#baseline/installDriver.ts";
|
|
3
4
|
import { mergeBaseline } from "#baseline/merge.ts";
|
|
4
5
|
import { parseCommand } from "#cli/args.ts";
|
|
@@ -35,6 +36,7 @@ export const program = Effect.fn("Cli.program")(function* (args, { cwd, launch }
|
|
|
35
36
|
case "Fix":
|
|
36
37
|
return yield* command.rules.length === 0 ? fix(cwd, command.config) : fixRule(cwd, command.config, command.rules);
|
|
37
38
|
case "BaselineMerge":
|
|
39
|
+
yield* cleanupMergeFiles(cwd, [command.base, command.ours, command.theirs]);
|
|
38
40
|
return yield* mergeBaseline(command.base, command.ours, command.theirs);
|
|
39
41
|
case "BaselineInstallDriver":
|
|
40
42
|
return yield* installDriver(cwd, launch);
|
package/dist/cli/program.js.map
CHANGED
|
@@ -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,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC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AAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACvG,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
declare const GlobDeclaration: Schema.Struct<{
|
|
3
|
+
readonly glob: Schema.NonEmptyString;
|
|
4
|
+
readonly reason: Schema.String;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const GlobDeclarations: Schema.withDecodingDefaultKey<Schema.$Array<Schema.Struct<{
|
|
7
|
+
readonly glob: Schema.NonEmptyString;
|
|
8
|
+
readonly reason: Schema.String;
|
|
9
|
+
}>>, never>;
|
|
10
|
+
type GlobOptions = Readonly<Record<string, readonly (typeof GlobDeclaration.Type)[]>>;
|
|
11
|
+
export declare function globPatterns(declarations: readonly (typeof GlobDeclaration.Type)[]): readonly string[];
|
|
12
|
+
export declare function validateGlobs({ files, options }: {
|
|
13
|
+
readonly files: readonly string[];
|
|
14
|
+
readonly options: GlobOptions;
|
|
15
|
+
}, matches?: (file: string, glob: string) => boolean): readonly string[];
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=globs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globs.d.ts","sourceRoot":"","sources":["../../src/config/globs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,QAAA,MAAM,eAAe;;;EAGnB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;WAAwF,CAAC;AAEtH,KAAK,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEtF,wBAAgB,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,MAAM,EAAE,CAEtG;AAOD,wBAAgB,aAAa,CAC5B,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;CAAE,EACxF,OAAO,GAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAA8B,GACrE,SAAS,MAAM,EAAE,CAMnB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import ignore from "ignore";
|
|
3
|
+
const GlobDeclaration = Schema.Struct({
|
|
4
|
+
glob: Schema.NonEmptyString,
|
|
5
|
+
reason: Schema.String.check(Schema.isPattern(/\S/u, { expected: "a reason for this glob" })),
|
|
6
|
+
});
|
|
7
|
+
export const GlobDeclarations = Schema.Array(GlobDeclaration).pipe(Schema.withDecodingDefaultKey(Effect.succeed([])));
|
|
8
|
+
export function globPatterns(declarations) {
|
|
9
|
+
return declarations.map(({ glob }) => glob);
|
|
10
|
+
}
|
|
11
|
+
function matchesIgnorePattern(file, glob) {
|
|
12
|
+
const result = ignore().add(glob).test(file);
|
|
13
|
+
return result.ignored || result.unignored;
|
|
14
|
+
}
|
|
15
|
+
export function validateGlobs({ files, options }, matches = matchesIgnorePattern) {
|
|
16
|
+
return Object.entries(options).flatMap(([option, declarations]) => declarations.flatMap(({ glob }, index) => files.some((file) => matches(file, glob)) ? [] : [`${option}.${index}.glob: "${glob}" matches no current file. Remove the stale glob.`]));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=globs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globs.js","sourceRoot":"","sources":["../../src/config/globs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,wBAAwB,EAAE,CAAC,CAAC;CAC5F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAItH,MAAM,UAAU,YAAY,CAAC,YAAsD;IAClF,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY,EAAE,IAAY;IACvD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,EAAE,KAAK,EAAE,OAAO,EAAwE,EACxF,OAAO,GAA4C,oBAAoB;IAEvE,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,EAAE,CACjE,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CACxC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,WAAW,IAAI,mDAAmD,CAAC,CACvI,CACD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
+
import { SetupFailure } from "#failure.ts";
|
|
2
3
|
import type { RuleCheck, RuleInputs, RuleServices } from "#rule.ts";
|
|
3
4
|
import type { ActiveLevel, Violation } from "./violation.ts";
|
|
4
5
|
export interface ActiveRule {
|
|
@@ -9,5 +10,5 @@ export interface ActiveRule {
|
|
|
9
10
|
readonly level: ActiveLevel;
|
|
10
11
|
readonly registrable?: boolean;
|
|
11
12
|
}
|
|
12
|
-
export declare const runRules: (rules: readonly ActiveRule[], inputs: RuleInputs) => Effect.Effect<readonly Violation[],
|
|
13
|
+
export declare const runRules: (rules: readonly ActiveRule[], inputs: RuleInputs) => Effect.Effect<readonly Violation[], SetupFailure, RuleServices>;
|
|
13
14
|
//# sourceMappingURL=runRules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runRules.d.ts","sourceRoot":"","sources":["../../src/engine/runRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"runRules.d.ts","sourceRoot":"","sources":["../../src/engine/runRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAW,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAC/B;AAoDD,eAAO,MAAM,QAAQ,uHAsBnB,CAAC"}
|
package/dist/engine/runRules.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isAbsolute, relative } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { ManifestFailure } from "#adapters/manifestInventory.ts";
|
|
4
|
+
import { SetupFailure } from "#failure.ts";
|
|
4
5
|
import { posix } from "#inventory/ignoreScope.ts";
|
|
5
6
|
function messageOf(cause) {
|
|
6
7
|
return cause instanceof Error ? cause.message : String(cause);
|
|
@@ -33,7 +34,9 @@ function violationOf(rule, root, finding, exceptionFile) {
|
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
function runRule(rule, inputs, exceptionFile) {
|
|
36
|
-
return Effect.suspend(() => rule.check(inputs)).pipe(Effect.
|
|
37
|
+
return Effect.suspend(() => rule.check(inputs)).pipe(Effect.catch((cause) => cause instanceof SetupFailure
|
|
38
|
+
? Effect.fail(new SetupFailure({ cause, message: `rule ${rule.id} failed: ${cause.message}` }))
|
|
39
|
+
: Effect.die(cause)), Effect.map((findings) => findings.map((finding) => violationOf(rule, inputs.root, finding, exceptionFile))), Effect.catchDefect((cause) => cause instanceof ManifestFailure
|
|
37
40
|
? Effect.succeed([{ file: cause.path, level: "error", message: cause.message, rule: "manifests/valid" }])
|
|
38
41
|
: Effect.die(new Error(`rule ${rule.id} failed: ${messageOf(cause)}`, { cause }))));
|
|
39
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runRules.js","sourceRoot":"","sources":["../../src/engine/runRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAalD,SAAS,SAAS,CAAC,KAAc;IAChC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,iGAAiG;AACjG,SAAS,cAAc,CAAC,IAAY,EAAE,IAAY;I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OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,CAAC,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/engine/session.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { type ResolvedConfig } from "#config/load.ts";
|
|
3
|
-
import {
|
|
3
|
+
import type { RegistryEntry } from "#exceptions/registry.ts";
|
|
4
4
|
import { SetupFailure } from "#failure.ts";
|
|
5
5
|
import { type Inventory } from "#inventory/collect.ts";
|
|
6
6
|
import type { RuleServices } from "#rule.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,YAAY,EAA2B,MAAM,mBAAmB,CAAC;AAE/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC1C;AAUD,eAAO,MAAM,IAAI,kHAef,CAAC;AAEH,eAAO,MAAM,WAAW,qGAgBtB,CAAC"}
|
package/dist/engine/session.js
CHANGED
|
@@ -3,8 +3,6 @@ import { Effect } from "effect";
|
|
|
3
3
|
import { setManifestFiles } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
5
5
|
import { loadConfig } from "#config/load.ts";
|
|
6
|
-
import { validOrFail } from "#decoded.ts";
|
|
7
|
-
import { decodeRegistry } from "#exceptions/registry.ts";
|
|
8
6
|
import { registryEntries } from "#exceptions/registryEntries.ts";
|
|
9
7
|
import { SetupFailure } from "#failure.ts";
|
|
10
8
|
import { collectInventory } from "#inventory/collect.ts";
|
|
@@ -29,10 +27,16 @@ export const scan = Effect.fn("Engine.scan")(function* (config) {
|
|
|
29
27
|
});
|
|
30
28
|
export const openSession = Effect.fn("Engine.openSession")(function* (cwd, configPath) {
|
|
31
29
|
const config = yield* loadConfig(cwd, configPath);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
30
|
+
const selection = configPath === undefined ? "" : ` --config ${configPath}`;
|
|
31
|
+
for (const path of new Set([config.registry, "quality/registry.json"])) {
|
|
32
|
+
if ((yield* readInput(config.root, path)) !== undefined) {
|
|
33
|
+
return yield* new SetupFailure({
|
|
34
|
+
message: `${path} holds legacy exceptions. Run \`quality exceptions migrate${selection} --from ${path}\` to move them into ${config.file}.`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
34
38
|
const baseline = yield* readBaseline(config);
|
|
35
39
|
const { inventory, violations } = yield* scan(config);
|
|
36
|
-
return { baseline, config, inventory, registry:
|
|
40
|
+
return { baseline, config, inventory, registry: registryEntries(config.exceptions), violations };
|
|
37
41
|
});
|
|
38
42
|
//# sourceMappingURL=session.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAkB,MAAM,uBAAuB,CAAC;AAGzE,OAAO,EAAqB,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAWzC,SAAS,KAAK,CACb,MAA8E;IAE9E,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAC1C,OAAO,YAAY,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EA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,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC;QACxE,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC;gBAC9B,OAAO,EAAE,GAAG,IAAI,6DAA6D,SAAS,WAAW,IAAI,wBAAwB,MAAM,CAAC,IAAI,GAAG;aAC3I,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;AAClG,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
2
3
|
import { GateFailed, SetupFailure } from "#failure.ts";
|
|
3
|
-
export declare const preCommitHook: (cwd: string, path: string | undefined) => Effect.Effect<undefined, GateFailed | SetupFailure, import("
|
|
4
|
+
export declare const preCommitHook: (cwd: string, path: string | undefined) => Effect.Effect<undefined, GateFailed | SetupFailure, ChildProcessSpawner.ChildProcessSpawner | import("effect/FileSystem").FileSystem>;
|
|
4
5
|
//# sourceMappingURL=preCommit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preCommit.d.ts","sourceRoot":"","sources":["../../src/hooks/preCommit.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"preCommit.d.ts","sourceRoot":"","sources":["../../src/hooks/preCommit.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAKnE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAkCvD,eAAO,MAAM,aAAa,kLAoBxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AAGrE,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AA2DD,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAalF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { posix } from "node:path";
|
|
3
|
+
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
3
4
|
import { parse } from "#rules/parse.ts";
|
|
4
5
|
import { projectsFor } from "./projects.js";
|
|
5
6
|
import { resolveImport } from "./resolve.js";
|
|
@@ -16,6 +17,15 @@ function leavesLexically(path) {
|
|
|
16
17
|
const normal = posix.normalize(path).replace(TRAILING_SLASHES, "");
|
|
17
18
|
return normal === ".." || normal.startsWith("../") || normal.includes("/");
|
|
18
19
|
}
|
|
20
|
+
function registersAdmin(from, specifier, target) {
|
|
21
|
+
const root = moduleRoot(from);
|
|
22
|
+
const folder = posix.dirname(from);
|
|
23
|
+
return (root !== undefined
|
|
24
|
+
&& (folder === `${root}/client` || folder === `${root}/server`)
|
|
25
|
+
&& /^registration\.[cm]?[jt]sx?$/u.test(posix.basename(from))
|
|
26
|
+
&& specifier.startsWith("./admin/")
|
|
27
|
+
&& target?.startsWith(`${folder}/admin/`) === true);
|
|
28
|
+
}
|
|
19
29
|
// A relative import leaves its folder when its path climbs or descends, or when it names a folder whose index file lies below.
|
|
20
30
|
function departureAt(context, site) {
|
|
21
31
|
const path = site.specifier.replace(QUERY, "");
|
|
@@ -25,6 +35,9 @@ function departureAt(context, site) {
|
|
|
25
35
|
const request = { kind: "import", line: site.line, specifier: site.specifier, type: site.type };
|
|
26
36
|
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
27
37
|
const local = target?.kind === "file" ? target.path : undefined;
|
|
38
|
+
if (registersAdmin(context.path, path, local)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
28
41
|
if (!(leavesLexically(path) || (local !== undefined && posix.dirname(local) !== posix.dirname(context.path)))) {
|
|
29
42
|
return undefined;
|
|
30
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"departures.js","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"departures.js","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;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CAAC;IACnF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/rule.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ interface RuleDefinition<TId extends string, TOptions, TServices> {
|
|
|
50
50
|
readonly description: string;
|
|
51
51
|
readonly id: TId;
|
|
52
52
|
readonly registrable?: false;
|
|
53
|
+
readonly validate?: (context: RuleContext<TOptions>) => readonly string[];
|
|
53
54
|
}
|
|
54
55
|
interface RuleDefinitionWithOptions<TId extends string, TInput, TOptions, TServices> extends RuleDefinition<TId, TOptions, TServices> {
|
|
55
56
|
readonly options: StandardSchemaV1<TInput, TOptions>;
|
package/dist/rule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../src/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../src/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,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