@hailstails/hone 2.0.0-pre.5 → 2.0.0-pre.6
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/ADOPTING.md +6 -4
- package/CHANGELOG.md +12 -0
- package/MIGRATING.md +22 -11
- package/chunks/{chunk-ONDBACCR.js → chunk-2U5EKYGS.js} +184 -168
- package/chunks/{chunk-ND3EOGDK.js → chunk-4PHKVNM3.js} +41 -14
- package/chunks/{chunk-EFUWHLZK.js → chunk-P2VHWLK4.js} +1 -6
- package/package.json +1 -1
- package/src/application/conformance/conformance-testing-types.d.ts +2 -0
- package/src/eslint-plugin.js +1 -1
- package/src/hone.js +3 -3
- package/src/infrastructure/engines/eslint/runner/runner.js +1 -25
- package/src/measure-engines.process.js +3 -3
- package/src/testing.d.ts +1 -0
- package/src/testing.js +31 -18
package/ADOPTING.md
CHANGED
|
@@ -132,7 +132,7 @@ Skip this if every listed check runs on the `walker`. Otherwise, after writing `
|
|
|
132
132
|
npm run --silent hone:project
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
It writes `hone.eslint.mjs` and `hone.eslint.d.mts`, which types it for a TypeScript config. Spread its default export last in the repository's flat config. The projection sets rules only, so the config must also parse TypeScript, with the `@typescript-eslint/parser` that step 2 installs; without it the repository's own `eslint` run fails on the first type annotation while Hone's check still passes. A repository with no ESLint config yet can start from this `eslint.config.mjs`:
|
|
135
|
+
It writes `hone.eslint.mjs` and `hone.eslint.d.mts`, which types it for a TypeScript config. Add both to your formatter's ignore list: Hone compares each with what `hone project` writes. Spread its default export last in the repository's flat config. The projection sets rules only, so the config must also parse TypeScript, with the `@typescript-eslint/parser` that step 2 installs; without it the repository's own `eslint` run fails on the first type annotation while Hone's check still passes. A repository with no ESLint config yet can start from this `eslint.config.mjs`:
|
|
136
136
|
|
|
137
137
|
```js
|
|
138
138
|
import typescriptParser from "@typescript-eslint/parser";
|
|
@@ -329,9 +329,11 @@ A repository with existing code usually has more findings than the change that a
|
|
|
329
329
|
|
|
330
330
|
```bash
|
|
331
331
|
git fetch origin
|
|
332
|
-
|
|
332
|
+
npm run --silent hone:record-debt -- --base-revision origin/main --leave src/clock.ts --leave src/adapters
|
|
333
333
|
```
|
|
334
334
|
|
|
335
|
+
Add the script to the root `package.json` first: `"hone:record-debt": "hone record-debt --repo ."`. With pnpm the options follow the script name directly.
|
|
336
|
+
|
|
335
337
|
It prints one line per finding and per native exception, saying what it recorded and, for each it did not, why and what to do instead. Files under a `--leave` path need their authorised locations from point 1 written now. Files this change created or changed need fixing.
|
|
336
338
|
5. **Re-project and check against the same base.** With any `eslint` check, run `npm run --silent hone:project`. Then run `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main` (with pnpm, `pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main`). `--forfeiture this-run` makes this run assess forfeiture whatever `forfeiture` says, as the run that assesses it for your repository does: the pre-push hook with `"forfeiture": "elsewhere"` (step 5), or CI without it. A `forfeited` line names a file this change edits: go back to point 3 for it. A check against `HEAD` hides those lines, because nothing has changed since `HEAD`, and the hook or CI then fails where this run passed. What stays under `unrecorded` is what no record can hold; point 4's line for each says what to do.
|
|
337
339
|
6. **Review the diff.** Nothing takes effect until you commit it. Each generated record is debt holding only its symptom, check and file: inherited debt that nobody has reviewed, and the reviewer of the adopting change reads it as that. Note them in each check's Debt line in `disciplines.assessment.md`.
|
|
@@ -373,9 +375,9 @@ To use an agent, give it the lens file, the rule items that name it, the change
|
|
|
373
375
|
|
|
374
376
|
## 10. Update and remove
|
|
375
377
|
|
|
376
|
-
To update, on a branch, read [the changelog](https://github.com/HailsTails/hone/blob/main/CHANGELOG.md) for each version since yours, then install the new version exactly as step 2 does, with `npm install --save-dev --save-exact @hailstails/hone@<version>` or `pnpm add -D --save-exact @hailstails/hone@<version>`. Compare the installed rule pages under `node_modules/@hailstails/hone/rules/` with the old ones, re-run `hone:project` if any check is on `eslint`, run the check, and commit `package.json` and the lockfile with a message naming the new version. With a tarball, replace it with the newer one and install that instead. Rule text can change between versions, so read the changed pages. Version 2 reads different files from version 1: a repository on version 1 runs `hone upgrade` once after installing version 2, as [MIGRATING.md section 20](MIGRATING.md#20-moving-from-version-1-to-version-2) says, before it runs the check.
|
|
378
|
+
To update, on a branch, read [the changelog](https://github.com/HailsTails/hone/blob/main/CHANGELOG.md) for each version since yours, then install the new version exactly as step 2 does, in the root and in every workspace package that pins `@hailstails/hone`, with `npm install --save-dev --save-exact @hailstails/hone@<version>` or `pnpm add -D --save-exact @hailstails/hone@<version>`. Compare the installed rule pages under `node_modules/@hailstails/hone/rules/` with the old ones, re-run `hone:project` if any check is on `eslint`, run the check, and commit `package.json` and the lockfile with a message naming the new version. With a tarball, replace it with the newer one and install that instead. Rule text can change between versions, so read the changed pages. Version 2 reads different files from version 1: a repository on version 1 runs `hone upgrade` once after installing version 2, as [MIGRATING.md section 20](MIGRATING.md#20-moving-from-version-1-to-version-2) says, before it runs the check.
|
|
377
379
|
|
|
378
|
-
To remove, run `npm uninstall @hailstails/hone`, delete the
|
|
380
|
+
To remove, run `npm uninstall @hailstails/hone`, delete the `hone:` scripts, any vendored tarball, `hone.config.json`, `hone-records`, `disciplines.assessment.md` and, with `eslint` checks, `hone.eslint.mjs`, `hone.eslint.d.mts`, every package slice and their spread in the flat config, and take the check out of the validation script.
|
|
379
381
|
|
|
380
382
|
## Known gaps
|
|
381
383
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Every release of Hone, newest first. `pnpm run release-pull-request` writes each new section from the commits merged to `main` since the previous release tag, whose subjects are the squash-merged pull request titles; README.md's Compatibility section says what each kind of release may change. The sections below were written by hand from the merged pull requests when the changelog started.
|
|
4
4
|
|
|
5
|
+
## 2.0.0-pre.6
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- a check's tests are given its binding (#490)
|
|
10
|
+
- a team rule set's carried records stand at the base (#491)
|
|
11
|
+
- the upgrade regenerates a stale version 1 projection (#492)
|
|
12
|
+
|
|
13
|
+
### Other changes
|
|
14
|
+
|
|
15
|
+
- the upgrade names a script, formatting and workspace pins (#488)
|
|
16
|
+
|
|
5
17
|
## 2.0.0-pre.5
|
|
6
18
|
|
|
7
19
|
### Breaking changes
|
package/MIGRATING.md
CHANGED
|
@@ -108,9 +108,11 @@ An imported `file-carve-out` needs a `decision`: copy the old entry's. If the ol
|
|
|
108
108
|
Once the old records are converted, what is left is debt no old record covers: findings in a folder whose relaxed rule set was not carried over (step 2a), clauses the old route never checked, and inline disables or `@ts-expect-error` directives the old tool accepted ([section 14](#14-moving-to-recorded-inline-exceptions)). When the human approves recording it, run, with one `--leave` for each file the human decided is a permanent exception:
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
-
|
|
111
|
+
npm run --silent hone:record-debt -- --base-revision origin/main --leave <path>
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
where the root `package.json` has `"hone:record-debt": "hone record-debt --repo ."`. With pnpm the options follow the script name directly.
|
|
115
|
+
|
|
114
116
|
Give it the branch's base, `origin/main`, not `HEAD` as this migration's other checks do: after step 6 the pre-push hook and CI assess decay against that base, so a record for a file this branch edits passes a check against `HEAD` and is forfeited there. Finish each file the migration edits, as [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a point 3 says, and confirm with `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main`, which assesses decay in that run whatever `assessment.forfeiture` says. Before you run it, put every pre-push hook, CI job and other machine that runs the check on this release or later: the records it writes give no `reason`, and a Hone from before file carve-outs could leave out `reason` stops with `load failure: file-malformed` on them. It adds a `file-carve-out` naming only its clause and file for each clause and file that no converted record holds, and leaves the converted records as they are. A converted record still holds its pair, so the command reports it `already-recorded` only if the check does not accept it; fix that record rather than adding another. [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a says how to read its output and review the result.
|
|
115
117
|
|
|
116
118
|
## 4. Replace the hand-written linter rules
|
|
@@ -343,9 +345,11 @@ Neither `"not-run"` nor `"not-adopted"` takes an exception record. Stop and ask
|
|
|
343
345
|
2. **Split the records:**
|
|
344
346
|
|
|
345
347
|
```bash
|
|
346
|
-
|
|
348
|
+
npm run --silent hone:split-records
|
|
347
349
|
```
|
|
348
350
|
|
|
351
|
+
with `"hone:split-records": "hone split-records --repo ."` in the root `package.json`.
|
|
352
|
+
|
|
349
353
|
It prints `<path> written` for each file and `discipline-exceptions.json removed`. Within each file the records keep the order they had. It refuses a record whose clause names no discipline, naming its index: fix the clause or remove the record, then run it again. It also refuses a `discipline-exceptions.json` holding keys other than `version` and `exceptions`, such as `$schema` or `notes`, naming them, since no split file keeps them: remove them, or keep what they say elsewhere, then run it again.
|
|
350
354
|
3. **Re-project and check against the same base.** With any `eslint` clause, run `npm run --silent hone:project`; it prints `unchanged`, since the projection does not depend on where a record is kept. Then run `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main` (with pnpm, `pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main`). The base still holds `discipline-exceptions.json`, and Hone reads the base in whichever layout it holds, so imported and legacy-chain records are still verified against it. `--forfeiture this-run` makes this run assess decay whatever `assessment.forfeiture` says. The report is the one the check printed before the split, except that a section listing records, such as `stale`, lists them in the order of the new files.
|
|
351
355
|
4. **Commit the removal and the new files in one change.** A tree that holds both `discipline-exceptions.json` and the folder fails every run with `records-in-both-layouts`. Point any code owners or review rules at the new files, such as `discipline-exceptions/file-carve-outs/cd-19.json`.
|
|
@@ -365,10 +369,10 @@ Earlier releases never listed an `eslint` file record as `stale`. The off-switch
|
|
|
365
369
|
prune-debt: 3 file carve-outs under stale or forfeited still record debt that is paid; run node /work/shop/node_modules/@hailstails/hone/core/check/tool-command.js prune-debt --repo /work/shop --base-revision origin/main to remove what is paid, then run node /work/shop/node_modules/@hailstails/hone/core/check/tool-command.js project --repo /work/shop and commit the exception records with every disciplines.eslint.mjs it writes
|
|
366
370
|
```
|
|
367
371
|
|
|
368
|
-
|
|
372
|
+
With `"hone:prune-debt": "hone prune-debt --repo ."` in the root `package.json`, from the repository root that is:
|
|
369
373
|
|
|
370
374
|
```bash
|
|
371
|
-
|
|
375
|
+
npm run --silent hone:prune-debt -- --base-revision origin/main
|
|
372
376
|
npm run --silent hone:project
|
|
373
377
|
```
|
|
374
378
|
|
|
@@ -396,15 +400,15 @@ Nothing must be migrated. Selections, exception records and findings still use t
|
|
|
396
400
|
|
|
397
401
|
Version 2 keeps its settings in `hone.config.json`, its records in the `hone-records` folder and its native configuration in `hone.<engine>.mjs`, where version 1 kept them in `disciplines.json`, the exception records and `disciplines.<mechanism>.mjs`. `hone upgrade` moves a repository from one to the other in one run, and refuses, changing nothing, when version 2's check does not pass on the result. Version 2 is a major release, so its findings may differ from version 1's: the upgrade records the differences as debt.
|
|
398
402
|
|
|
399
|
-
1. **
|
|
403
|
+
1. **Version 1 findings need not be fixed before you install version 2.** The upgrade records version 2's findings as debt. Fix anything else the check fails on first: a load failure, an invalid record, an uncovered clause, an ESLint config that leaves the projection out, or a config override. **Install version 2 on a branch, with a clean working tree,** the way [ADOPTING.md](ADOPTING.md#10-update-and-remove) section 10 installs a release, changing the pin of `@hailstails/hone` in every workspace package that declares it, not only the root. Add `"hone:upgrade": "hone upgrade --repo ."` to the root `package.json` scripts, as `hone:check` and `hone:project` are, and **commit the install**, which changes the pins, the scripts and the lock, so the working tree is clean before the upgrade. Run neither `hone:project` nor the check before the upgrade: on a version 1 repository version 2's commands stop with `upgrade-needed`. The upgrade runs version 1's `project` itself before it measures, so a stale or missing projection is regenerated, and a refusal after that puts it back. The working tree is the only rollback: a refusal after files were written puts them back, and names any it could not put back, so you can restore them from version control.
|
|
400
404
|
2. **Run it:**
|
|
401
405
|
|
|
402
406
|
```bash
|
|
403
|
-
|
|
407
|
+
npm run --silent hone:upgrade
|
|
404
408
|
```
|
|
405
409
|
|
|
406
410
|
It writes the version 2 files, removes the records it carried that answer nothing, runs `record-debt`, `prune-debt` and `project`, then runs version 2's check. A version 1 `reportOutput` of `failures-only` is written as `actionable`, its version 2 name, and `--report-output failures-only` is refused on a version 2 repository. Only when version 2's check passes does it remove the version 1 files. If it fails, the upgrade puts everything back and prints the failing lines. Each refusal states whether anything was changed, and lists any file it could not put back.
|
|
407
|
-
3. **
|
|
411
|
+
3. **Format, then commit** what the upgrade wrote and removed, as its own commit after the install: the version 2 files together with the removal of the version 1 files. Run your formatter on every file the upgrade wrote or rewrote before committing, except `hone.eslint.mjs` and `hone.eslint.d.mts`. Add those two to the formatter's ignore list: the check compares each with what `hone project` writes and reports under `projection-problems` when it is missing or out of date. Then `git add .` and your commit.
|
|
408
412
|
|
|
409
413
|
After the upgrade, `hone split-records` does not run on version 2 files, and the records stay in `hone-records`. Before it, version 1's `hone authorise` stops and sends you here.
|
|
410
414
|
4. **Run the check with a base revision in at least one run, in CI at least,** for example `npm run --silent hone:check -- --base-revision origin/main`, where the script passes everything after `--` to `hone check`. The report a version 1 reader knew reads a little differently: `exempted` is now `answered`, and `carried` is a section of its own, listing the records the upgrade carried over. The records carried over follow the `forfeiture` setting, as debt does. With the default, `this-run`, every run needs `--base-revision` while a carried record or any debt exists: without one the run prints `forfeiture-unmeasured no-base-revision` when debt exists, first, and `import-unmeasured no-base-revision` when carried records exist, and fails, a bare local check or a hook that passes no base included. With `"forfeiture": "elsewhere"` a run that is given no base leaves the carried records to the run that has one, prints `carried standing elsewhere` with how many, and passes as a partial assessment when nothing else fails. A run with debt also prints `forfeiture elsewhere: <n> debt records not checked for forfeiture in this run` under `assessment`, which is the same setting at work on debt. A run that is given a base judges the carried records against it, but still does not check debt for forfeiture: it still prints that `forfeiture elsewhere` line and still ends `verdict: pass (partial assessment)`, or `verdict: fail (partial assessment)` when something else fails. Some run must assess forfeiture, and the run that does is the one with `"forfeiture": "this-run"`, the default, or `--forfeiture this-run`, given a base. A base that is given and cannot be read still prints `import-unmeasured base-git-failed` and fails under either setting. If no run is ever given a base, carried records are never judged, so keep one run that has it. A second `hone upgrade` prints `already on version 2; nothing to upgrade` and exits `0`.
|
|
@@ -429,11 +433,15 @@ Anything of yours that names a file version 1 kept needs the version 2 name: scr
|
|
|
429
433
|
| `discipline-exceptions.json`, `discipline-exceptions/` | `hone-records/` |
|
|
430
434
|
| `disciplines.eslint.mjs` | `hone.eslint.mjs`, and beside it `hone.eslint.d.mts`, which version 1 had no file for |
|
|
431
435
|
|
|
436
|
+
Files inside the package moved as well, so a script that runs one by its path, such as `node_modules/@hailstails/hone/core/check/tool-command.js`, no longer finds it. Call `hone`, or your own `hone:check` script, instead.
|
|
437
|
+
|
|
432
438
|
### ESLint slices and declared roots
|
|
433
439
|
|
|
434
440
|
A repository with package slices, one `disciplines.eslint.mjs` in each package folder that has its own ESLint config, gets one `hone.eslint.mjs` in each of the same folders. Every config that imported a version 1 projection now imports the one in its own folder, and a config that imported several has each import renamed. `eslintConfigRoots` and `eslintConfigLookup` move into `hone.config.json` as they are.
|
|
435
441
|
|
|
436
|
-
|
|
442
|
+
Before it measures, the upgrade runs version 1's own `project` once. A slice that no config root owns any more is removed by it. A refusal after that lists it under `version 1's own project removed these files, and the upgrade does not put them back; restore them from version control:`, since the upgrade did not write it.
|
|
443
|
+
|
|
444
|
+
A script whose text holds the projection's import, even inside a string, is taken for an ESLint config: its import is rewritten, and the upgrade refuses when the script names the projection anywhere else. Change such a script first.
|
|
437
445
|
|
|
438
446
|
Each refusal an ESLint repository meets names the config or projection and what to do, as every other refusal does.
|
|
439
447
|
|
|
@@ -441,7 +449,10 @@ Each refusal an ESLint repository meets names the config or projection and what
|
|
|
441
449
|
|
|
442
450
|
A team rule set still in version 1's layout, `rules/<ID>/discipline.json` beside `mechanisms/`, is converted by the same run. Before it, do these by hand, in a commit of their own:
|
|
443
451
|
|
|
444
|
-
1. **Name and define what version 2 needs.** Names and definitions are your team's judgement, so the upgrade asks for them rather than writing its own: write `version-two-names.json` at the rule set's root. `clauses` gives each mechanical clause a check of its own, not one of Hone's, and a title, such as `"ACME-1#console-calls": { "check": "direct-console#console-calls", "title": "Console calls" }`. `symptoms`, `cases`, `principles` and `rules` define each symptom those checks see, and what each symptom points at, with the same facts as their items in [docs/extending.md](docs/extending.md); a symptom's `seen` is taken from its clauses' summaries. Anything missing refuses the upgrade, and the refusal lists every entry to add.
|
|
445
|
-
2. **Update the pieces to version 2's piece API,** which [docs/extending.md](docs/extending.md) describes: a walker piece reads `bindings`
|
|
452
|
+
1. **Name and define what version 2 needs.** Names and definitions are your team's judgement, so the upgrade asks for them rather than writing its own: write `version-two-names.json` at the rule set's root. `clauses` gives each mechanical clause a check of its own, not one of Hone's, and a title, such as `"ACME-1#console-calls": { "check": "direct-console#console-calls", "title": "Console calls" }`. `symptoms`, `cases`, `principles` and `rules` define each symptom those checks see, and what each symptom points at, with the same facts as their items in [docs/extending.md](docs/extending.md); a symptom's `seen` is taken from its clauses' summaries. Every symptom, case, principle and rule also needs a `title`, which its item holds as its heading, and a rule needs its `principle` and `standing`. The `acme` rule set's [names file](https://github.com/HailsTails/hone/blob/main/delivery/install-proof/consumer-proof/team/tools/disciplines/acme/version-two-names.json) is a whole example. Anything missing refuses the upgrade, and the refusal lists every entry to add.
|
|
453
|
+
2. **Update the pieces to version 2's piece API,** which [docs/extending.md](docs/extending.md) describes: a walker piece's `prepare({ bindings })` reads `bindings` where it read clauses, each hit names its `check`, the `binding.address`, where it named a clause, it imports from `@hailstails/hone/walker`, and its tests use `@hailstails/hone/testing`. The upgrade runs the pieces in version 2's check, so they must run under version 2 first. A test that builds the `repository` it hands to `prepare` must give it `testFiles`. Tests that use `@hailstails/hone/testing` read the version 2 layout, so they fail from installing version 2 until the upgrade has run.
|
|
454
|
+
3. **Let your own checks admit the new folders.** A team check that judges paths or Markdown sees the items and pieces the upgrade writes, so update what it allows first. Otherwise its findings there are recorded as debt, which a run that assesses forfeiture against a base from before the upgrade lists as `forfeited`: then update the check, and run `hone prune-debt` with that base and `--forfeiture this-run`.
|
|
455
|
+
|
|
456
|
+
The upgrade writes the definitions, symptoms and checks under the rule set's `rules/` folder and each clause's cases as its check's examples, moves each piece's folder to `engines/<engine>/<symptom>/<check>/`, and removes the version 1 files and the names file. It leaves the clauses' names in `rules/version-one-names.json`, which the check reads to judge the carried records: update it when you rename or remove a check it names, and delete it once your main branch is on version 2. Deleting it earlier gets that rule set's carried records refused. An authorised location on a moved piece becomes debt, for you to re-authorise at its new path. A folder that several clauses share is split: each clause's module and its test go to that clause's check, and the other files go once to the check of the clause first by name. Each moved file's relative imports, `require` calls and test-double module paths are rewritten for where it now sits. The upgrade refuses a folder whose one module serves several clauses, and an import or module path written as an expression rather than a string; give each clause a module of its own, or write the path as a string, first. The rule set takes Hone's record kinds, and its records land under `hone-records/<rule set>/`. An upgrade that stopped part way leaves version 1 discipline files beside version 2 items, and a second `hone upgrade` refuses that rule set until they are removed or it is restored.
|
|
446
457
|
|
|
447
|
-
|
|
458
|
+
After the upgrade, rewrite each generated `seen` in your own words, and fix what points into the rule set's folder from outside it, which the upgrade leaves alone: `tsconfig` includes, imports and READMEs.
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ENGINE_REGISTRY,
|
|
3
3
|
NAMED_FOLDER_KINDS,
|
|
4
4
|
NESTED_CONFIGURATION_ISSUE,
|
|
5
|
-
NO_VERSION_ONE_NAMES,
|
|
6
5
|
RECORDS_FOLDER,
|
|
7
6
|
RECORDS_VERSION,
|
|
7
|
+
RULE_SET_NAMES_SEGMENTS,
|
|
8
8
|
SYMPTOM_CATALOGUE_SEGMENTS,
|
|
9
9
|
VERSION_ONE_NAMES_SEGMENTS,
|
|
10
10
|
assessmentLine,
|
|
@@ -54,9 +54,8 @@ import {
|
|
|
54
54
|
symptomWireSchema,
|
|
55
55
|
toolCatalogueOf,
|
|
56
56
|
unmeasuredLine,
|
|
57
|
-
versionOneNamesOf,
|
|
58
57
|
versionOneRuleFilesOf
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-4PHKVNM3.js";
|
|
60
59
|
import {
|
|
61
60
|
defaultClauseSettings,
|
|
62
61
|
namedChecksRunReportSchema,
|
|
@@ -64,7 +63,7 @@ import {
|
|
|
64
63
|
runnerEnginesOver,
|
|
65
64
|
runnerInvalidOutput,
|
|
66
65
|
runnerModuleAt
|
|
67
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-P2VHWLK4.js";
|
|
68
67
|
import {
|
|
69
68
|
installRootOf,
|
|
70
69
|
loadFailureDetail,
|
|
@@ -3435,31 +3434,21 @@ var unrestoredLinesOf = (request) => {
|
|
|
3435
3434
|
]
|
|
3436
3435
|
];
|
|
3437
3436
|
};
|
|
3437
|
+
var folderTextOf = (request) => request.folder === "" ? "the repository root" : request.folder;
|
|
3438
|
+
var folderOf = (request) => request.file.slice(0, Math.max(request.file.lastIndexOf("/"), 0));
|
|
3438
3439
|
var oracleLineOf = (request) => {
|
|
3439
3440
|
const { failure } = request;
|
|
3440
3441
|
switch (failure.kind) {
|
|
3441
3442
|
case "version-one-run-failed":
|
|
3442
|
-
return `version 1's own run could not be made (${failure.detail}).
|
|
3443
|
+
return `version 1's own run could not be made (${failure.detail}). Fix what it names, then run the upgrade again.`;
|
|
3443
3444
|
case "finding-not-attributable":
|
|
3444
3445
|
return `a finding of ${failure.clause} in ${failure.file} names no check of version 2. Report it at ${UPGRADE_ISSUES_URL}.`;
|
|
3445
3446
|
case "record-doubly-held":
|
|
3446
3447
|
return `${failure.clause} in ${failure.file} is held by both a file carve-out and an authorised location. Remove one of them first, then run the upgrade again.`;
|
|
3447
3448
|
case "projection-not-current":
|
|
3448
|
-
return `the version 1 projection ${failure.file} is ${failure.state}. ${
|
|
3449
|
+
return `the version 1 projection ${failure.file} is ${failure.state}. Spread its default export last in the ESLint config that loads for ${folderTextOf({ folder: folderOf({ file: failure.file }) })}, then run the upgrade again.`;
|
|
3449
3450
|
}
|
|
3450
3451
|
};
|
|
3451
|
-
var projectionActionOf = (request) => {
|
|
3452
|
-
switch (request.state) {
|
|
3453
|
-
case "out-of-date":
|
|
3454
|
-
case "missing":
|
|
3455
|
-
return "Run hone project with your version 1 release, commit what it writes, then run the upgrade again.";
|
|
3456
|
-
case "not-applied":
|
|
3457
|
-
case "not-included":
|
|
3458
|
-
case "unconfigured":
|
|
3459
|
-
return "Run hone check with your version 1 release, fix what it reports, then run the upgrade again.";
|
|
3460
|
-
}
|
|
3461
|
-
};
|
|
3462
|
-
var folderTextOf = (request) => request.folder === "" ? "the repository root" : request.folder;
|
|
3463
3452
|
var specifierOf = (request) => `./${request.projection.slice(request.projection.lastIndexOf("/") + 1)}`;
|
|
3464
3453
|
var configLineOf = (request) => {
|
|
3465
3454
|
const { refusal: refusal2 } = request;
|
|
@@ -3482,7 +3471,7 @@ var pairingLineOf = (request) => {
|
|
|
3482
3471
|
case "version-one-projection-unpaired":
|
|
3483
3472
|
return `the version 1 projection ${refusal2.projection} has no version 2 projection to take its place, since version 2 runs no lint config in ${folderTextOf({ folder: refusal2.folder })}. Remove it and its import in ${refusal2.config}, then run the upgrade again.`;
|
|
3484
3473
|
case "version-two-projection-unpaired":
|
|
3485
|
-
return `version 2 would project ${refusal2.file}, but version 1
|
|
3474
|
+
return `version 2 would project ${refusal2.file}, but version 1 projects nothing in ${folderTextOf({ folder: refusal2.folder })}: it leaves out a folder that holds its own disciplines.json. Remove that disciplines.json and spread ./disciplines.eslint.mjs last in the ESLint config of ${folderTextOf({ folder: refusal2.folder })}, then run the upgrade again.`;
|
|
3486
3475
|
}
|
|
3487
3476
|
};
|
|
3488
3477
|
var DEFINITION_LISTINGS = {
|
|
@@ -3510,7 +3499,7 @@ var pieceFolderSplitLineOf = (request) => {
|
|
|
3510
3499
|
case "specifier-not-literal":
|
|
3511
3500
|
return `${split.file}:${split.line} names a module with an expression rather than a string, so the upgrade cannot point it at where the files of ${folder} move. Write the path as a string, then run the upgrade again.`;
|
|
3512
3501
|
case "target-not-moved":
|
|
3513
|
-
return `${split.file}:${split.line} imports
|
|
3502
|
+
return `${split.file}:${split.line} imports something in ${folder} that the upgrade does not move: piece.json, which the upgrade replaces, the folder itself, or a file that is not there. So it cannot point the import at where the folder's files move. Fix or remove the import, then run the upgrade again.`;
|
|
3514
3503
|
}
|
|
3515
3504
|
};
|
|
3516
3505
|
var planLinesOf = (request) => {
|
|
@@ -3582,7 +3571,7 @@ var readFailureLinesOf = (request) => {
|
|
|
3582
3571
|
switch (failure.kind) {
|
|
3583
3572
|
case "version-one-unreadable":
|
|
3584
3573
|
return [
|
|
3585
|
-
`version 1's files could not be read (${loadFailureDetail({ failure: failure.failure })}).
|
|
3574
|
+
`version 1's files could not be read (${loadFailureDetail({ failure: failure.failure })}). Fix what it names, then run the upgrade again.`
|
|
3586
3575
|
];
|
|
3587
3576
|
case "records-refused":
|
|
3588
3577
|
return failure.refusal.kind === "invalid-records" ? [
|
|
@@ -3646,7 +3635,13 @@ var mapVersionOneRunRefusalToLines = (request) => {
|
|
|
3646
3635
|
const { failure, placement } = request;
|
|
3647
3636
|
switch (failure.kind) {
|
|
3648
3637
|
case "oracle-failed":
|
|
3649
|
-
return {
|
|
3638
|
+
return {
|
|
3639
|
+
code: 1,
|
|
3640
|
+
lines: [
|
|
3641
|
+
oracleLineOf({ failure: failure.failure }),
|
|
3642
|
+
...unrestoredLinesOf({ ...failure, placement, unrestored: [] })
|
|
3643
|
+
]
|
|
3644
|
+
};
|
|
3650
3645
|
case "plan-refused":
|
|
3651
3646
|
return {
|
|
3652
3647
|
code: 1,
|
|
@@ -3659,7 +3654,7 @@ var mapVersionOneRunRefusalToLines = (request) => {
|
|
|
3659
3654
|
return {
|
|
3660
3655
|
code: 1,
|
|
3661
3656
|
lines: [
|
|
3662
|
-
`version 1's run failed (${failure.failure.detail}).
|
|
3657
|
+
`version 1's run failed (${failure.failure.detail}). Fix what it names, then run the upgrade again.`,
|
|
3663
3658
|
...unrestoredLinesOf({ ...failure, placement, unrestored: [] })
|
|
3664
3659
|
]
|
|
3665
3660
|
};
|
|
@@ -3680,18 +3675,10 @@ var mapVersionOneWriteRefusalToLines = (request) => {
|
|
|
3680
3675
|
return {
|
|
3681
3676
|
code: 1,
|
|
3682
3677
|
lines: [
|
|
3683
|
-
`version 1's own project failed (${failure.detail}).
|
|
3678
|
+
`version 1's own project failed (${failure.detail}). Fix what it names, then run the upgrade again.`,
|
|
3684
3679
|
VERSION_ONE_PROJECT_MAY_HAVE_CHANGED
|
|
3685
3680
|
]
|
|
3686
3681
|
};
|
|
3687
|
-
case "version-one-project-rewrote":
|
|
3688
|
-
return {
|
|
3689
|
-
code: 1,
|
|
3690
|
-
lines: [
|
|
3691
|
-
`version 1's own project rewrote ${failure.files.join(", ")}, which the upgrade had already measured. Commit what it wrote, then run the upgrade again.`,
|
|
3692
|
-
...removedByVersionOneLinesOf({ ...failure, placement })
|
|
3693
|
-
]
|
|
3694
|
-
};
|
|
3695
3682
|
case "unplaceable-path":
|
|
3696
3683
|
return {
|
|
3697
3684
|
code: 1,
|
|
@@ -4177,14 +4164,14 @@ var FOLDER_SEPARATOR = "/";
|
|
|
4177
4164
|
var absoluteOf = (request) => absolutePathSchema.parse(
|
|
4178
4165
|
request.ports.path.join({ segments: [request.ports.repoRoot, request.file] })
|
|
4179
4166
|
);
|
|
4180
|
-
var
|
|
4167
|
+
var folderOf2 = (request) => request.file.slice(0, request.file.lastIndexOf(FOLDER_SEPARATOR));
|
|
4181
4168
|
var unwritable = (request) => ({
|
|
4182
4169
|
outcome: "failed",
|
|
4183
4170
|
error: { kind: "file-unwritable", path: request.path, detail: request.detail }
|
|
4184
4171
|
});
|
|
4185
4172
|
var writtenDocument = (request) => {
|
|
4186
4173
|
const made = request.ports.directory.create({
|
|
4187
|
-
path: absoluteOf({ ports: request.ports, file:
|
|
4174
|
+
path: absoluteOf({ ports: request.ports, file: folderOf2({ file: request.document.file }) })
|
|
4188
4175
|
});
|
|
4189
4176
|
if (made.outcome === "failed") {
|
|
4190
4177
|
return unwritable(made.error);
|
|
@@ -5691,13 +5678,14 @@ var debtAt = (request) => {
|
|
|
5691
5678
|
};
|
|
5692
5679
|
var debtOf = (request) => {
|
|
5693
5680
|
const parsed = carveOutEntrySchema.safeParse(request.entry);
|
|
5694
|
-
return parsed.success ?
|
|
5695
|
-
|
|
5696
|
-
|
|
5681
|
+
return parsed.success ? readChecksOfClause({
|
|
5682
|
+
clauseChecks: request.clauseChecks,
|
|
5683
|
+
clause: parsed.data.clause
|
|
5684
|
+
}).flatMap((check) => debtAt({ check, entry: request.entry, file: parsed.data.file })) : [];
|
|
5697
5685
|
};
|
|
5698
5686
|
var carriedDebtDocumentsAtBaseOf = (request) => {
|
|
5699
5687
|
const placed = request.entries.flatMap(
|
|
5700
|
-
(entry) => debtOf({ entry,
|
|
5688
|
+
(entry) => debtOf({ entry, clauseChecks: request.clauseChecks })
|
|
5701
5689
|
);
|
|
5702
5690
|
return [...new Set(placed.map(({ file }) => file))].map((file) => ({
|
|
5703
5691
|
file,
|
|
@@ -6004,10 +5992,8 @@ var baseStandingRecordsSource = (request) => ({
|
|
|
6004
5992
|
if (selection.outcome === "failed") {
|
|
6005
5993
|
return selection;
|
|
6006
5994
|
}
|
|
6007
|
-
const clauseChecks = createClauseChecks({ catalogues: request.
|
|
6008
|
-
const content = createRuleContent({
|
|
6009
|
-
catalogues: request.catalogues.map(({ catalogue }) => catalogue)
|
|
6010
|
-
});
|
|
5995
|
+
const clauseChecks = createClauseChecks({ catalogues: [{ catalogue: request.catalogue }] });
|
|
5996
|
+
const content = createRuleContent({ catalogues: [request.catalogue] });
|
|
6011
5997
|
const standings = entries.value.flatMap((each) => createLocationInput({ base: each })).map(
|
|
6012
5998
|
(input) => createBaseEntryStanding({ selection: selection.value, input, clauseChecks, content })
|
|
6013
5999
|
);
|
|
@@ -6019,7 +6005,7 @@ var baseStandingRecordsSource = (request) => ({
|
|
|
6019
6005
|
})),
|
|
6020
6006
|
...carriedDebtDocumentsAtBaseOf({
|
|
6021
6007
|
entries: entries.value.map(({ carried }) => carried),
|
|
6022
|
-
|
|
6008
|
+
clauseChecks
|
|
6023
6009
|
})
|
|
6024
6010
|
].filter(({ file }) => !heldAtBase2.has(file));
|
|
6025
6011
|
return { outcome: "ok", value: [...base.value, ...absentAtBase] };
|
|
@@ -6032,7 +6018,7 @@ var versionOneAwareRecordsSourceOf = (request) => (folder) => baseStandingRecord
|
|
|
6032
6018
|
git: folder.git,
|
|
6033
6019
|
repoRoot: folder.repoRoot
|
|
6034
6020
|
}),
|
|
6035
|
-
|
|
6021
|
+
catalogue: folder.catalogue
|
|
6036
6022
|
});
|
|
6037
6023
|
|
|
6038
6024
|
// src/infrastructure/discipline-exceptions-folder/exception-layout.ts
|
|
@@ -7573,7 +7559,7 @@ var foundTreeRecordsSourceOver = (request) => baseStandingRecordsSource({
|
|
|
7573
7559
|
git: request.git,
|
|
7574
7560
|
repoRoot: request.repoRoot
|
|
7575
7561
|
}),
|
|
7576
|
-
|
|
7562
|
+
catalogue: request.catalogue
|
|
7577
7563
|
});
|
|
7578
7564
|
var foundTreeRecordsSourceOf = (request) => (folder) => foundTreeRecordsSourceOver({
|
|
7579
7565
|
source: request.recordsSourceOf(folder),
|
|
@@ -7761,7 +7747,8 @@ var checksNamedFor = (request) => request.named.kind === "mechanical" && sameCla
|
|
|
7761
7747
|
var readInstallChecks = (request) => {
|
|
7762
7748
|
const names = readVersionOneNames({
|
|
7763
7749
|
fileText: request.fileText,
|
|
7764
|
-
path: request.path.join({ segments: [request.installRoot, ...VERSION_ONE_NAMES_SEGMENTS] })
|
|
7750
|
+
path: request.path.join({ segments: [request.installRoot, ...VERSION_ONE_NAMES_SEGMENTS] }),
|
|
7751
|
+
ruleSet: TOOL_RULE_SET
|
|
7765
7752
|
});
|
|
7766
7753
|
return names.outcome === "failed" ? names : {
|
|
7767
7754
|
outcome: "ok",
|
|
@@ -10269,6 +10256,9 @@ var plannedPatchOf = (request) => {
|
|
|
10269
10256
|
error: { kind: "unplaceable-path", file: request.file, removedByVersionOne: [] }
|
|
10270
10257
|
};
|
|
10271
10258
|
}
|
|
10259
|
+
if (request.queries.fileText.exists({ path }) === "absent") {
|
|
10260
|
+
return { outcome: "ok", value: [] };
|
|
10261
|
+
}
|
|
10272
10262
|
const read = request.queries.fileText.read({ path });
|
|
10273
10263
|
if (read.outcome === "failed") {
|
|
10274
10264
|
return {
|
|
@@ -10314,12 +10304,9 @@ var patchedProjectionsOf = (request) => {
|
|
|
10314
10304
|
error: { kind: "write-refused", refusal: written.error, removedByVersionOne: [] }
|
|
10315
10305
|
} : written;
|
|
10316
10306
|
};
|
|
10317
|
-
var
|
|
10307
|
+
var filesVersionOneRemoved = (request) => {
|
|
10318
10308
|
const { refusal: refusal2 } = request;
|
|
10319
|
-
const files = [
|
|
10320
|
-
..."removedByVersionOne" in refusal2 ? refusal2.removedByVersionOne : [],
|
|
10321
|
-
...refusal2.kind === "version-one-project-rewrote" ? refusal2.files : []
|
|
10322
|
-
];
|
|
10309
|
+
const files = "removedByVersionOne" in refusal2 ? refusal2.removedByVersionOne : [];
|
|
10323
10310
|
return files.flatMap((file) => {
|
|
10324
10311
|
const path = request.queries.path.join({ segments: [request.repoRoot, file] });
|
|
10325
10312
|
return isAbsolutePath(path) ? [path] : [];
|
|
@@ -10354,10 +10341,10 @@ var restoredAfterRefusal = (request) => {
|
|
|
10354
10341
|
return withUnrestored({ refusal: request.refusal, unrestored });
|
|
10355
10342
|
};
|
|
10356
10343
|
var restoredOriginalProjections = (request) => {
|
|
10357
|
-
const
|
|
10344
|
+
const removed2 = filesVersionOneRemoved(request);
|
|
10358
10345
|
return restoredAfterRefusal({
|
|
10359
10346
|
effects: request.effects,
|
|
10360
|
-
writes: request.
|
|
10347
|
+
writes: request.writes.filter((write) => !removed2.includes(write.path)),
|
|
10361
10348
|
refusal: request.refusal
|
|
10362
10349
|
});
|
|
10363
10350
|
};
|
|
@@ -10811,11 +10798,11 @@ var rewrittenConfigOf = (request) => {
|
|
|
10811
10798
|
|
|
10812
10799
|
// src/application/upgrade/proof/projection-replacements.ts
|
|
10813
10800
|
var PATH_SEPARATOR3 = "/";
|
|
10814
|
-
var
|
|
10801
|
+
var folderOf3 = (request) => directoryOf({ file: request.file }).join(PATH_SEPARATOR3);
|
|
10815
10802
|
var pairOf = (request) => {
|
|
10816
|
-
const folder =
|
|
10803
|
+
const folder = folderOf3({ file: request.version.projection });
|
|
10817
10804
|
const projected = request.projected.find(
|
|
10818
|
-
(candidate) =>
|
|
10805
|
+
(candidate) => folderOf3({ file: candidate.file }) === folder
|
|
10819
10806
|
);
|
|
10820
10807
|
return projected === void 0 ? {
|
|
10821
10808
|
outcome: "failed",
|
|
@@ -10877,7 +10864,7 @@ var replacementsOf2 = (request) => {
|
|
|
10877
10864
|
refusal: {
|
|
10878
10865
|
kind: "version-two-projection-unpaired",
|
|
10879
10866
|
file: alone.file,
|
|
10880
|
-
folder:
|
|
10867
|
+
folder: folderOf3({ file: alone.file })
|
|
10881
10868
|
}
|
|
10882
10869
|
}
|
|
10883
10870
|
};
|
|
@@ -11147,8 +11134,6 @@ var projectionsRefusalOf = (request) => {
|
|
|
11147
11134
|
detail: refusal2.detail,
|
|
11148
11135
|
removedByVersionOne: []
|
|
11149
11136
|
};
|
|
11150
|
-
case "project-rewrote":
|
|
11151
|
-
return { kind: "version-one-project-rewrote", files: refusal2.files, removedByVersionOne: [] };
|
|
11152
11137
|
case "team-config-refused":
|
|
11153
11138
|
case "slice-left-in-place":
|
|
11154
11139
|
return { kind: "plan-refused", refusal: refusal2, removedByVersionOne: [] };
|
|
@@ -11298,38 +11283,17 @@ var withRemovedByVersionOne = (request) => {
|
|
|
11298
11283
|
return request.result;
|
|
11299
11284
|
}
|
|
11300
11285
|
const { error } = request.result;
|
|
11301
|
-
return error.kind === "
|
|
11302
|
-
};
|
|
11303
|
-
var projectedOver = async (request) => {
|
|
11304
|
-
const reading = await request.versionOneProjectionsOf();
|
|
11305
|
-
const carried = await afterReading({ ...request, projectionsReading: reading });
|
|
11306
|
-
return withRemovedByVersionOne({ result: carried, removed: reading.removed });
|
|
11307
|
-
};
|
|
11308
|
-
var afterReading = async (request) => {
|
|
11309
|
-
const reading = request.projectionsReading;
|
|
11310
|
-
const removed2 = removedPlacedOf({
|
|
11311
|
-
queries: request.queries,
|
|
11312
|
-
repoRoot: request.repoRoot,
|
|
11313
|
-
removed: reading.removed
|
|
11314
|
-
});
|
|
11315
|
-
if (removed2.outcome === "failed") {
|
|
11316
|
-
return removed2;
|
|
11317
|
-
}
|
|
11318
|
-
if (reading.outcome.outcome === "failed") {
|
|
11319
|
-
return { outcome: "failed", error: projectionsRefusalOf({ refusal: reading.outcome.error }) };
|
|
11320
|
-
}
|
|
11321
|
-
return afterProjecting({
|
|
11322
|
-
...request,
|
|
11323
|
-
projections: reading.outcome.value,
|
|
11324
|
-
removed: removed2.value
|
|
11325
|
-
});
|
|
11286
|
+
return error.kind === "removal-failed" ? request.result : { outcome: "failed", error: { ...error, removedByVersionOne: request.removed } };
|
|
11326
11287
|
};
|
|
11327
11288
|
var provenOver = async (request) => {
|
|
11328
11289
|
const answered = await request.oracle.answer({
|
|
11329
11290
|
records: request.reading.heads.map(({ record }) => record)
|
|
11330
11291
|
});
|
|
11331
11292
|
if (answered.outcome === "failed") {
|
|
11332
|
-
return {
|
|
11293
|
+
return {
|
|
11294
|
+
outcome: "failed",
|
|
11295
|
+
error: { kind: "oracle-failed", failure: answered.error, removedByVersionOne: [] }
|
|
11296
|
+
};
|
|
11333
11297
|
}
|
|
11334
11298
|
const plan = await upgradePlanOf({
|
|
11335
11299
|
reading: request.reading,
|
|
@@ -11361,7 +11325,26 @@ var provenOver = async (request) => {
|
|
|
11361
11325
|
}
|
|
11362
11326
|
};
|
|
11363
11327
|
}
|
|
11364
|
-
return
|
|
11328
|
+
return afterProjecting({ ...request, plan: plan.value });
|
|
11329
|
+
};
|
|
11330
|
+
var afterReading = async (request) => {
|
|
11331
|
+
const reading = request.projectionsReading;
|
|
11332
|
+
const removed2 = removedPlacedOf({
|
|
11333
|
+
queries: request.queries,
|
|
11334
|
+
repoRoot: request.repoRoot,
|
|
11335
|
+
removed: reading.removed
|
|
11336
|
+
});
|
|
11337
|
+
if (removed2.outcome === "failed") {
|
|
11338
|
+
return removed2;
|
|
11339
|
+
}
|
|
11340
|
+
if (reading.outcome.outcome === "failed") {
|
|
11341
|
+
return { outcome: "failed", error: projectionsRefusalOf({ refusal: reading.outcome.error }) };
|
|
11342
|
+
}
|
|
11343
|
+
return provenOver({
|
|
11344
|
+
...request,
|
|
11345
|
+
projections: reading.outcome.value,
|
|
11346
|
+
removed: removed2.value
|
|
11347
|
+
});
|
|
11365
11348
|
};
|
|
11366
11349
|
var upgradeProof = async (request) => {
|
|
11367
11350
|
const { queries, effects, repoRoot, trackedPaths } = request;
|
|
@@ -11369,14 +11352,18 @@ var upgradeProof = async (request) => {
|
|
|
11369
11352
|
if (patches.outcome === "failed") {
|
|
11370
11353
|
return patches;
|
|
11371
11354
|
}
|
|
11372
|
-
const
|
|
11355
|
+
const projectionsReading = await request.versionOneProjectionsOf();
|
|
11356
|
+
const proven = withRemovedByVersionOne({
|
|
11357
|
+
result: await afterReading({ ...request, projectionsReading }),
|
|
11358
|
+
removed: projectionsReading.removed
|
|
11359
|
+
});
|
|
11373
11360
|
return proven.outcome === "ok" ? proven : {
|
|
11374
11361
|
outcome: "failed",
|
|
11375
11362
|
error: restoredOriginalProjections({
|
|
11376
11363
|
queries,
|
|
11377
11364
|
effects,
|
|
11378
11365
|
repoRoot,
|
|
11379
|
-
|
|
11366
|
+
writes: [...patches.value, ...projectionsReading.written],
|
|
11380
11367
|
refusal: proven.error
|
|
11381
11368
|
})
|
|
11382
11369
|
};
|
|
@@ -11811,28 +11798,6 @@ var readVersionOneTeamLayout = (request) => {
|
|
|
11811
11798
|
detail: `${unclaimed} names no mechanical clause of rule set ${request.ruleSet.name}`
|
|
11812
11799
|
});
|
|
11813
11800
|
};
|
|
11814
|
-
var teamUpgradeNamesOf = (request) => {
|
|
11815
|
-
const names = versionOneNamesOf({
|
|
11816
|
-
document: {
|
|
11817
|
-
version: 1,
|
|
11818
|
-
clauses: request.layout.clauses.flatMap(
|
|
11819
|
-
({ clause, naming, anchor }) => naming.naming === "named" ? [
|
|
11820
|
-
{
|
|
11821
|
-
clause: clauseAddressText({ address: clause }),
|
|
11822
|
-
sight: { kind: "one-symptom", symptom: naming.check.symptom },
|
|
11823
|
-
checks: [checkAddressOfNames(naming.check)],
|
|
11824
|
-
anchor
|
|
11825
|
-
}
|
|
11826
|
-
] : []
|
|
11827
|
-
),
|
|
11828
|
-
recordKinds: {}
|
|
11829
|
-
}
|
|
11830
|
-
});
|
|
11831
|
-
return names.outcome === "failed" ? {
|
|
11832
|
-
outcome: "failed",
|
|
11833
|
-
error: { kind: "file-malformed", path: request.namesPath, detail: names.error }
|
|
11834
|
-
} : names;
|
|
11835
|
-
};
|
|
11836
11801
|
var usedTeamRuleSetsOf = (selection) => {
|
|
11837
11802
|
const used = new Set(
|
|
11838
11803
|
selection.clauses.flatMap(([{ ruleSet }]) => ruleSet === TOOL_RULE_SET ? [] : [ruleSet.name])
|
|
@@ -11892,35 +11857,17 @@ var versionOneTeamLayoutsOf = (request) => {
|
|
|
11892
11857
|
});
|
|
11893
11858
|
return layouts.outcome === "failed" ? layouts : { outcome: "ok", value: layouts.value.flat() };
|
|
11894
11859
|
};
|
|
11895
|
-
var teamUpgradeNamesAt = (request) => {
|
|
11896
|
-
const layout = readVersionOneTeamLayout(request);
|
|
11897
|
-
return layout.outcome === "failed" ? layout : teamUpgradeNamesOf({
|
|
11898
|
-
layout: layout.value,
|
|
11899
|
-
namesPath: request.path.join({ segments: [request.root, VERSION_TWO_NAMES_FILE] })
|
|
11900
|
-
});
|
|
11901
|
-
};
|
|
11902
11860
|
|
|
11903
11861
|
// src/infrastructure/content-files/symptom-catalogues/upgrade-rule-set-catalogues.ts
|
|
11904
|
-
var upgradeNamesAt = (request) => {
|
|
11905
|
-
const named = request.path.join({ segments: [request.root, VERSION_TWO_NAMES_FILE] });
|
|
11906
|
-
if (request.fileText.exists({ path: named }) === "present") {
|
|
11907
|
-
return teamUpgradeNamesAt(request);
|
|
11908
|
-
}
|
|
11909
|
-
const path = request.path.join({ segments: [request.root, "rules", "version-one-names.json"] });
|
|
11910
|
-
return request.fileText.exists({ path }) === "present" ? readVersionOneNames({ fileText: request.fileText, path }) : { outcome: "ok", value: NO_VERSION_ONE_NAMES };
|
|
11911
|
-
};
|
|
11912
11862
|
var catalogueAt = (request) => {
|
|
11913
11863
|
const ruleSet = { name: request.ruleSet.name };
|
|
11914
11864
|
const root = ruleSetRootOf2({ ...request, ruleSet, ruleSets: [request.ruleSet] });
|
|
11915
11865
|
if (root.outcome === "failed") return root;
|
|
11916
|
-
const names = upgradeNamesAt({ ...request, root: root.value });
|
|
11917
|
-
if (names.outcome === "failed") return names;
|
|
11918
11866
|
const held = readBoundCatalogue({
|
|
11919
11867
|
...request,
|
|
11920
11868
|
ruleSet,
|
|
11921
11869
|
ruleSetRoot: root.value,
|
|
11922
|
-
inheritedRecordKinds: request.toolRecordKinds
|
|
11923
|
-
upgradeNames: names.value
|
|
11870
|
+
inheritedRecordKinds: request.toolRecordKinds
|
|
11924
11871
|
});
|
|
11925
11872
|
if (held.outcome === "failed") return held;
|
|
11926
11873
|
return {
|
|
@@ -12175,6 +12122,10 @@ var mapSmoothedToLines = (request) => {
|
|
|
12175
12122
|
`upgrade: records written ${countWrittenRecords({ records })}, carried records removed ${smoothed.removedCarried.length}, debt recorded ${recordedDebt.length}, debt pruned ${smoothed.prunedDebt.length}; version 2's check passes`
|
|
12176
12123
|
];
|
|
12177
12124
|
};
|
|
12125
|
+
var NAMES_FILE_END = `/${RULE_SET_NAMES_SEGMENTS.join("/")}`;
|
|
12126
|
+
var createNamesLines = (request) => request.written.filter((file) => `/${file}`.endsWith(NAMES_FILE_END)).map(
|
|
12127
|
+
(file) => `keep ${file} until your main branch is on version 2, then you can delete it: until then the check judges carried records by it`
|
|
12128
|
+
);
|
|
12178
12129
|
var upgradeSuccessOutcomeOf = (request) => {
|
|
12179
12130
|
const { carried, repoRoot, path } = request;
|
|
12180
12131
|
const removed2 = [...carried.removed.files, ...carried.removed.folders];
|
|
@@ -12189,6 +12140,7 @@ var upgradeSuccessOutcomeOf = (request) => {
|
|
|
12189
12140
|
...carriedLinesOf({ records: carried.records }),
|
|
12190
12141
|
...carried.mentions.map(({ file, line }) => `mention ${file}:${line}`),
|
|
12191
12142
|
...carried.unread.map(({ file, detail }) => `mention-unread ${file} ${detail}`),
|
|
12143
|
+
...createNamesLines({ written: carried.written }),
|
|
12192
12144
|
...mapSmoothedToLines({ carried })
|
|
12193
12145
|
].map((line) => `${line}
|
|
12194
12146
|
`).join("")
|
|
@@ -12369,34 +12321,42 @@ var teamConfigsOf = (request) => {
|
|
|
12369
12321
|
// src/application/upgrade/proof/version-one-projections-reading.ts
|
|
12370
12322
|
var pathsWith = (request) => request.writes.filter((write) => write.effect === request.effect).map((write) => write.path);
|
|
12371
12323
|
var refusedWith4 = (request) => ({
|
|
12324
|
+
written: request.written,
|
|
12372
12325
|
removed: request.removed,
|
|
12373
12326
|
outcome: { outcome: "failed", error: request.refusal }
|
|
12374
12327
|
});
|
|
12375
12328
|
var readOver = (request) => {
|
|
12329
|
+
const written = request.sources.writes();
|
|
12376
12330
|
const removed2 = pathsWith({ writes: request.writes, effect: "removed" });
|
|
12377
12331
|
const stale = pathsWith({ writes: request.writes, effect: "left-in-place" });
|
|
12378
12332
|
if (stale.length > 0) {
|
|
12379
|
-
return refusedWith4({
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12333
|
+
return refusedWith4({
|
|
12334
|
+
written,
|
|
12335
|
+
removed: removed2,
|
|
12336
|
+
refusal: { kind: "slice-left-in-place", files: stale }
|
|
12337
|
+
});
|
|
12384
12338
|
}
|
|
12385
12339
|
const configs = request.sources.teamConfigsOf({
|
|
12386
|
-
projections:
|
|
12340
|
+
projections: request.writes.flatMap(({ path, effect }) => effect === "removed" ? [] : [path])
|
|
12387
12341
|
});
|
|
12388
|
-
return configs.outcome === "failed" ? refusedWith4({
|
|
12342
|
+
return configs.outcome === "failed" ? refusedWith4({
|
|
12343
|
+
written,
|
|
12344
|
+
removed: removed2,
|
|
12345
|
+
refusal: { kind: "team-config-refused", refusal: configs.error }
|
|
12346
|
+
}) : { written, removed: removed2, outcome: configs };
|
|
12389
12347
|
};
|
|
12390
12348
|
var versionOneProjectionsOver = (sources) => async () => {
|
|
12391
|
-
const
|
|
12392
|
-
return
|
|
12349
|
+
const projected = await sources.project();
|
|
12350
|
+
return projected.outcome === "failed" ? refusedWith4({
|
|
12351
|
+
written: sources.writes(),
|
|
12393
12352
|
removed: [],
|
|
12394
|
-
refusal: { kind: "project-failed", detail:
|
|
12395
|
-
}) : readOver({ writes:
|
|
12353
|
+
refusal: { kind: "project-failed", detail: projected.error.detail }
|
|
12354
|
+
}) : readOver({ writes: projected.value, sources });
|
|
12396
12355
|
};
|
|
12397
12356
|
|
|
12398
12357
|
// src/application/upgrade/command/version-one-projections.ts
|
|
12399
12358
|
var versionOneProjectionsOfRepository = (request) => versionOneProjectionsOver({
|
|
12359
|
+
writes: request.writes,
|
|
12400
12360
|
project: async () => {
|
|
12401
12361
|
const projected = await request.project();
|
|
12402
12362
|
return projected.outcome === "failed" ? {
|
|
@@ -12533,6 +12493,38 @@ var proofEffectsOver = (ports) => ({
|
|
|
12533
12493
|
undo: ({ writes }) => undoneWrites({ ports, writes })
|
|
12534
12494
|
});
|
|
12535
12495
|
|
|
12496
|
+
// src/application/upgrade/proof-writes/recorded-file-text.ts
|
|
12497
|
+
var unwritable2 = (request) => ({
|
|
12498
|
+
outcome: "failed",
|
|
12499
|
+
error: { kind: "unwritable", path: request.path, detail: request.detail }
|
|
12500
|
+
});
|
|
12501
|
+
var createRecordedFileText = (request) => {
|
|
12502
|
+
const { fileText } = request;
|
|
12503
|
+
const recorded = [];
|
|
12504
|
+
const write = ({ path, text }) => {
|
|
12505
|
+
if (!isAbsolutePath(path)) {
|
|
12506
|
+
return unwritable2({ path, detail: `${path} is not an absolute path` });
|
|
12507
|
+
}
|
|
12508
|
+
if (fileText.exists({ path }) === "absent") {
|
|
12509
|
+
const created = fileText.write({ path, text });
|
|
12510
|
+
if (created.outcome === "ok" || fileText.exists({ path }) === "present") {
|
|
12511
|
+
recorded.push({ kind: "file-created", path });
|
|
12512
|
+
}
|
|
12513
|
+
return created;
|
|
12514
|
+
}
|
|
12515
|
+
const original = fileText.read({ path });
|
|
12516
|
+
if (original.outcome === "failed") {
|
|
12517
|
+
return unwritable2({ path, detail: original.error.detail });
|
|
12518
|
+
}
|
|
12519
|
+
recorded.push({ kind: "file-replaced", path, original: original.value });
|
|
12520
|
+
return fileText.write({ path, text });
|
|
12521
|
+
};
|
|
12522
|
+
return {
|
|
12523
|
+
fileText: { read: fileText.read, exists: fileText.exists, write },
|
|
12524
|
+
writes: () => [...recorded]
|
|
12525
|
+
};
|
|
12526
|
+
};
|
|
12527
|
+
|
|
12536
12528
|
// src/domain/records/discipline-exceptions/governance.ts
|
|
12537
12529
|
var clauseKey = (request) => clauseAddressText({ address: request.clause });
|
|
12538
12530
|
var clauseFileKey = (request) => `${clauseKey({ clause: request.clause })} ${request.file}`;
|
|
@@ -12916,7 +12908,7 @@ var refused2 = (detail) => ({
|
|
|
12916
12908
|
outcome: "failed",
|
|
12917
12909
|
error: { kind: "version-one-run-failed", detail }
|
|
12918
12910
|
});
|
|
12919
|
-
var
|
|
12911
|
+
var versionOneNamesOf = (request) => {
|
|
12920
12912
|
const names = /* @__PURE__ */ new Map();
|
|
12921
12913
|
for (const { address, mechanism } of request.selected) {
|
|
12922
12914
|
const checks = checksOfClause({ catalogues: request.catalogues, clause: address });
|
|
@@ -13051,7 +13043,7 @@ var projectionProblemOf2 = (request) => {
|
|
|
13051
13043
|
var findingsFor = async (request) => {
|
|
13052
13044
|
const settings = settingsFor(request);
|
|
13053
13045
|
if (settings.outcome === "failed") return settings;
|
|
13054
|
-
const names =
|
|
13046
|
+
const names = versionOneNamesOf(request);
|
|
13055
13047
|
if (names.outcome === "failed") return names;
|
|
13056
13048
|
const checkedProjection = await request.checkProjection({ records: request.records });
|
|
13057
13049
|
if (checkedProjection.outcome === "failed") return checkedProjection;
|
|
@@ -13157,14 +13149,7 @@ var checkedProjectionOf = async (request) => {
|
|
|
13157
13149
|
})
|
|
13158
13150
|
);
|
|
13159
13151
|
}
|
|
13160
|
-
const
|
|
13161
|
-
if (invalid3 !== void 0 && invalid3.state !== "current") {
|
|
13162
|
-
return {
|
|
13163
|
-
outcome: "failed",
|
|
13164
|
-
error: { kind: "projection-not-current", file: invalid3.file, state: invalid3.state }
|
|
13165
|
-
};
|
|
13166
|
-
}
|
|
13167
|
-
const names = versionOneNamesOf2({
|
|
13152
|
+
const names = versionOneNamesOf({
|
|
13168
13153
|
selected: request.ready.selected.selection.selected,
|
|
13169
13154
|
catalogues: request.catalogues
|
|
13170
13155
|
});
|
|
@@ -13182,9 +13167,7 @@ var checkedProjectionOf = async (request) => {
|
|
|
13182
13167
|
value: {
|
|
13183
13168
|
settingsFile: VERSION_ONE_SETTINGS_FILE_NAME,
|
|
13184
13169
|
projectionFile: PROJECTION,
|
|
13185
|
-
packageFiles: inspected.value.files.
|
|
13186
|
-
({ file }) => file === PROJECTION ? [] : [file]
|
|
13187
|
-
),
|
|
13170
|
+
packageFiles: inspected.value.files.filter((file) => file !== PROJECTION),
|
|
13188
13171
|
rules: new Map(rules.value)
|
|
13189
13172
|
}
|
|
13190
13173
|
};
|
|
@@ -13364,6 +13347,7 @@ var ENGINES_FOLDER2 = "engines";
|
|
|
13364
13347
|
var ITEM_EXTENSION = ".md";
|
|
13365
13348
|
var SUMMARY_SEPARATOR = "; ";
|
|
13366
13349
|
var PIECE_VERSION = 2;
|
|
13350
|
+
var NAMES_VERSION = 1;
|
|
13367
13351
|
var JSON_INDENT3 = 2;
|
|
13368
13352
|
var PATH_SEPARATOR6 = "/";
|
|
13369
13353
|
var DEFINITION_FOLDERS = {
|
|
@@ -13457,6 +13441,19 @@ var checkTextsOf = (request) => request.clauses.map(({ check, title }) => ({
|
|
|
13457
13441
|
],
|
|
13458
13442
|
text: request.itemTextOf({ title, facts: {} })
|
|
13459
13443
|
}));
|
|
13444
|
+
var createNamesText = (request) => ({
|
|
13445
|
+
segments: RULE_SET_NAMES_SEGMENTS,
|
|
13446
|
+
text: documentTextOf({
|
|
13447
|
+
version: NAMES_VERSION,
|
|
13448
|
+
clauses: request.clauses.map(({ clause, check, anchor }) => ({
|
|
13449
|
+
clause: clauseAddressText({ address: clause }),
|
|
13450
|
+
sight: { kind: "one-symptom", symptom: check.symptom },
|
|
13451
|
+
checks: [checkAddressOfNames(check)],
|
|
13452
|
+
anchor
|
|
13453
|
+
})),
|
|
13454
|
+
recordKinds: {}
|
|
13455
|
+
})
|
|
13456
|
+
});
|
|
13460
13457
|
var pieceDeclarationOf = (request) => ({
|
|
13461
13458
|
version: PIECE_VERSION,
|
|
13462
13459
|
exceptions: request.clause.exceptions,
|
|
@@ -13482,6 +13479,7 @@ var pieceTextsOf = (request) => request.clause.pieces.flatMap((piece) => {
|
|
|
13482
13479
|
var layoutTextsOf = (request) => [
|
|
13483
13480
|
...definitionTextsOf(request),
|
|
13484
13481
|
...checkTextsOf(request),
|
|
13482
|
+
createNamesText(request),
|
|
13485
13483
|
...request.clauses.flatMap((clause) => pieceTextsOf({ clause }))
|
|
13486
13484
|
];
|
|
13487
13485
|
var rootSegmentsOf = (request) => request.location.location === "repo-root" ? [] : request.location.path.split(PATH_SEPARATOR6);
|
|
@@ -13874,12 +13872,8 @@ var createUpgradeSmoothing = (request) => createSmoothingCommands({
|
|
|
13874
13872
|
recordsEditor: request.ports.recordsEditor,
|
|
13875
13873
|
projectCommand: request.pointers.projectCommand
|
|
13876
13874
|
});
|
|
13877
|
-
var
|
|
13878
|
-
const { ports, command, located, prepared
|
|
13879
|
-
const reach = createReachOverLayout({
|
|
13880
|
-
foundTreeReach: request.foundTreeReach,
|
|
13881
|
-
layout: { files: layoutFiles, removed: ruleSetLayout.removed }
|
|
13882
|
-
});
|
|
13875
|
+
var createVersionOneBefore = (request) => {
|
|
13876
|
+
const { ports, command, located, prepared } = request;
|
|
13883
13877
|
const at = {
|
|
13884
13878
|
fileText: command.fileText,
|
|
13885
13879
|
fileRemoval: ports.fileRemoval,
|
|
@@ -13890,7 +13884,7 @@ var proofRequestOf = (request) => {
|
|
|
13890
13884
|
moduleExtension: prepared.check.moduleExtension,
|
|
13891
13885
|
toolRecordKinds: toolRecordKindsOf(prepared)
|
|
13892
13886
|
};
|
|
13893
|
-
|
|
13887
|
+
return createUpgradeBefore({
|
|
13894
13888
|
measureVersionOne: request.measureVersionOne,
|
|
13895
13889
|
check: prepared.check,
|
|
13896
13890
|
selection: prepared.read.reading.selection,
|
|
@@ -13898,9 +13892,34 @@ var proofRequestOf = (request) => {
|
|
|
13898
13892
|
engine: ports.namedEngine,
|
|
13899
13893
|
sources: ports.settingsSourcesOf(at),
|
|
13900
13894
|
readPiece: ports.checkPieceSourceOf(at),
|
|
13901
|
-
projection: ports.versionOneProjectionOf({
|
|
13895
|
+
projection: ports.versionOneProjectionOf({
|
|
13896
|
+
...at,
|
|
13897
|
+
fileText: request.projectionFileText,
|
|
13898
|
+
modules: command.modules
|
|
13899
|
+
}),
|
|
13902
13900
|
loadFailureDetail: ports.loadFailureDetail
|
|
13903
13901
|
});
|
|
13902
|
+
};
|
|
13903
|
+
var createVersionOneProjections = (request) => {
|
|
13904
|
+
const { ports, command, located, prepared } = request;
|
|
13905
|
+
return versionOneProjectionsOfRepository({
|
|
13906
|
+
writes: request.writes,
|
|
13907
|
+
project: () => request.before.prepareProjections(prepared.read.reading.heads.map(({ record }) => record)),
|
|
13908
|
+
loadFailureDetail: ports.loadFailureDetail,
|
|
13909
|
+
fileText: command.fileText,
|
|
13910
|
+
path: command.path,
|
|
13911
|
+
repoRoot: located.repoRoot,
|
|
13912
|
+
trackedPaths: prepared.trackedPaths
|
|
13913
|
+
});
|
|
13914
|
+
};
|
|
13915
|
+
var proofRequestOf = (request) => {
|
|
13916
|
+
const { ports, command, located, prepared, ruleSetLayout, layoutFiles } = request;
|
|
13917
|
+
const reach = createReachOverLayout({
|
|
13918
|
+
foundTreeReach: request.foundTreeReach,
|
|
13919
|
+
layout: { files: layoutFiles, removed: ruleSetLayout.removed }
|
|
13920
|
+
});
|
|
13921
|
+
const recorded = createRecordedFileText({ fileText: command.fileText });
|
|
13922
|
+
const before = createVersionOneBefore({ ...request, projectionFileText: recorded.fileText });
|
|
13904
13923
|
return {
|
|
13905
13924
|
queries: proofQueriesOf(request),
|
|
13906
13925
|
effects: proofEffectsOf(request),
|
|
@@ -13922,13 +13941,10 @@ var proofRequestOf = (request) => {
|
|
|
13922
13941
|
trackedPaths: prepared.trackedPaths,
|
|
13923
13942
|
projectionFilesOf: projectionFilesFor(request),
|
|
13924
13943
|
settingsFormat: ports.settingsFormat,
|
|
13925
|
-
versionOneProjectionsOf:
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
path: command.path,
|
|
13930
|
-
repoRoot: located.repoRoot,
|
|
13931
|
-
trackedPaths: prepared.trackedPaths
|
|
13944
|
+
versionOneProjectionsOf: createVersionOneProjections({
|
|
13945
|
+
...request,
|
|
13946
|
+
before,
|
|
13947
|
+
writes: recorded.writes
|
|
13932
13948
|
})
|
|
13933
13949
|
};
|
|
13934
13950
|
};
|
|
@@ -707,6 +707,9 @@ var createEngineBindingsRepository = (options) => ({
|
|
|
707
707
|
// src/infrastructure/disciplines-file/version-one-names.ts
|
|
708
708
|
import { z as z2 } from "zod";
|
|
709
709
|
|
|
710
|
+
// src/domain/rule-set/version-one-names-location.ts
|
|
711
|
+
var RULE_SET_NAMES_SEGMENTS = ["rules", "version-one-names.json"];
|
|
712
|
+
|
|
710
713
|
// src/infrastructure/content-files/symptom-catalogues/symptom-catalogue-wire.ts
|
|
711
714
|
import { z } from "zod";
|
|
712
715
|
|
|
@@ -1532,6 +1535,7 @@ var VERSION_ONE_NAMES_SEGMENTS = [
|
|
|
1532
1535
|
"disciplines-file",
|
|
1533
1536
|
"version-one-names.json"
|
|
1534
1537
|
];
|
|
1538
|
+
var locateVersionOneNames = (request) => request.ruleSetRoot === request.installRoot ? VERSION_ONE_NAMES_SEGMENTS : RULE_SET_NAMES_SEGMENTS;
|
|
1535
1539
|
var formatOfTodaySchema = recordKindWireSchema.shape.todaysFormat.exclude(["none-yet"]);
|
|
1536
1540
|
var checkAddressSchema = z2.string().regex(new RegExp(`^${CATALOGUE_NAME}#${CATALOGUE_NAME}$`), {
|
|
1537
1541
|
error: "is not a check address of the form <symptom>#<check>"
|
|
@@ -1607,7 +1611,10 @@ var versionOneNamesOf = (request) => {
|
|
|
1607
1611
|
const parsed = versionOneNamesSchema.safeParse(request.document);
|
|
1608
1612
|
return parsed.success ? { outcome: "ok", value: namesOf(parsed.data) } : { outcome: "failed", error: z2.prettifyError(parsed.error) };
|
|
1609
1613
|
};
|
|
1610
|
-
var
|
|
1614
|
+
var listOtherClauses = (request) => request.names.namedClauses.map(({ clause }) => clause).filter(
|
|
1615
|
+
(clause) => sameClauseAddress({ left: clause, right: { ...clause, ruleSet: request.ruleSet } }) === "different"
|
|
1616
|
+
);
|
|
1617
|
+
var readNamesText = (request) => {
|
|
1611
1618
|
const document = readVersionOneJson(request);
|
|
1612
1619
|
if (document.outcome === "failed") {
|
|
1613
1620
|
return document;
|
|
@@ -1618,6 +1625,23 @@ var readVersionOneNames = (request) => {
|
|
|
1618
1625
|
error: { kind: "file-malformed", path: request.path, detail: names.error }
|
|
1619
1626
|
} : names;
|
|
1620
1627
|
};
|
|
1628
|
+
var readVersionOneNames = (request) => {
|
|
1629
|
+
const names = readNamesText(request);
|
|
1630
|
+
if (names.outcome === "failed") {
|
|
1631
|
+
return names;
|
|
1632
|
+
}
|
|
1633
|
+
const others = listOtherClauses({ names: names.value, ruleSet: request.ruleSet });
|
|
1634
|
+
return others.length > 0 ? {
|
|
1635
|
+
outcome: "failed",
|
|
1636
|
+
error: {
|
|
1637
|
+
kind: "file-malformed",
|
|
1638
|
+
path: request.path,
|
|
1639
|
+
detail: others.map(
|
|
1640
|
+
(clause) => `\u2716 ${clauseAddressText({ address: clause })} is not a clause of this rule set`
|
|
1641
|
+
).join("\n")
|
|
1642
|
+
}
|
|
1643
|
+
} : names;
|
|
1644
|
+
};
|
|
1621
1645
|
|
|
1622
1646
|
// src/infrastructure/content-files/item-folders/item-document.ts
|
|
1623
1647
|
var ofKind = (kind) => (placed2) => placed2.item.kind === kind;
|
|
@@ -2023,7 +2047,11 @@ var createItemFolderCatalogueRepository = (options) => ({
|
|
|
2023
2047
|
|
|
2024
2048
|
// src/infrastructure/content-files/rule-sets/installed-pieces.ts
|
|
2025
2049
|
var installedNamesPathOf = (request) => request.path.join({ segments: [request.installRoot, ...VERSION_ONE_NAMES_SEGMENTS] });
|
|
2026
|
-
var readInstalledNames = (request) => readVersionOneNames({
|
|
2050
|
+
var readInstalledNames = (request) => readVersionOneNames({
|
|
2051
|
+
fileText: request.fileText,
|
|
2052
|
+
path: installedNamesPathOf(request),
|
|
2053
|
+
ruleSet: TOOL_RULE_SET
|
|
2054
|
+
});
|
|
2027
2055
|
var installedPieceOf = (request) => {
|
|
2028
2056
|
const location = { ...request, ruleSetRoot: request.installRoot };
|
|
2029
2057
|
const piece = readNamedPiece(location);
|
|
@@ -2105,12 +2133,12 @@ var catalogueClausesOf = (request) => {
|
|
|
2105
2133
|
};
|
|
2106
2134
|
|
|
2107
2135
|
// src/infrastructure/content-files/symptom-catalogues/read-symptom-catalogue.ts
|
|
2108
|
-
var
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
})
|
|
2113
|
-
}
|
|
2136
|
+
var readNames = (request) => {
|
|
2137
|
+
const path = request.path.join({
|
|
2138
|
+
segments: [request.ruleSetRoot, ...locateVersionOneNames(request)]
|
|
2139
|
+
});
|
|
2140
|
+
return request.fileText.exists({ path }) === "present" ? readVersionOneNames({ fileText: request.fileText, path, ruleSet: request.ruleSet }) : { outcome: "ok", value: NO_VERSION_ONE_NAMES };
|
|
2141
|
+
};
|
|
2114
2142
|
var VERSION_ONE_RULE_FILE = "discipline.json";
|
|
2115
2143
|
var versionOneRuleFilesOf = (request) => {
|
|
2116
2144
|
const entries = request.directory.list({ path: request.itemRoot });
|
|
@@ -2151,7 +2179,10 @@ var readSymptomCatalogue = (request) => {
|
|
|
2151
2179
|
error: { kind: "file-unreadable", path: itemRoot, detail: "is not an absolute path" }
|
|
2152
2180
|
};
|
|
2153
2181
|
}
|
|
2154
|
-
|
|
2182
|
+
if (request.fileText.exists({ path: root.data }) === "absent") {
|
|
2183
|
+
return { outcome: "ok", value: { held: "none" } };
|
|
2184
|
+
}
|
|
2185
|
+
const names = readNames(request);
|
|
2155
2186
|
if (names.outcome === "failed") {
|
|
2156
2187
|
return names;
|
|
2157
2188
|
}
|
|
@@ -2163,9 +2194,6 @@ var readSymptomCatalogue = (request) => {
|
|
|
2163
2194
|
if (clauses.outcome === "failed") {
|
|
2164
2195
|
return clauses;
|
|
2165
2196
|
}
|
|
2166
|
-
if (request.fileText.exists({ path: root.data }) === "absent") {
|
|
2167
|
-
return { outcome: "ok", value: { held: "none" } };
|
|
2168
|
-
}
|
|
2169
2197
|
const beside = {
|
|
2170
2198
|
engines: ENGINE_REGISTRY,
|
|
2171
2199
|
clauses: clauses.value,
|
|
@@ -2325,6 +2353,7 @@ export {
|
|
|
2325
2353
|
runLoadFailureLine,
|
|
2326
2354
|
SYMPTOM_CATALOGUE_SEGMENTS,
|
|
2327
2355
|
ENGINE_REGISTRY,
|
|
2356
|
+
RULE_SET_NAMES_SEGMENTS,
|
|
2328
2357
|
findCaseNameFaults,
|
|
2329
2358
|
mapSymptomToAddress,
|
|
2330
2359
|
mapCheckToAddress,
|
|
@@ -2335,8 +2364,6 @@ export {
|
|
|
2335
2364
|
catalogueFileSchema,
|
|
2336
2365
|
mapWireToOwedPoint,
|
|
2337
2366
|
VERSION_ONE_NAMES_SEGMENTS,
|
|
2338
|
-
NO_VERSION_ONE_NAMES,
|
|
2339
|
-
versionOneNamesOf,
|
|
2340
2367
|
readVersionOneNames,
|
|
2341
2368
|
itemTextFrom,
|
|
2342
2369
|
installedNamesPathOf,
|
|
@@ -354,12 +354,7 @@ var inspectionResult = z5.discriminatedUnion(
|
|
|
354
354
|
"outcome",
|
|
355
355
|
runnerResultSchema({
|
|
356
356
|
value: z5.object({
|
|
357
|
-
files: z5.array(
|
|
358
|
-
z5.object({
|
|
359
|
-
file: repoPathSchema,
|
|
360
|
-
state: z5.enum(["current", "missing", "out-of-date"])
|
|
361
|
-
})
|
|
362
|
-
).readonly(),
|
|
357
|
+
files: z5.array(repoPathSchema).readonly(),
|
|
363
358
|
ruleIds: z5.map(z5.string(), z5.string())
|
|
364
359
|
})
|
|
365
360
|
}).options
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import type { Result } from "../../domain/result.js";
|
|
|
4
4
|
import type { ToolRuleSet } from "../../domain/rule-set/clause-address-types.js";
|
|
5
5
|
import type { Edition } from "../../domain/rule-set/edition-types.js";
|
|
6
6
|
import type { EngineId } from "../../domain/rule-set/identifier-types.js";
|
|
7
|
+
import type { CheckBinding } from "../../domain/runner/check-binding.js";
|
|
7
8
|
import type { CheckConformanceFailure } from "../../domain/runner/conformance-types.js";
|
|
8
9
|
export type { CheckConformanceFailure } from "../../domain/runner/conformance-types.js";
|
|
9
10
|
export type TeamRuleSetUnderTest = {
|
|
@@ -28,6 +29,7 @@ export type CaseUnderTest = {
|
|
|
28
29
|
readonly edition: Edition;
|
|
29
30
|
};
|
|
30
31
|
export type CheckUnderTest = CheckRequest & {
|
|
32
|
+
readonly binding: CheckBinding;
|
|
31
33
|
readonly examples: readonly CaseUnderTest[];
|
|
32
34
|
};
|
|
33
35
|
export type CheckConformanceOf = (request: CheckRequest) => Promise<Result<readonly CheckConformanceFailure[], ConformanceSetupFailure>>;
|
package/src/eslint-plugin.js
CHANGED
package/src/hone.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createDefaultProcessPort,
|
|
4
4
|
runToolCommand
|
|
5
|
-
} from "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-2U5EKYGS.js";
|
|
6
|
+
import "../chunks/chunk-4PHKVNM3.js";
|
|
7
|
+
import "../chunks/chunk-P2VHWLK4.js";
|
|
8
8
|
import "../chunks/chunk-XNIXPQQ5.js";
|
|
9
9
|
import "../chunks/chunk-M4VSJ27S.js";
|
|
10
10
|
import "../chunks/chunk-U6W65ZOF.js";
|
|
@@ -2922,28 +2922,6 @@ var slicedProjectionWrites = (request) => {
|
|
|
2922
2922
|
const plan = slicePlanOf(request);
|
|
2923
2923
|
return plan.outcome === "failed" ? plan : appliedPlan({ ...request, plan: plan.value });
|
|
2924
2924
|
};
|
|
2925
|
-
var slicedProjectionCurrency = (request) => {
|
|
2926
|
-
const states = request.projectionFiles.currentOf({
|
|
2927
|
-
files: request.roots.map((root) => slicePathOf({ root }))
|
|
2928
|
-
});
|
|
2929
|
-
if (states.outcome === "failed") return states;
|
|
2930
|
-
return gatheredOutcomes({
|
|
2931
|
-
outcomes: request.roots.map((root) => {
|
|
2932
|
-
const expected = rootPlan({ ...request, root });
|
|
2933
|
-
if (expected.outcome === "failed") return expected;
|
|
2934
|
-
const current = projectionStateAt({ states: states.value, file: expected.value.file });
|
|
2935
|
-
return current.outcome === "failed" ? current : {
|
|
2936
|
-
outcome: "ok",
|
|
2937
|
-
value: [
|
|
2938
|
-
{
|
|
2939
|
-
file: expected.value.file,
|
|
2940
|
-
state: projectionState({ current: current.value, generated: expected.value.text })
|
|
2941
|
-
}
|
|
2942
|
-
]
|
|
2943
|
-
};
|
|
2944
|
-
})
|
|
2945
|
-
});
|
|
2946
|
-
};
|
|
2947
2925
|
|
|
2948
2926
|
// src/infrastructure/engines/eslint/runner/embedded-runner/eslint-repository.ts
|
|
2949
2927
|
var VERSION_ONE_SETTINGS_FILE = "disciplines.json";
|
|
@@ -3092,12 +3070,10 @@ var versionOneProjectionOver = (platform) => {
|
|
|
3092
3070
|
inspect: async (request) => {
|
|
3093
3071
|
const plan = projectionPlanOf({ request, ports });
|
|
3094
3072
|
if (plan.outcome === "failed") return plan;
|
|
3095
|
-
const files = slicedProjectionCurrency(plan.value);
|
|
3096
|
-
if (files.outcome === "failed") return files;
|
|
3097
3073
|
return {
|
|
3098
3074
|
outcome: "ok",
|
|
3099
3075
|
value: {
|
|
3100
|
-
files:
|
|
3076
|
+
files: plan.value.roots.map((root) => slicePathOf({ root })),
|
|
3101
3077
|
ruleIds: new Map(
|
|
3102
3078
|
plan.value.clauses.map(({ address, ruleId }) => [
|
|
3103
3079
|
clauseAddressText({ address }),
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
measureEngines,
|
|
6
6
|
runEnginesMeasurement,
|
|
7
7
|
versionTwoStagesOver
|
|
8
|
-
} from "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
10
|
-
import "../chunks/chunk-
|
|
8
|
+
} from "../chunks/chunk-2U5EKYGS.js";
|
|
9
|
+
import "../chunks/chunk-4PHKVNM3.js";
|
|
10
|
+
import "../chunks/chunk-P2VHWLK4.js";
|
|
11
11
|
import "../chunks/chunk-XNIXPQQ5.js";
|
|
12
12
|
import "../chunks/chunk-M4VSJ27S.js";
|
|
13
13
|
import "../chunks/chunk-U6W65ZOF.js";
|
package/src/testing.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CheckConformanceOf, CheckUnderTestOf, RepoPathOf } from "./application/conformance/conformance-testing-types.js";
|
|
2
|
+
export type { CheckBinding } from "./domain/runner/check-binding.js";
|
|
2
3
|
export type { CaseUnderTest, CheckRequest, CheckConformanceFailure, CheckUnderTest, ConformanceSetupFailure, ConformanceSetupFailureKind, RuleSetUnderTest, TeamRuleSetUnderTest, } from "./application/conformance/conformance-testing-types.js";
|
|
3
4
|
export declare const repoPathOf: RepoPathOf;
|
|
4
5
|
export declare const checkUnderTestOf: CheckUnderTestOf;
|
package/src/testing.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
runnerEnginesOver,
|
|
5
5
|
runnerInvalidOutput,
|
|
6
6
|
runnerModuleAt
|
|
7
|
-
} from "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-P2VHWLK4.js";
|
|
8
8
|
import {
|
|
9
9
|
installRootOfApiEntry,
|
|
10
10
|
loadFailureDetail
|
|
@@ -50,6 +50,30 @@ var casesByEdition = (request) => {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
// src/application/conformance/create-case-under-test.ts
|
|
54
|
+
var createCaseUnderTest = (request) => ({
|
|
55
|
+
name: request.example.name,
|
|
56
|
+
file: request.example.fileName,
|
|
57
|
+
source: request.example.source,
|
|
58
|
+
edition: request.example.edition ?? request.defaultEdition
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// src/application/conformance/create-check-binding.ts
|
|
62
|
+
var createCheckBinding = (request) => {
|
|
63
|
+
const { check, ruleSet, engine, piece } = request;
|
|
64
|
+
return {
|
|
65
|
+
address: check,
|
|
66
|
+
ruleSet,
|
|
67
|
+
engine,
|
|
68
|
+
anchor: piece.anchor,
|
|
69
|
+
pieceRoot: piece.pieceRoot,
|
|
70
|
+
settings: piece.settings,
|
|
71
|
+
forms: piece.forms,
|
|
72
|
+
checkSettings: defaultClauseSettings({ declarations: piece.declarations }),
|
|
73
|
+
edition: piece.editions.default
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
53
77
|
// src/application/conformance/check-conformance.ts
|
|
54
78
|
var ruleSetInvalid = (request) => ({
|
|
55
79
|
outcome: "failed",
|
|
@@ -104,18 +128,17 @@ var checkUnderTestOf = (request) => {
|
|
|
104
128
|
}
|
|
105
129
|
const { ruleSet, check, engine } = request;
|
|
106
130
|
const { piece, examples: examples2 } = read.value;
|
|
131
|
+
const binding = createCheckBinding({ check, ruleSet: read.value.ruleSet, engine, piece });
|
|
107
132
|
return {
|
|
108
133
|
outcome: "ok",
|
|
109
134
|
value: {
|
|
110
135
|
ruleSet,
|
|
111
136
|
check,
|
|
112
137
|
engine,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
edition: example.edition ?? piece.editions.default
|
|
118
|
-
}))
|
|
138
|
+
binding,
|
|
139
|
+
examples: examples2.map(
|
|
140
|
+
(example) => createCaseUnderTest({ example, defaultEdition: binding.edition })
|
|
141
|
+
)
|
|
119
142
|
}
|
|
120
143
|
};
|
|
121
144
|
};
|
|
@@ -134,17 +157,7 @@ var checkConformanceOf = async (request) => {
|
|
|
134
157
|
};
|
|
135
158
|
}
|
|
136
159
|
const { piece, examples: examples2, ruleSet } = read.value;
|
|
137
|
-
const binding = {
|
|
138
|
-
address: request.check,
|
|
139
|
-
ruleSet,
|
|
140
|
-
engine: mechanism,
|
|
141
|
-
anchor: piece.anchor,
|
|
142
|
-
pieceRoot: piece.pieceRoot,
|
|
143
|
-
settings: piece.settings,
|
|
144
|
-
forms: piece.forms,
|
|
145
|
-
checkSettings: defaultClauseSettings({ declarations: piece.declarations }),
|
|
146
|
-
edition: piece.editions.default
|
|
147
|
-
};
|
|
160
|
+
const binding = createCheckBinding({ check: request.check, ruleSet, engine: mechanism, piece });
|
|
148
161
|
const conformed = gatheredOutcomes({
|
|
149
162
|
outcomes: await Promise.all(
|
|
150
163
|
casesByEdition({ cases: examples2, defaultEdition: binding.edition }).map(
|