@hailstails/hone 0.1.0-pre.7 → 0.1.0-pre.8
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 +25 -9
- package/CHANGELOG.md +130 -0
- package/MIGRATING.md +55 -16
- package/README.md +8 -7
- package/api/testing.js +1 -1
- package/chunks/{chunk-3LCKBX5T.js → chunk-XXLMIBLS.js} +43 -5
- package/core/check/tool-command.js +38 -17
- package/docs/extending.md +2 -0
- package/docs/output-contract.md +4 -4
- package/mechanisms/audit/CD-19/import-boundaries.js +1 -1
- package/mechanisms/audit/runner/README.md +2 -2
- package/package.json +2 -1
- package/rules/CD-10/CHECKS.md +2 -2
- package/rules/CD-14/CHECKS.md +2 -2
- package/rules/CD-15/CHECKS.md +2 -2
- package/rules/CD-17/CHECKS.md +2 -2
- package/rules/CD-19/CHECKS.md +2 -2
- package/rules/CD-2/CHECKS.md +2 -2
- package/rules/CD-23/CHECKS.md +2 -2
- package/rules/CD-25/CHECKS.md +2 -2
- package/rules/CD-26/CHECKS.md +2 -2
- package/rules/CD-27/CHECKS.md +2 -2
- package/rules/CD-3/CHECKS.md +2 -2
- package/rules/CD-40/CHECKS.md +2 -2
- package/rules/CD-41/CHECKS.md +2 -2
- package/rules/CD-42/CHECKS.md +2 -2
- package/rules/CD-43/CHECKS.md +2 -2
- package/rules/CD-44/CHECKS.md +2 -2
- package/rules/CD-47/CHECKS.md +2 -2
- package/rules/CD-5/CHECKS.md +2 -2
- package/rules/CD-6/CHECKS.md +2 -2
- package/rules/CD-7/CHECKS.md +2 -2
- package/rules/CD-7a/CHECKS.md +2 -2
- package/rules/CD-8/CHECKS.md +2 -2
package/ADOPTING.md
CHANGED
|
@@ -20,19 +20,19 @@ Hone ships as one npm package tarball: built JavaScript with its own packages bu
|
|
|
20
20
|
|
|
21
21
|
Releases are pre-releases until a stable release is published: until then, commands, flags and files may still change between releases.
|
|
22
22
|
|
|
23
|
-
The main route is the npm registry. Pre-releases are published under the dist-tag `next`,
|
|
23
|
+
The main route is the npm registry. Pre-releases are published under the dist-tag `next`, which names the newest pre-release approved on npm; `npm view @hailstails/hone dist-tags.next` prints its version. Install that version exactly, with `<version>` in place:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install --save-dev @hailstails/hone
|
|
26
|
+
npm install --save-dev --save-exact @hailstails/hone@<version>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
With pnpm, add it as a development dependency, using `-Dw` in place of `-D` at the root of a pnpm workspace:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
pnpm add -D @hailstails/hone
|
|
32
|
+
pnpm add -D --save-exact @hailstails/hone@<version>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Pin the exact version. Commands, flags and files may change between pre-releases, and an install by tag can record a range in `package.json`, such as `^` and the version, which a later install without the lockfile, or an update, moves to a newer pre-release that nobody chose. With an exact pin, the version changes only when you change it (step 10). Check the name before you run it: `@hailstails/hone`, never the unscoped `hone`. With Yarn, add `@hailstails/hone@<version>` exactly with its own `add -D` command at the workspace root. `next` can trail the newest GitHub release for a while; [README.md](README.md#developing-hone) says how a version reaches npm.
|
|
36
36
|
|
|
37
37
|
The alternative is a tarball, copied into the repository so every teammate and CI runner installs the same bytes without the registry. This page writes its location as `<hone-tarball>`: a path such as `vendor/hailstails-hone/hailstails-hone-<version>.tgz`, or an `https://` URL your team serves it from. Download the tarball attached to the latest [GitHub release](https://github.com/HailsTails/hone/releases), or build it from a pinned commit as below.
|
|
38
38
|
|
|
@@ -69,6 +69,8 @@ Add the two commands to the root `package.json` scripts:
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
Options for one run go after the script name. npm needs `--` before them, as in `npm run --silent hone:check -- --base-revision origin/main`. pnpm takes them straight after the script name, as in `pnpm run --silent hone:check --base-revision origin/main`. This guide shows both wherever a command takes options.
|
|
73
|
+
|
|
72
74
|
`hone` is the package's one command, with two subcommands: `hone check` runs the check and `hone project` writes the ESLint projection. `hone` with no subcommand, or with any other, exits `2` with one `load failure: arguments-invalid` line that names the commands and points at `hone --help`, which prints the usage.
|
|
73
75
|
|
|
74
76
|
Hone runs on the toolchain the repository already uses, which the package declares as peer dependencies: `typescript` is a required peer, because every `audit` clause needs it, and the ESLint packages are optional peers, needed only for `eslint` clauses. npm 7 and later install a missing required peer on their own, and some other package managers only warn about one, so declare `typescript` yourself at the repository root, at the version the repository already uses, rather than let the package manager choose or skip it. Keep the versions you have; Hone supports these ranges:
|
|
@@ -84,7 +86,7 @@ A repository that already has them in range needs nothing more. A package that i
|
|
|
84
86
|
|
|
85
87
|
Hone finds these by Node's resolution upward from where the package is installed, so in a monorepo they must resolve from the repository root: declare them in the root `package.json` (with pnpm, `pnpm add -Dw` at the versions the packages already use), even where packages also declare their own. Yarn Plug'n'Play is not supported, because Hone resolves the toolchain through `node_modules`.
|
|
86
88
|
|
|
87
|
-
Commit `package.json`, the lockfile and the tarball if it is a file in the repository.
|
|
89
|
+
Commit `package.json`, the lockfile and the tarball if it is a file in the repository. Step 10 says how to update.
|
|
88
90
|
|
|
89
91
|
## 3. Read what each discipline means
|
|
90
92
|
|
|
@@ -122,7 +124,7 @@ Create `<repo>/disciplines.json`. Map every clause you adopt to the mechanism th
|
|
|
122
124
|
- Not adopted: the rule does not apply to this codebase; a tech lead declares that, in the open. Set the clause to `"not-adopted"`.
|
|
123
125
|
- Adopted, mechanism not run: the rule binds, but its check is not a true measure of the rule's intent here, or cannot work here for a technical reason. The check is set aside; the intent is still owed, through review. Set the clause to `"not-run"`. CD-6's ESLint-only `naming-convention` in a repository without ESLint is the usual case: `"CD-6#identifier-names": "audit", "CD-6#naming-convention": "not-run"`.
|
|
124
126
|
- Clause-wide carve-out: the rule binds and its check is sound, but the codebase has debt it cannot address right now. Keep the clause's mechanism, so the clause still runs, and record the debt against it as a `clause-wide-carve-out` with its why-chain and an owner who will pay it down (step 7).
|
|
125
|
-
- `exclude` lists folders or exact files, as repository paths with forward slashes; an entry containing `*` is refused, because globs are not supported. A folder entry excludes everything under it. Use it for generated or third-party code. `node_modules`, `dist`, `build`, `coverage`, `.git` and a top-level `vendor` folder are skipped already.
|
|
127
|
+
- `exclude` lists folders or exact files that no mechanism checks, as repository paths with forward slashes; an entry containing `*` is refused, because globs are not supported. A folder entry excludes everything under it. It is the only way to narrow what Hone checks: there is no include list, and every tracked file outside `exclude` is checked, including any folder added later. Use it for generated or third-party code, and, to check only part of a repository, list every other folder. `node_modules`, `dist`, `build`, `coverage`, `.git` and a top-level `vendor` folder are skipped already.
|
|
126
128
|
- `clauseSettings` gives a clause the settings its CHECKS.md lists under Settings, keyed by clause address. CD-19, for example, flags only imports of the packages you list in its `confinedPackages`; CD-5's `trackerPatterns` narrows tracked references to your tracker's format. See [README.md](README.md#disciplinesjson).
|
|
127
129
|
- `ruleSets` stays `{}` unless you write disciplines of your own; see [docs/extending.md](docs/extending.md).
|
|
128
130
|
|
|
@@ -234,6 +236,14 @@ A first adoption assesses decay at push only, so that a hotfix in a carved file
|
|
|
234
236
|
npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main
|
|
235
237
|
```
|
|
236
238
|
|
|
239
|
+
With pnpm:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
A run that leaves decay to another run ends `verdict: pass (partial assessment)` or `verdict: fail (partial assessment)`, not `verdict: pass` or `verdict: fail`. A hook or gate that matches `verdict: pass` or `verdict: fail` at the end of the line reads neither, and may report the run as unverified. Act on the exit code, or match all four verdict lines that [docs/output-contract.md](docs/output-contract.md#the-report) lists.
|
|
246
|
+
|
|
237
247
|
CI leaves decay to the hook. A repository with no imported records and no legacy-chain records runs the check with no base revision:
|
|
238
248
|
|
|
239
249
|
```bash
|
|
@@ -246,7 +256,13 @@ A repository with imported records (`provenance`) or legacy-chain records still
|
|
|
246
256
|
npm run --silent hone:check -- --base-revision <base-commit>
|
|
247
257
|
```
|
|
248
258
|
|
|
249
|
-
|
|
259
|
+
With pnpm:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
pnpm run --silent hone:check --base-revision <base-commit>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
A team that assesses decay in CI leaves `assessment` unset and runs `npm run --silent hone:check -- --base-revision origin/main` there, or `pnpm run --silent hone:check --base-revision origin/main`; the check then needs that revision and the history back to where the branch left it, for example `fetch-depth: 0` with `actions/checkout`.
|
|
250
266
|
|
|
251
267
|
The trade: a push that bypasses the hook, for example with `git push --no-verify`, leaves no later gate, so carve-out debt can stop decaying unnoticed. Every run that leaves decay to another run says so in its report (step 6). With `eslint` clauses, the repository's own `eslint` run also reports them in the editor, from the projection.
|
|
252
268
|
|
|
@@ -319,7 +335,7 @@ CD-15#loops audit src/basket.ts:15:0 for (const line of this.lines) {
|
|
|
319
335
|
| `exempted` | findings an exception covers; informational |
|
|
320
336
|
| `unrecorded` | a native exception no record holds, as `<clause> <mechanism> <kind> <detail>`: remove it, or record it where step 7 allows. An inline disable, `<clause> eslint inline-disable <file>:<line> <comment>`, and a TypeScript directive, `CD-2#cast-expressions audit inline-disable <file>:<line> <comment>`, are held only by an `authorised-location` or `file-carve-out` on that clause and file. An `eslint-disable` naming no rule escapes every selected clause, needs a record for each, and its lines end ` names no rule and escapes every selected clause: naming the rule is the cheap fix`. A lint-script option, `<clause> eslint command-line-option <package.json> <script> <option> weakens the script's whole run, so no record can cover it: remove it from the script`, cannot be recorded. Where another command comes before `eslint` in its script, as in `tsc && eslint -c eslint.config.mjs .`, the line instead reads `<clause> eslint command-line-option <package.json> <script> <option>: <command> is not the first command of its script, so Hone cannot tell what the option does to the files under check; give <command> a script of its own, such as "<invocation>"`: move that command to a script of its own. Where something before `eslint` in its own command is neither a package runner nor a `NAME=value` setting, as `env` in `env --chdir=src eslint --ignore-pattern dist .` or `-y` in `npx -y eslint --ignore-pattern dist .`, it reads `<clause> eslint command-line-option <package.json> <script> <option>: "<wrapper>" comes before <command> and is neither a package runner nor a NAME=value setting, so Hone cannot tell what the option does to the files under check; put only package runners and NAME=value settings before <command>`. `cross-env` followed only by `NAME=value` settings counts as a setting |
|
|
321
337
|
| `uncovered` | a mechanical clause of an adopted discipline is not listed: add it to `disciplines.json` with a mechanism, `"not-run"` or `"not-adopted"` |
|
|
322
|
-
| `stale` | an exception that no longer exempts anything: delete it |
|
|
338
|
+
| `stale` | an exception that no longer exempts anything: delete it. Right after a move from an older route, first check that its settings were carried over ([MIGRATING.md](MIGRATING.md#2a-carry-over-the-old-routes-settings) step 2a) |
|
|
323
339
|
| `forfeited` | a file carve-out whose file changed since `--base-revision`: fix the file and delete the carve-out |
|
|
324
340
|
| `invalidRecords` | an exception entry that cannot be accepted, with the reason, for example `clause-not-run` or `clause-not-adopted` for an entry on a clause listed as `"not-run"` or `"not-adopted"`: correct or delete it |
|
|
325
341
|
| `doublyHeld` | a file both authorised and carved out for one clause: keep one |
|
|
@@ -395,7 +411,7 @@ To use an agent, give it the lens file, the rule pages it names, the change and
|
|
|
395
411
|
|
|
396
412
|
## 10. Update and remove
|
|
397
413
|
|
|
398
|
-
To update,
|
|
414
|
+
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 clause is `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. Before updating to a pin that has the causal why-chain contract, follow [MIGRATING.md section 8](MIGRATING.md#8-moving-to-causal-why-chains): pass `--base-revision` first, or the update's check reports `legacy-chain-unmeasured`.
|
|
399
415
|
|
|
400
416
|
To remove, run `npm uninstall @hailstails/hone`, delete the two `hone:` scripts, any vendored tarball, `disciplines.json`, `discipline-exceptions.json`, `disciplines.assessment.md` and, with `eslint` clauses, `disciplines.eslint.mjs` and its spread in the flat config, and take the check out of the validation script.
|
|
401
417
|
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
## 0.1.0-pre.8
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- accept a leading --, print short package paths under pnpm and ship the changelog (#122)
|
|
10
|
+
|
|
11
|
+
### Other changes
|
|
12
|
+
|
|
13
|
+
- guide migrations through old-route settings, pnpm commands and exact pins (#121)
|
|
14
|
+
|
|
15
|
+
## 0.1.0-pre.7
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- export folderScope and an experimental testing entry so a team can test its audit pieces from the package (#117)
|
|
20
|
+
|
|
21
|
+
### Other changes
|
|
22
|
+
|
|
23
|
+
- release: release on merge of the release pull request instead of a hand-pushed tag (#116)
|
|
24
|
+
|
|
25
|
+
## 0.1.0-pre.6
|
|
26
|
+
|
|
27
|
+
### Breaking changes
|
|
28
|
+
|
|
29
|
+
- let a clause be adopted with its mechanism not run, and remove assessment.waivedClauses and --waived-clauses (#92)
|
|
30
|
+
- eslint: write a projection slice per config root, with core-validated eslintConfigRoots (#86)
|
|
31
|
+
- cli: add --help and --version, word argument errors for the person typing, and document every printed line in a tested output contract (#96)
|
|
32
|
+
- let file records hold inline disables and TypeScript directives, and judge lint-script options by effect (#97)
|
|
33
|
+
- eslint: add CD-2#non-null-assertions for non-null and definite assignment assertions (#109)
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
- point each failing clause at its assessment section and its rule's Spirit at the end of a red check (#93)
|
|
38
|
+
|
|
39
|
+
### Fixes
|
|
40
|
+
|
|
41
|
+
- reserve not-adopted from mechanism ids and make its refusals say what to do (#85)
|
|
42
|
+
- name every missing ESLint peer, the broken ESLint config and its fix, and cap report snippets (#83)
|
|
43
|
+
- eslint: treat files under a broken nested ESLint config that a governing config ignores as ignored, as the team's ESLint does (#91)
|
|
44
|
+
- say why a check could not measure and what to run next (#94)
|
|
45
|
+
|
|
46
|
+
### Other changes
|
|
47
|
+
|
|
48
|
+
- deps: bump zod from 4.4.3 to 4.6.6 in the npm_and_yarn group across 1 directory (#54)
|
|
49
|
+
- give every rule a spirit page and move check mechanics to CHECKS.md (#87)
|
|
50
|
+
- an assessment of what each high-count clause means, written at adoption (#90)
|
|
51
|
+
- state how config files and clause mechanisms change across versions (#108)
|
|
52
|
+
- install every install-proof consumer with pnpm (#105)
|
|
53
|
+
|
|
54
|
+
## 0.1.0-pre.5
|
|
55
|
+
|
|
56
|
+
### Breaking changes
|
|
57
|
+
|
|
58
|
+
- raise the ESLint 9 peer floor to 9.28.0, the first with every bulk-suppressions option (#63)
|
|
59
|
+
- make the public type entries safe to call stable (#62)
|
|
60
|
+
- let a repository list the packages CD-19 confines, confining none by default (#66)
|
|
61
|
+
- permit only const assertions, read any from the type, and require tracked references on type directives (#76)
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
- let a run leave carve-out forfeiture to another run with assessment.forfeiture and --forfeiture (#64)
|
|
66
|
+
- eslint: group the projection's file records by clause set; run hone project and commit the result (#74)
|
|
67
|
+
- let a run leave waived clauses unrun with assessment.waivedClauses and --waived-clauses (#73)
|
|
68
|
+
- let disciplines.json mark a clause not-adopted, so it is neither run nor projected (#81)
|
|
69
|
+
|
|
70
|
+
### Other changes
|
|
71
|
+
|
|
72
|
+
- add the ESLint runner's internal scope set, proven to leave the report unchanged (#68)
|
|
73
|
+
- add the team rule set guide and prove it from a packed install (#69)
|
|
74
|
+
|
|
75
|
+
## 0.1.0-pre.4
|
|
76
|
+
|
|
77
|
+
### Breaking changes
|
|
78
|
+
|
|
79
|
+
- raise the Node floor to 22.18, test macOS and Node 24, add a security policy (#42)
|
|
80
|
+
|
|
81
|
+
### Features
|
|
82
|
+
|
|
83
|
+
- require team ESLint plugin namespaces to follow their rule set (#40)
|
|
84
|
+
- accept the hone/ owner prefix for the tool's own rule set (#39)
|
|
85
|
+
- release: add a compatibility policy, a changelog and release tooling (#44)
|
|
86
|
+
- publish typed entries @hailstails/hone/rule-set and experimental @hailstails/hone/audit (#60)
|
|
87
|
+
|
|
88
|
+
### Fixes
|
|
89
|
+
|
|
90
|
+
- make the pnpm lock reader fail on inline snapshots and dependency sections (#56)
|
|
91
|
+
- let hone check finish on large repositories without changing its report (#58)
|
|
92
|
+
|
|
93
|
+
### Other changes
|
|
94
|
+
|
|
95
|
+
- Keep versions out of the docs and guard against them coming back (#20)
|
|
96
|
+
- declare the authoring types without zod so they can be published (#49)
|
|
97
|
+
- move Hone's own repository from bun to pnpm (#50)
|
|
98
|
+
- add package and repository hygiene files (#57)
|
|
99
|
+
|
|
100
|
+
## 0.1.0-pre.3
|
|
101
|
+
|
|
102
|
+
### Other changes
|
|
103
|
+
|
|
104
|
+
- Stage npm releases for owner approval instead of publishing them (#19)
|
|
105
|
+
|
|
106
|
+
## 0.1.0-pre.2
|
|
107
|
+
|
|
108
|
+
### Breaking changes
|
|
109
|
+
|
|
110
|
+
- Rename the npm package from `honed` to `@hailstails/hone`; MIGRATING.md section 11 has the steps (#13)
|
|
111
|
+
|
|
112
|
+
### Other changes
|
|
113
|
+
|
|
114
|
+
- Prepare the package for npm trusted publishing (#9)
|
|
115
|
+
- Run the npm publish job in the npm environment (#12)
|
|
116
|
+
- Make `typescript` a required peer (#17)
|
|
117
|
+
- Reword the seven CD-19 authorised-location records for this repository (#18)
|
|
118
|
+
|
|
119
|
+
## 0.1.0-pre.1
|
|
120
|
+
|
|
121
|
+
### Features
|
|
122
|
+
|
|
123
|
+
- The first pre-release: one `hone` command with `check` and `project` subcommands, released as a tarball for the npm package `honed` (#4)
|
|
124
|
+
- Run Hone's own disciplines on Hone in CI (#3)
|
|
125
|
+
|
|
126
|
+
### Other changes
|
|
127
|
+
|
|
128
|
+
- Point the install steps at this repository (#1)
|
|
129
|
+
- Carry Hone's CD-19 authorised locations from the earlier record (#2)
|
|
130
|
+
- Write the release text from the tool identity, prove the package before release, and give the reserved ESLint namespace its own field (#5)
|
package/MIGRATING.md
CHANGED
|
@@ -14,6 +14,7 @@ Look for each of these and write down what you find:
|
|
|
14
14
|
| Copied guides | the same folder | `standalone-adoption.md`, `standalone-cd-inventory.md`, `standalone-linter-options.md` |
|
|
15
15
|
| Copied tools tree | `.claude/tools/`, `.codex/tools/` or `.cursor/tools/` | `.cursor/tools/rin-harness-constitution-audit.ts` |
|
|
16
16
|
| Tool config | repository root | `harness.config.json` |
|
|
17
|
+
| Settings in the tool's own code | the copied tools tree, or rin's walker | a list of confined packages, or of files it skips (step 2a) |
|
|
17
18
|
| Debt records | repository root | `.constitution-carve-outs/cd-<id>.json` |
|
|
18
19
|
| Structural records | repository root | `.constitution-authorised-locations/cd-<id>.json` |
|
|
19
20
|
| Hand-written linter rules | `biome.json`, `eslint.config.*`, `.oxlintrc.json` | `noExplicitAny`, `@typescript-eslint/no-explicit-any`, `typescript/no-explicit-any` |
|
|
@@ -29,7 +30,7 @@ Old code often holds CD-1 `any` the old route never checked. Hone flags it in st
|
|
|
29
30
|
|
|
30
31
|
## 2. Install Hone and select the clauses
|
|
31
32
|
|
|
32
|
-
Do [ADOPTING.md](ADOPTING.md) steps 1, 2 and 4 (and 4a for any `eslint` clause). A repository that used only Biome has no `eslint.config
|
|
33
|
+
Do [ADOPTING.md](ADOPTING.md) steps 1, 2 and 4 (and 4a for any `eslint` clause). A repository that used only Biome has no `eslint.config.*`. If it selects any clause through `eslint`, create `eslint.config.mjs` as step 4a shows before the first check, or the check stops with `runner-failed eslint team-config-unloadable`. If it lists every ESLint clause as `"not-run"` or `"not-adopted"`, it needs no ESLint config and no ESLint installed. Leave the old files in place until step 6.
|
|
33
34
|
|
|
34
35
|
Map each chosen discipline to its clauses with this table. A discipline is adopted whole: select every mechanical clause it lists, or the check reports the rest as `uncovered`. Where the rule binds but a clause's mechanism cannot work in this repository, such as an ESLint-only clause with no ESLint installed, list that clause as `"not-run"`; where the rule does not apply at all, list it as `"not-adopted"`. [ADOPTING.md](ADOPTING.md#4-write-disciplinesjson) step 4 sets out the clause values and the three declared states.
|
|
35
36
|
|
|
@@ -46,9 +47,22 @@ Clauses whose mechanism is `review` are judgement clauses: do not put them in `d
|
|
|
46
47
|
|
|
47
48
|
Stop and ask the human if a chosen CD is one of CD-35 to CD-38, or if selecting a whole discipline adds clauses the old route never checked and the first run shows findings for them: they decide whether to fix those findings, carve them out (step 3), or not adopt that discipline yet.
|
|
48
49
|
|
|
50
|
+
### 2a. Carry over the old route's settings
|
|
51
|
+
|
|
52
|
+
Do this before step 3, and before you delete any record Hone lists as `stale`. The old tool kept settings in `harness.config.json` and in its own code, and Hone reads neither. A setting left behind stops a boundary being checked without any finding to show it: the old records for it exempt nothing, Hone lists them as `stale`, and deleting them drops the boundary.
|
|
53
|
+
|
|
54
|
+
| Old route | Where to look | In Hone |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Packages confined to wrapping files | a list in the tool's code or its config. Rin's walker holds it as `BANNED_THIRD_PARTY_IMPORTS`: search its tools folder for that name, since an installed copy keeps it in `constitution-audit/audit-constitution.runtime.js`, and its `audit-constitution.ts` only re-exports that file | `confinedPackages` for `CD-19#import-boundaries` under `clauseSettings` in `disciplines.json`. Hone confines no package by default, so until you list them CD-19 flags only `node:` imports. A package covers its subpaths, as [rules/CD-19/CHECKS.md](rules/CD-19/CHECKS.md#what-the-check-flags) says, where the old walker matched each listed name exactly, so Hone can flag a subpath import the old list did not name. |
|
|
57
|
+
| Scope | `constitution.include` and `constitution.exclude` in `harness.config.json` | `exclude` in `disciplines.json`, as [ADOPTING.md](ADOPTING.md#4-write-disciplinesjson) step 4 says. Hone has no include list and no globs: list each folder or file outside the old scope as an exact path. |
|
|
58
|
+
| Rules relaxed by folder | `scriptGlobs`, `uiGlobs` or similar in `harness.config.json` | nothing. Hone has one selection for the whole repository. What those folders fail under the full rules is existing debt: fix it or record it in step 3. Do not exclude the folders to hide it. |
|
|
59
|
+
| Files the tool skipped in its own code | a list such as `SELF_AUDIT_EXCLUDED_FILENAMES` | an `exclude` entry or an exception record for each file. Stop and ask the human which, and why. |
|
|
60
|
+
|
|
61
|
+
A `stale` record on `CD-19#import-boundaries` right after the move usually means the confined list was not carried over. Fix `confinedPackages` and run the check again before deleting anything.
|
|
62
|
+
|
|
49
63
|
## 3. Convert the old records into exceptions
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
Do step 2a first. Then run the check once with no exceptions file, to see what Hone finds:
|
|
52
66
|
|
|
53
67
|
```bash
|
|
54
68
|
npm run --silent hone:check
|
|
@@ -70,7 +84,7 @@ An old record file is a JSON array of entries, each listing one or more files:
|
|
|
70
84
|
|
|
71
85
|
- Each file in a `.constitution-carve-outs/cd-<id>.json` entry that Hone now flags becomes one `file-carve-out`: `clause` is the clause the finding names (for example `CD-15#loops`), `file` is the exact path. Two flagged files in one entry become two records with the same `source`.
|
|
72
86
|
- Each file in a `.constitution-authorised-locations/cd-<id>.json` entry that Hone now flags becomes one `authorised-location`.
|
|
73
|
-
- A listed file Hone does not flag gets no record: a record that exempts nothing is reported `stale` and fails the run.
|
|
87
|
+
- A listed file Hone does not flag gets no record: a record that exempts nothing is reported `stale` and fails the run. Before you drop one, check step 2a: a file Hone does not flag only because a setting was left behind still needs its record.
|
|
74
88
|
- A finding in a file no old record lists is new debt: fix it, or record it only after the human approves.
|
|
75
89
|
|
|
76
90
|
Each converted record is imported: give it `provenance` naming the old record instead of a `whyChain`, and keep the old `reason`:
|
|
@@ -91,7 +105,7 @@ Each converted record is imported: give it `provenance` naming the old record in
|
|
|
91
105
|
|
|
92
106
|
`source` is the old file and the entry's position in its array, counting from `0`, so both files in the example above use `.constitution-carve-outs/cd-15.json#0`. An authorised location uses `{ "kind": "existing-authorisation", "source": ".constitution-authorised-locations/cd-<id>.json#<index>" }`. Hone accepts an imported record only while the `--base-revision` holds it unchanged or its `source` entry lists the record's file at that revision, so keep the old record files committed until step 6, and run every check in this migration with `--base-revision HEAD`. A record you write for new debt, or an imported record you later change, needs a full `whyChain` that follows the [why-chain contract](docs/why-chain-contract.md): Hone refuses it as `import-unverified` otherwise. A repository whose `disciplines.json` sets `"fileExceptionWhyChains": "optional"` may instead give such an `authorised-location` or `file-carve-out` only its `reason`, with no `whyChain` and no `provenance`.
|
|
93
107
|
|
|
94
|
-
|
|
108
|
+
An imported `file-carve-out` needs a `decision`: copy the old entry's. If the old entry has none, stop and ask the human who accepted the debt. An imported `authorised-location` needs no `decision`: copy the old entry's if it has one, otherwise give `kind` and `source` only. Never write a placeholder or a root cause that only says the check was failing: Hone refuses those as `invalidRecords`.
|
|
95
109
|
|
|
96
110
|
## 4. Replace the hand-written linter rules
|
|
97
111
|
|
|
@@ -109,6 +123,13 @@ npm run --silent hone:project
|
|
|
109
123
|
npm run --silent hone:check -- --base-revision HEAD
|
|
110
124
|
```
|
|
111
125
|
|
|
126
|
+
With pnpm, options go straight after the script name:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm run --silent hone:project
|
|
130
|
+
pnpm run --silent hone:check --base-revision HEAD
|
|
131
|
+
```
|
|
132
|
+
|
|
112
133
|
Stop and ask the human if a rule you are about to remove was there before the trial, or if you cannot tell which rules the trial added (the adoption record or `git log -p -- biome.json` usually says).
|
|
113
134
|
|
|
114
135
|
## 5. Prove the migration
|
|
@@ -136,6 +157,8 @@ git add src/discipline-probe-loop.ts src/discipline-probe-any.ts
|
|
|
136
157
|
npm run --silent hone:check -- --base-revision HEAD
|
|
137
158
|
```
|
|
138
159
|
|
|
160
|
+
With pnpm, run the check as `pnpm run --silent hone:check --base-revision HEAD`.
|
|
161
|
+
|
|
139
162
|
It must print a `CD-15#loops audit` finding and a `CD-1#explicit-any eslint` finding, then `verdict: fail`, and exit `1`. Use a selected clause in place of either if the repository did not adopt CD-15 or CD-1. Then remove both files (`git rm -f src/discipline-probe-loop.ts src/discipline-probe-any.ts`) and run the check again: it must print `verdict: pass` and exit `0`.
|
|
140
163
|
|
|
141
164
|
To see debt decay, change one line in a carved file, stage it and run the check: the record moves to `forfeited` and the run fails. Restore the file afterwards (`git restore --staged --worktree <file>`).
|
|
@@ -147,9 +170,9 @@ Stop here, do not remove anything, and ask the human if the check does not pass.
|
|
|
147
170
|
Only after step 5 passes:
|
|
148
171
|
|
|
149
172
|
1. Delete the copied rule files and guides from step 1's harness folder (`.cursor/knowledge/aidlc-shared/code-discipline/` or its `.claude`/`.codex` equivalent).
|
|
150
|
-
2. Delete the copied tools tree and `harness.config.json`, unless anything else in the repository uses them. A repository that also runs the rin AIDLC plugin keeps `harness.config.json`, and in this same change sets `"constitution": { "engine": "
|
|
151
|
-
3. Delete `.constitution-carve-outs
|
|
152
|
-
4. In `package.json` scripts, CI and the pre-push hook, replace the old tool commands with the Hone check, as [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5 shows. Every run needs `--base-revision` while a file carve-out exists, unless it leaves forfeiture to another run as [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5 shows, and a run with imported records needs it in any case: in local scripts and the pre-push hook use the branch's base (`origin/main`, or `HEAD` to measure only uncommitted changes); in CI use the pull request's base commit.
|
|
173
|
+
2. Delete the copied tools tree and `harness.config.json`, unless anything else in the repository uses them. A repository that also runs the rin AIDLC plugin keeps `harness.config.json`, and in this same change sets `"constitution": { "engine": "hone", "baseRevision": "origin/main" }` in it. Otherwise rin's stage gate, sensors and review lenses keep running the old walker over the old records, and they refuse what this check passes. A rin plugin from before the rename refuses `"hone"` and takes `"discipline-core"`. Set `baseRevision` whenever a file carve-out or an imported entry exists.
|
|
174
|
+
3. Delete the old record files, `.constitution-carve-outs/cd-<id>.json` and `.constitution-authorised-locations/cd-<id>.json`: their content now lives in `discipline-exceptions.json`. Leave any other file in those folders, and the folder that holds it: another tool, such as a hook, may read it.
|
|
175
|
+
4. In `package.json` scripts, CI and the pre-push hook, replace the old tool commands with the Hone check, as [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5 shows. Every run needs `--base-revision` while a file carve-out exists, unless it leaves forfeiture to another run as [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5 shows, and a run with imported records needs it in any case: in local scripts and the pre-push hook use the branch's base (`origin/main`, or `HEAD` to measure only uncommitted changes); in CI use the pull request's base commit. A run that leaves forfeiture to another run ends `verdict: pass (partial assessment)` or `verdict: fail (partial assessment)`, so a hook or gate that matches `verdict: pass` or `verdict: fail` at the end of the line reads neither; see the warning in [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5.
|
|
153
176
|
5. Rewrite the agent instructions to point at `node_modules/@hailstails/hone/rules/` and the judgement rules, as ADOPTING step 5 and step 9 say, and remove any instruction to read the old copied files.
|
|
154
177
|
6. Run the check and the repository's own validation command again, then commit everything in one change.
|
|
155
178
|
|
|
@@ -176,21 +199,37 @@ Stop and ask the human if anything outside the old trial uses the copied tools o
|
|
|
176
199
|
|
|
177
200
|
An install from before the [why-chain contract](docs/why-chain-contract.md) holds chains with `whys`, `rootCause` and `owner` only. Hone still accepts such a chain while `--base-revision` holds its entry unchanged, but the first run without a base revision reports `legacy-chain-unmeasured` and fails. Do these steps in order:
|
|
178
201
|
|
|
179
|
-
1. **Give every check a base revision, before you refresh Hone.** Add `--base-revision` to the check command in `package.json` scripts, CI and the pre-push hook: `origin/main` locally, the pull request's base commit in CI. On a push to the main branch, the base is the commit before the push. Make sure CI fetches enough history to reach the base: `actions/checkout` defaults to one commit, so set `fetch-depth: 0` or fetch the base explicitly. A rin consumer
|
|
202
|
+
1. **Give every check a base revision, before you refresh Hone.** Add `--base-revision` to the check command in `package.json` scripts, CI and the pre-push hook: `origin/main` locally, the pull request's base commit in CI. On a push to the main branch, the base is the commit before the push. Make sure CI fetches enough history to reach the base: `actions/checkout` defaults to one commit, so set `fetch-depth: 0` or fetch the base explicitly. A rin consumer whose `constitution.engine` is `"hone"`, or `"discipline-core"` before the rename, sets `constitution.baseRevision` in `harness.config.json`. Rin's stage gate and `disciplines` sensor pass it on.
|
|
180
203
|
2. **Refresh Hone** as [ADOPTING.md](ADOPTING.md#10-update-and-remove) step 10 says, and run the check. Every chain that is unchanged since the base passes. If the run lists `legacy-chain-unmeasured`, step 1 is missing somewhere. Any `why-chain-refused` entry is a legacy chain that is new or edited since the base.
|
|
181
204
|
3. **Rewrite each chain when you next touch its entry.** An edited entry with a legacy chain is refused until the chain follows the contract. Write the chain from the symptom down: ask why the exception exists, then ask why that answer is true, four more times. Add the `rootCheck` you ran today and the `readback`.
|
|
182
205
|
4. **Queue a rewrite of the rest.** Nothing ends the grace period: a legacy chain whose entry is never touched stays accepted. To make every chain causal, rewrite the remaining ones as tracked work. Rewriting a chain is an edit, so each rewritten chain must pass the contract in that change.
|
|
183
206
|
|
|
184
207
|
## 9. Moving from a copied source tree to the package
|
|
185
208
|
|
|
186
|
-
Hone is no longer installed by copying its source into the repository: this version ships no install files for that route. A copy of the source in `tools/discipline-core/` moves to the package, which
|
|
209
|
+
Hone is no longer installed by copying its source into the repository: this version ships no install files for that route. A copy of the source in `tools/discipline-core/` moves to the package, which reads the same `disciplines.json` and `discipline-exceptions.json` and runs on the repository's own toolchain.
|
|
210
|
+
|
|
211
|
+
The copy is an older release, so the package checks more than it did. Read these first, and do what applies before the first run on the package:
|
|
212
|
+
|
|
213
|
+
- [Section 8](#8-moving-to-causal-why-chains), if any exception's `whyChain` has no `rootCheck` and no `readback`: give every check a base revision first.
|
|
214
|
+
- [Section 10](#10-moving-from-the-discipline-core-names-to-hone) step 4: rule ids written by hand, such as in an `eslint-disable` comment, change from `discipline/...` to `hone/...`.
|
|
215
|
+
- [Section 14](#14-moving-to-recorded-inline-exceptions): each `@ts-expect-error`, `@ts-ignore`, `@ts-nocheck` and `eslint-disable` is listed under `unrecorded` until it is removed or a file record holds it.
|
|
216
|
+
- [Section 15](#15-adopting-cd-2non-null-assertions), if any CD-2 clause is selected: CD-2 has a new clause to list.
|
|
217
|
+
- [Step 2a](#2a-carry-over-the-old-routes-settings), if the repository also ran rin's walker or another tool with settings of its own.
|
|
218
|
+
|
|
219
|
+
To move:
|
|
187
220
|
|
|
188
221
|
1. **Make sure the toolchain resolves from the repository root**, in the ranges [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 lists: TypeScript 4.8.4 up to 6.x, ESLint 9.28.0 or later on 9 or any 10, and typescript-eslint 8.56.0 or later on 8. Keep the versions the repository already uses.
|
|
189
222
|
2. **Install the package** as [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 says, including the two `hone:` scripts.
|
|
190
|
-
3. **Repoint every command.** In scripts, CI and the pre-push hook, replace `node tools/discipline-core/core/check/check-command.ts --repo .` with `npm run --silent hone:check`
|
|
191
|
-
4. **
|
|
192
|
-
|
|
193
|
-
|
|
223
|
+
3. **Repoint every command.** In scripts, CI and the pre-push hook, replace `node tools/discipline-core/core/check/check-command.ts --repo .` with `npm run --silent hone:check`, and `project-command.ts` with `npm run --silent hone:project`. Pass options after `--` with npm, as in `npm run --silent hone:check -- --base-revision origin/main`, and straight after the script name with pnpm, as in `pnpm run --silent hone:check --base-revision origin/main`. A hook or gate that reads the verdict line needs the warning in [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5. Point agent instructions at `node_modules/@hailstails/hone/rules/`.
|
|
224
|
+
4. **Repoint your own pieces and tests.** Nothing outside the package's public entries can be imported now:
|
|
225
|
+
- A piece that imported types or `folderScope` from the copy, such as from `walker-piece.ts` or `source-scope.ts`, imports them from `@hailstails/hone/audit`.
|
|
226
|
+
- A piece that read JSON with comments through the copy's `jsonc-parse.ts` calls TypeScript's own parser on the syntax API that `prepare` hands it: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config`, and sets `error` when it cannot parse the text. Do not import `jsonc-parser`: it is bundled inside Hone, not a package a piece can import, and a piece imports only what [docs/extending.md](docs/extending.md#what-is-stable) lists.
|
|
227
|
+
- For a file it cannot parse, a piece returns `{ outcome: "failed", error: { kind: "file-unparseable", file, detail } }`. The check then stops with `load failure: runner-failed audit file-unparseable <file> <detail>` and exit `2`.
|
|
228
|
+
- Case tests use `clauseConformanceOf` from `@hailstails/hone/testing`, as [docs/extending.md](docs/extending.md#test-a-piece) shows.
|
|
229
|
+
- A test that called the copy's check or governance functions directly, such as `runCheck` or `applyGovernance`, has no entry to call: run the `hone check` command against a repository the test sets up, and assert on its report and exit code.
|
|
230
|
+
5. **Remove the copy.** Delete `tools/discipline-core/`, its line in `.gitignore`, and its entry in `disciplines.json`'s `exclude`.
|
|
231
|
+
6. **Re-project** if any clause is `eslint`: run `npm run --silent hone:project`. The projection now imports each piece by package name instead of by a path into `tools/discipline-core/`, so it changes once; commit it.
|
|
232
|
+
7. **Run the check.** Compare it with the last run on the copy. A `readFirst` line now names its rule page under `node_modules/@hailstails/hone/rules/`, not in the copy. Any other new line comes from what the package checks that the copy did not, which the sections listed above describe. A `toolchain-unavailable` load failure names a package to install at the repository root.
|
|
194
233
|
|
|
195
234
|
## 10. Moving from the discipline-core names to Hone
|
|
196
235
|
|
|
@@ -210,13 +249,13 @@ Before `0.1.0-pre.1` the tool was called discipline core, with provisional names
|
|
|
210
249
|
| rule pages under `node_modules/discipline-core/rules/` | `node_modules/@hailstails/hone/rules/` |
|
|
211
250
|
|
|
212
251
|
1. **Swap the package.** Run `npm uninstall discipline-core`, then install `@hailstails/hone` as [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 says. Replace the vendored tarball file if the repository keeps one.
|
|
213
|
-
2. **Rename the scripts and repoint their callers.** In `package.json`, replace the two scripts with `"hone:check": "hone check --repo ."` and `"hone:project": "hone project --repo ."`, then change every caller of the old scripts or commands: CI, the pre-push hook and the validation script. Flags are unchanged
|
|
252
|
+
2. **Rename the scripts and repoint their callers.** In `package.json`, replace the two scripts with `"hone:check": "hone check --repo ."` and `"hone:project": "hone project --repo ."`, then change every caller of the old scripts or commands: CI, the pre-push hook and the validation script. Flags are unchanged: with npm they go after `--`, with pnpm straight after the script name.
|
|
214
253
|
3. **Re-project** if any clause is `eslint`: run `npm run --silent hone:project`. The projection's imports, block names and rule ids change once; commit it.
|
|
215
254
|
4. **Rename old rule ids written by hand.** Any `eslint-disable` comment, team config rule entry or suppression that names `discipline/...` or `discipline-cd<N>/...` now names a rule that no longer exists. The check does not list it: it names no selected rule, so it drops out of `unrecorded` instead of appearing there. What appears is the finding it no longer suppresses, in the repository's own ESLint run. Search the repository for `discipline/` and `discipline-cd` and rename each to `hone/...` or `hone-cd<N>/...`, so the check governs it again.
|
|
216
255
|
5. **Repoint agent instructions** from `node_modules/discipline-core/rules/` to `node_modules/@hailstails/hone/rules/`.
|
|
217
256
|
6. **Run the check.** It must give the same report as the last run under the old names.
|
|
218
257
|
|
|
219
|
-
A repository whose own tooling calls the commands, such as the rin harness
|
|
258
|
+
A repository whose own tooling calls the commands, such as the rin harness, changes those calls on its own side. The engine name in `harness.config.json` belongs to that tooling: a current rin plugin names it `"hone"` and still accepts `"discipline-core"`, as [step 6](#6-remove-the-old-route-and-repoint-everything) says.
|
|
220
259
|
|
|
221
260
|
## 11. Moving from `honed` to `@hailstails/hone`
|
|
222
261
|
|
|
@@ -231,7 +270,7 @@ Version `0.1.0-pre.1` was published as the GitHub release tarball `honed-0.1.0-p
|
|
|
231
270
|
| governance rule `honed/inline-config` | `hone-core/inline-config` |
|
|
232
271
|
| rule pages under `node_modules/honed/rules/` | `node_modules/@hailstails/hone/rules/` |
|
|
233
272
|
|
|
234
|
-
1. **Swap the package.** Run `npm uninstall honed`, then install `@hailstails/hone` as [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 says:
|
|
273
|
+
1. **Swap the package.** Run `npm uninstall honed`, then install `@hailstails/hone` as [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 says: from npm at an exact version, or the tarball attached to the latest [GitHub release](https://github.com/HailsTails/hone/releases). Remove the vendored `honed-0.1.0-pre.1.tgz` if the repository keeps one, or replace it with the new tarball. `typescript` is now a required peer, where `honed` declared it optional: if the repository root does not already declare it, npm 7 and later install the newest supported release on their own, so add it to `devDependencies` at the version the repository uses.
|
|
235
274
|
2. **Re-project straight away** if any clause is `eslint`, before the check, the linter or anything else runs: `npm run --silent hone:project`, then commit `disciplines.eslint.mjs`. Until then the committed projection still imports `honed/...`, which is no longer installed, so the repository's own ESLint cannot load its configuration and the check stops with `load failure: runner-failed eslint team-config-unloadable eslint.config.mjs, the ESLint config for <file>, failed to load: Cannot find package 'honed' imported from ...disciplines.eslint.mjs ...` and exit 2. `hone project` does not load the old projection, so it runs and repairs it. Its import specifiers change from `honed/...` to `@hailstails/hone/...`, and its block names from `honed/...` to `hone-core/...`, in that same re-projection. The disciplines' rule ids `hone/...` and `hone-cd<N>/...` stay, so an `eslint-disable` comment, team config entry or suppression needs renaming only if it names `honed/inline-config`, which is now `hone-core/inline-config`.
|
|
236
275
|
3. **Keep the scripts.** `"hone:check": "hone check --repo ."` and `"hone:project": "hone project --repo ."` work unchanged, because the command is still `hone`.
|
|
237
276
|
4. **Repoint agent instructions** from `node_modules/honed/rules/` to `node_modules/@hailstails/hone/rules/`.
|
package/README.md
CHANGED
|
@@ -11,10 +11,11 @@ Hone checks a repository against the disciplines it has chosen to adopt. It is a
|
|
|
11
11
|
**Install the npm package `@hailstails/hone`.** The unscoped name `hone` on npm belongs to an unrelated package: never run `npm install hone`. `@hailstails/hone` installs one command, `hone`:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm
|
|
14
|
+
npm view @hailstails/hone dist-tags
|
|
15
|
+
npm install --save-dev --save-exact @hailstails/hone@<version>
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
Releases are pre-releases, published to npm under the dist-tag `next`, until a stable release is published under `latest`; the badge above shows the version `next` installs. The alternative is the tarball attached to each [GitHub release](https://github.com/HailsTails/hone/releases), installed with `npm install --save-dev <path-to-tarball>`. A repository on the package's old name, `honed`, moves with [MIGRATING.md](MIGRATING.md#11-moving-from-honed-to-hailstailshone). [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 has the steps, and the alternative of building the tarball from a pinned commit.
|
|
18
|
+
With pnpm the second command is `pnpm add -D --save-exact @hailstails/hone@<version>`. Releases are pre-releases, published to npm under the dist-tag `next`, until a stable release is published under `latest`; the badge above shows the version `next` installs. Pin the exact version the dist-tag you want names, rather than installing by tag: a pre-release can change commands, flags and files, and an install by tag can record a range. The alternative is the tarball attached to each [GitHub release](https://github.com/HailsTails/hone/releases), installed with `npm install --save-dev <path-to-tarball>`. A repository on the package's old name, `honed`, moves with [MIGRATING.md](MIGRATING.md#11-moving-from-honed-to-hailstailshone). [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 has the steps, and the alternative of building the tarball from a pinned commit.
|
|
18
19
|
|
|
19
20
|
Two mechanisms ship: `audit`, a standalone TypeScript syntax walker, and `eslint`, which runs the clause as an ESLint rule inside the team's own ESLint setup. [rules/README.md](rules/README.md) lists every shared discipline with its clauses: the audit mechanism checks 20 disciplines, and ESLint pieces check clauses of CD-1, CD-6, CD-7, CD-10, CD-14, CD-27, CD-40, CD-41, CD-42 and CD-44. The rest are judgement rules, applied in review with the review methods in [methods/](methods/README.md).
|
|
20
21
|
|
|
@@ -37,7 +38,7 @@ hone --version
|
|
|
37
38
|
|
|
38
39
|
[docs/output-contract.md](docs/output-contract.md) lists every line `hone` prints, exactly as it prints it, with the exit codes and which parts are stable for hooks, CI and agents to rely on. A test renders every kind of line and checks it against that page, both ways.
|
|
39
40
|
|
|
40
|
-
`hone check` loads the repository's selection, exceptions, rule sets and pieces; works out which files changed since `--base-revision`; runs each selected mechanism once over the repository's tracked `.ts`, `.tsx`, `.mts` and `.cts` files; applies the exceptions; and prints a plain-text report ending in `verdict: pass` or `verdict: fail
|
|
41
|
+
`hone check` loads the repository's selection, exceptions, rule sets and pieces; works out which files changed since `--base-revision`; runs each selected mechanism once over the repository's tracked `.ts`, `.tsx`, `.mts` and `.cts` files; applies the exceptions; and prints a plain-text report ending in `verdict: pass` or `verdict: fail`, followed by ` (partial assessment)` when the run left part of the assessment to another run. It exits `0` when the verdict is `pass`, `1` when it is `fail`, and `2` on a load failure, which prints one line, `load failure: <kind> <fields>`. `hone project` exits `0` or `2`.
|
|
41
42
|
|
|
42
43
|
The report lists the excluded paths, the clauses not adopted, the clauses adopted with their mechanism not run, findings, exempted findings, uncovered clauses, stale, forfeited, unrecorded and doubly-held exceptions, invalid exception records, unmeasured checks, projection problems, any part of the assessment left to another run and, last, where to read first for each clause with findings, each with its count. The verdict is `pass` only when every list except the excluded paths, clauses not adopted, clauses not run, exempted findings, assessment and where to read first is empty.
|
|
43
44
|
|
|
@@ -218,7 +219,7 @@ At the repository root; absent means no exceptions. Each entry names a selected
|
|
|
218
219
|
}
|
|
219
220
|
```
|
|
220
221
|
- A chain with neither `rootCheck` nor `readback` was written to the earlier contract. It is accepted only while the `--base-revision` holds its entry unchanged; a new or edited one is refused as `why-chain-refused`, and a run with such a chain and no `--base-revision` is `legacy-chain-unmeasured`.
|
|
221
|
-
- An entry carried over from an earlier system may give `provenance` instead of a `whyChain`: `{ "kind": "inherited-debt", "source", "decision" }` on a file carve-out, `{ "kind": "existing-authorisation", "source" }` on an authorised location. `source` names the old record entry as `<directory>/cd-<id>.json#<index>`: `.constitution-carve-outs` for inherited debt, `.constitution-authorised-locations` for an existing authorisation, the old file for the record's discipline, and the entry's position in its array. Such an entry is imported, and is accepted only while the `--base-revision` already holds it unchanged, or, when the base holds no record for that kind, clause and file, while the `source` entry at that revision lists the file in its `files`. A new or edited entry without a `whyChain` is refused as `import-unverified`, and a run with imported entries and no `--base-revision` is `import-unmeasured`. The report names each imported entry it exempts by.
|
|
222
|
+
- An entry carried over from an earlier system may give `provenance` instead of a `whyChain`: `{ "kind": "inherited-debt", "source", "decision" }` on a file carve-out, `{ "kind": "existing-authorisation", "source" }` on an authorised location, where `decision` is optional. `source` names the old record entry as `<directory>/cd-<id>.json#<index>`: `.constitution-carve-outs` for inherited debt, `.constitution-authorised-locations` for an existing authorisation, the old file for the record's discipline, and the entry's position in its array. Such an entry is imported, and is accepted only while the `--base-revision` already holds it unchanged, or, when the base holds no record for that kind, clause and file, while the `source` entry at that revision lists the file in its `files`. A new or edited entry without a `whyChain` is refused as `import-unverified`, and a run with imported entries and no `--base-revision` is `import-unmeasured`. The report names each imported entry it exempts by.
|
|
222
223
|
- With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` entry may give only its `reason`, which then carries why the exception exists and must not be blank. The entry itself is not checked against `--base-revision`, but a run with any file carve-out still needs `--base-revision`: without it the report lists `forfeiture-unmeasured` and the run fails, and with it a file carve-out is forfeited once its file is touched. A `whyChain` or `provenance` the entry gives anyway is still judged as above. A `clause-wide-carve-out` still needs its `whyChain`.
|
|
223
224
|
- A clause whose `discipline.json` declares `"exceptions": "refused"` cannot be exempted. No shipped discipline declares it, so every shipped clause can be.
|
|
224
225
|
- Files are exact repository paths, never globs.
|
|
@@ -226,7 +227,7 @@ At the repository root; absent means no exceptions. Each entry names a selected
|
|
|
226
227
|
|
|
227
228
|
## Installing
|
|
228
229
|
|
|
229
|
-
Hone installs as one npm package, `@hailstails/hone`, installed
|
|
230
|
+
Hone installs as one npm package, `@hailstails/hone`, installed from npm at an exact version, `@hailstails/hone@<version>` with `--save-exact`, downloaded as the tarball `hailstails-hone-<version>.tgz` attached to a GitHub release, or built by `pnpm run pack-package` into `artefacts/hailstails-hone-<version>.tgz`, the file name `npm pack` gives the scoped package, and added to the repository root as a development dependency; [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 has the steps. The package is plain JavaScript with `zod`, `jsonc-parser` and `@eslint/plugin-kit` bundled in, so it has no `dependencies`; its licences are reproduced in `THIRD-PARTY-NOTICES.md` inside it. It declares the toolchain as `peerDependencies`, `typescript` required and the ESLint packages optional, and exposes one command, `hone`, whose subcommands `hone check` and `hone project` are described under Commands. It ships the rule data and pages, both mechanisms, the review methods and the why-chain contract, and no TypeScript source, only the declaration files of the public type entries below.
|
|
230
231
|
|
|
231
232
|
With the ESLint mechanism selected, a packaged install's projection imports each piece by package name, `@hailstails/hone/mechanisms/eslint/<DisciplineId>/...`, so the repository's ESLint must resolve the package from the repository root. Hone compares the committed projection `disciplines.eslint.mjs` byte for byte with what `hone project` would write now.
|
|
232
233
|
|
|
@@ -272,7 +273,7 @@ Hone's version numbers follow semantic versioning under these rules:
|
|
|
272
273
|
|
|
273
274
|
A clause that accepts `audit` keeps accepting it: `audit` is never removed from the mechanisms such a clause lists, so a selection that names `audit` for it keeps loading. A clause can only gain mechanisms.
|
|
274
275
|
|
|
275
|
-
Each release's changes are listed in [
|
|
276
|
+
Each release's changes are listed in [CHANGELOG.md](CHANGELOG.md), which the package ships: after an upgrade, read `node_modules/@hailstails/hone/CHANGELOG.md` for what changed between the version you had and the one you have now.
|
|
276
277
|
|
|
277
278
|
## Known limits
|
|
278
279
|
|
|
@@ -309,7 +310,7 @@ This repository is self-contained: it holds its own configuration and its own lo
|
|
|
309
310
|
| `pack-package` | `node scripts/pack-package.ts`: builds `dist/` and packs it with `npm pack` into `artefacts/hailstails-hone-<version>.tgz`, named by the `version` in `package.json` |
|
|
310
311
|
| `package-determinism` | `node scripts/check-package-determinism.ts`: builds and packs twice into separate temporary roots and fails naming any file that differs, or when the two packed tarballs differ |
|
|
311
312
|
| `self-check` | `node scripts/self-check.ts check --repo .`: runs Hone's own check on this repository with `disciplines.json` and `discipline-exceptions.json`; pass `--base-revision <rev>` after the script name. See [Core's check on itself](#hones-check-on-itself) |
|
|
312
|
-
| `install-proof` | `node scripts/install-proof.ts`: packs the package once into a temporary tarball and installs it with pnpm into six CommonJS consumers in an OS temporary directory outside the working tree, each copied from its folder under `tests/test-fixtures/consumer-proof/`, which holds only what that consumer's action needs. Each consumer exists for one thing only an installed package shows. The audit consumer, on TypeScript 4.8.4, runs `check` through the installed bin and expects its finding. The ESLint 9.28.0 and 10.0.0 consumers run `project`, expect a projection importing the piece by package name, and expect its finding from `check`. The consumer without `eslint` expects `toolchain-unavailable`. These four run with type stripping off. The team consumer is the example [docs/extending.md](docs/extending.md) follows. On TypeScript 4.8.4 it type-checks a wrong team piece, rule set and ESLint piece settings with its own `tsc`, as described under Public type entries, and expects the three errors. On the development versions, TypeScript 6.0.3, ESLint 10.11.0 and typescript-eslint 8.71.2, it also type-checks its rule set under `nodenext` and `bundler` and a CommonJS file, then runs both commands with type stripping on: its `.ts` pieces load through the installed package and give one finding from each mechanism under the team's `acme/` prefix. Its root says `"type": "commonjs"`, the hard case, so its rule set carries its own `"type": "module"` `package.json`. Each consumer declares its toolchain at exact pins in its own `devDependencies`, as an adopter does: TypeScript 4.8.4 alone for the audit consumer, the consumer without `eslint` and the team consumer on 4.8.4; ESLint 9.28.0 or 10.0.0 with typescript-eslint 8.56.0 and TypeScript 4.8.4 for the two ESLint consumers; and the development versions for the team consumer. It declares the tarball beside them, pins the pnpm version this repository's `package.json` pins, and waits this repository's `minimumReleaseAge`. pnpm's store shares each toolchain package between consumers
|
|
313
|
+
| `install-proof` | `node scripts/install-proof.ts`: packs the package once into a temporary tarball and installs it with pnpm into six CommonJS consumers in an OS temporary directory outside the working tree, each copied from its folder under `tests/test-fixtures/consumer-proof/`, which holds only what that consumer's action needs. Each consumer exists for one thing only an installed package shows. The audit consumer, on TypeScript 4.8.4, runs `check` through the installed bin and expects its finding. The ESLint 9.28.0 and 10.0.0 consumers run `project`, expect a projection importing the piece by package name, and expect its finding from `check`. The consumer without `eslint` expects `toolchain-unavailable`. These four run with type stripping off. The team consumer is the example [docs/extending.md](docs/extending.md) follows. On TypeScript 4.8.4 it type-checks a wrong team piece, rule set and ESLint piece settings with its own `tsc`, as described under Public type entries, and expects the three errors. On the development versions, TypeScript 6.0.3, ESLint 10.11.0 and typescript-eslint 8.71.2, it also type-checks its rule set under `nodenext` and `bundler` and a CommonJS file, then runs both commands with type stripping on: its `.ts` pieces load through the installed package and give one finding from each mechanism under the team's `acme/` prefix. Its root says `"type": "commonjs"`, the hard case, so its rule set carries its own `"type": "module"` `package.json`. Each consumer declares its toolchain at exact pins in its own `devDependencies`, as an adopter does: TypeScript 4.8.4 alone for the audit consumer, the consumer without `eslint` and the team consumer on 4.8.4; ESLint 9.28.0 or 10.0.0 with typescript-eslint 8.56.0 and TypeScript 4.8.4 for the two ESLint consumers; and the development versions for the team consumer. It declares the tarball beside them, pins the pnpm version this repository's `package.json` pins, and waits this repository's `minimumReleaseAge`. pnpm's store shares each toolchain package between consumers. The proof prints where pnpm put the installed package and expects the report to name its pages through the consumer's `node_modules/@hailstails/hone` instead, and it runs `check` through the package script with its options after `--`, as an adopter's pre-push hook does. A pass once a violation is removed, rule-set naming, plugin namespaces, settings overrides and per-package ESLint configs are proven by unit and in-process tests instead. The temporary directory is removed afterwards |
|
|
313
314
|
| `pull-request-title` | `node scripts/pull-request-title-command.ts <title>`: passes a title shaped as a Conventional Commits subject, `type(scope)!: description`, and fails any other with the expected form. See [Versions and releases](#versions-and-releases) |
|
|
314
315
|
| `release-pull-request` | `node scripts/release-pull-request-command.ts [pre-release\|stable]`: writes the next release's section into `CHANGELOG.md` and its version into `package.json`, in the working tree only. See [Versions and releases](#versions-and-releases) |
|
|
315
316
|
|
package/api/testing.js
CHANGED
|
@@ -183,12 +183,47 @@ var assessmentInEffect = (request) => ({
|
|
|
183
183
|
var reportOutputSchema = external_exports.enum(["full", "failures-only", "counts", "verdict-only"]);
|
|
184
184
|
var reportOutputInEffect = (request) => request.requested ?? request.configured;
|
|
185
185
|
|
|
186
|
+
// core/check/package-link.ts
|
|
187
|
+
var UNLINKED = { kind: "unlinked" };
|
|
188
|
+
var INSTALL_FOLDER = "node_modules";
|
|
189
|
+
var PACKAGE_MANIFEST = "package.json";
|
|
190
|
+
var manifestTextAt = (request) => {
|
|
191
|
+
const read = request.fileText.read({ path: request.path.join({ segments: [request.root, PACKAGE_MANIFEST] }) });
|
|
192
|
+
return read.outcome === "ok" ? read.value : void 0;
|
|
193
|
+
};
|
|
194
|
+
var sameFolder = (request) => {
|
|
195
|
+
const location = request.path.relative(request);
|
|
196
|
+
return location.relation === "within-root" && location.path === "" ? "same" : "different";
|
|
197
|
+
};
|
|
198
|
+
var holdsRunningPackage = (request) => {
|
|
199
|
+
const running = manifestTextAt({ ...request, root: request.installRoot });
|
|
200
|
+
return running !== void 0 && running === manifestTextAt({ ...request, root: request.linkRoot }) ? "holds" : "does-not-hold";
|
|
201
|
+
};
|
|
202
|
+
var packageLinkOf = (request) => {
|
|
203
|
+
const linkRoot = request.path.join({ segments: [request.repoRoot, INSTALL_FOLDER, TOOL_IDENTITY.packageName] });
|
|
204
|
+
const linked = { kind: "linked", installRoot: request.installRoot, linkRoot };
|
|
205
|
+
if (sameFolder({ path: request.path, from: linkRoot, to: request.installRoot }) === "same") {
|
|
206
|
+
return linked;
|
|
207
|
+
}
|
|
208
|
+
return holdsRunningPackage({ ...request, linkRoot }) === "holds" ? linked : UNLINKED;
|
|
209
|
+
};
|
|
210
|
+
|
|
186
211
|
// core/check/shown-path.ts
|
|
187
212
|
var NATIVE_SEPARATOR = "\\";
|
|
188
213
|
var SHOWN_SEPARATOR = "/";
|
|
214
|
+
var PARENT_FOLDER = "..";
|
|
215
|
+
var insidePackage = (request) => request.within === PARENT_FOLDER || request.within.startsWith(`${PARENT_FOLDER}${SHOWN_SEPARATOR}`) ? "outside" : "inside";
|
|
216
|
+
var throughLink = (request) => {
|
|
217
|
+
if (request.link.kind === "unlinked") {
|
|
218
|
+
return request.target;
|
|
219
|
+
}
|
|
220
|
+
const location = request.path.relative({ from: request.link.installRoot, to: request.target });
|
|
221
|
+
return location.relation === "within-root" && insidePackage({ within: location.path }) === "inside" ? request.path.join({ segments: [request.link.linkRoot, location.path] }) : request.target;
|
|
222
|
+
};
|
|
189
223
|
var shownPathOf = (request) => {
|
|
190
|
-
const
|
|
191
|
-
|
|
224
|
+
const target = throughLink(request);
|
|
225
|
+
const location = request.repoRoot === void 0 ? void 0 : request.path.relative({ from: request.repoRoot, to: target });
|
|
226
|
+
return location?.relation === "within-root" ? location.path : target.replaceAll(NATIVE_SEPARATOR, SHOWN_SEPARATOR);
|
|
192
227
|
};
|
|
193
228
|
var shownRunnerFailureOf = (request) => {
|
|
194
229
|
const { failure } = request;
|
|
@@ -1571,7 +1606,7 @@ var assessmentSectionOf = (request) => {
|
|
|
1571
1606
|
}
|
|
1572
1607
|
return request.headings.headings.has(assessmentSectionHeading(request)) ? "present" : "not-assessed";
|
|
1573
1608
|
};
|
|
1574
|
-
var shownPageOf = (request) => shownPathOf({ path: request.path, repoRoot: request.repoRoot, target: request.page });
|
|
1609
|
+
var shownPageOf = (request) => shownPathOf({ path: request.path, repoRoot: request.repoRoot, link: request.link, target: request.page });
|
|
1575
1610
|
var clauseReadingOf = (request) => ({
|
|
1576
1611
|
kind: "clause",
|
|
1577
1612
|
clause: request.clause,
|
|
@@ -1592,10 +1627,11 @@ var clauseReadingsOf = (request) => {
|
|
|
1592
1627
|
return [];
|
|
1593
1628
|
}
|
|
1594
1629
|
const headings = assessmentHeadingsOf(request);
|
|
1630
|
+
const link = packageLinkOf(request);
|
|
1595
1631
|
return [
|
|
1596
|
-
...assessmentFileNotes({ ...request, headings }),
|
|
1632
|
+
...assessmentFileNotes({ ...request, headings, link }),
|
|
1597
1633
|
...clauses.flatMap(
|
|
1598
|
-
(clause) => request.clauseRoots.filter((root) => clauseAddressText({ address: root.clause }) === clauseAddressText({ address: clause })).map((root) => clauseReadingOf({ ...request, headings, clause, page: rulePageOf({ root, path: request.path }) }))
|
|
1634
|
+
(clause) => request.clauseRoots.filter((root) => clauseAddressText({ address: root.clause }) === clauseAddressText({ address: clause })).map((root) => clauseReadingOf({ ...request, headings, link, clause, page: rulePageOf({ root, path: request.path }) }))
|
|
1599
1635
|
)
|
|
1600
1636
|
];
|
|
1601
1637
|
};
|
|
@@ -2118,6 +2154,8 @@ export {
|
|
|
2118
2154
|
loadFailureText,
|
|
2119
2155
|
installRootOf,
|
|
2120
2156
|
installRootOfApiEntry,
|
|
2157
|
+
UNLINKED,
|
|
2158
|
+
packageLinkOf,
|
|
2121
2159
|
shownFailureOf,
|
|
2122
2160
|
defaultClauseSettings,
|
|
2123
2161
|
readRunSettings,
|