fairlead 0.3.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2 (2026-09-28)
4
+
5
+ ### Fixed
6
+
7
+ - Generated npm packages no longer include `npm-shrinkwrap.json`.
8
+
9
+ ## 0.4.0 (2026-09-27)
10
+
11
+ ### New
12
+
13
+ - `fairlead guard compare FILE` checks the guard against the linter it replaces: it reads the other linter's `file:line rule` lines and fails on any finding one side has and the other doesn't, with `--map` for rule names and `--rules` to narrow it. `fairlead guard bench --since REV` replays the files each commit changed through the write hook and reports p50, p95 and the slowest time, and what it decided; `--p95-under` makes it a check. CI now fails when the write hook's p95 on a generated history goes over 50 ms. See [Checking the guard against your linter](https://mahkassem.github.io/fairlead/docs/guard.html#checking-the-guard-against-your-linter).
14
+ - The git hook: `fairlead hooks install --git` adds the commit stage to `lefthook.yml` by inserting lines, keeping its comments and layout, and uninstall restores it byte for byte. Plain `install` adds it wherever a lefthook config already exists. `fairlead doctor` reports both hooks, whether lefthook will run the git one, whether `fairlead` is on the PATH, and the event log: write-hook decisions, denies by rule, p50 and p95 time, time-outs, errors and commit-stage runs. See [The git hook](https://mahkassem.github.io/fairlead/docs/guard.html#the-git-hook).
15
+ - The write stage: `fairlead hooks install` adds a Claude Code hook that runs `fairlead guard hook` before every edit, and denies one that adds a finding, with the findings as the reason the agent reads (or, with `guard.on_finding = "warn"`, lets it through with them as a note). It never answers "allow", lets a call through whenever it can't decide, and keeps to `guard.budget_ms` (40 by default). `[[guard.commands]]` deny shell commands. `hooks.claude` chooses `.claude/settings.json` (shared, the default) or `.claude/settings.local.json`; `fairlead hooks uninstall` restores the file byte for byte when nobody changed it since. See [The write hook](https://mahkassem.github.io/fairlead/docs/guard.html#the-write-hook).
16
+
17
+ - More guard rules: `[guard.test_names]` (file names and test titles), `[guard.citations]` (a pointer in a comment must name a heading in a Markdown file), `[guard.migrations]` (a migration that exists at the base may not change, move or go, and numbers are unique), `[[guard.commands]]` (commands an agent may not run, for the write stage), and `[[guard.external]]` (any tool that prints `file:line message` becomes a rule, at the check stage by default or at commit). `guard check --base REV` checks migrations against a base. See [Guard rules](https://mahkassem.github.io/fairlead/docs/guard.html#test-names).
18
+ - Guard presets: `[guard.comments]` checks comment block length by context, comment density, history (dates, names, phrases, measurements), item references outside a pointer form, comments that address the next editor, and block markers, reading comments after code from the syntax tree. `[guard.size]` adds `function_lines`, counting a function's own lines without the functions nested in it. `[guard.cite]` appends a note to a rule's messages. See [Guard rules](https://mahkassem.github.io/fairlead/docs/guard.html#comments).
19
+ - Environments: `FAIRLEAD_ENV=staging` or `--env staging` layers `fairlead.staging.toml` (shared) over the project file and `fairlead.staging.local.toml` (personal, ignored in CI) over the local one. Naming an environment with no file for it is an error. See [Configuration](https://mahkassem.github.io/fairlead/docs/config.html#environments).
20
+ - `fairlead guard check` checks the project's own rules over every tracked file, with a ratchet: `--write-baseline` records today's counts for ratcheted rules and the check fails only when one rises. `--staged` is the commit stage, failing only on findings the staged change adds, compared by what each finding is about rather than its line. The first rule is `file-length` (`[guard.size]`). `guard.findings = "all"` counts every finding in a touched file instead, and `guard.on_finding = "warn"` shows the findings without stopping the commit. Commit-stage runs are recorded in `.git/fairlead/events.jsonl`, with rule ids and timings and never file contents; `guard.events = "off"` turns that off. See [Guard rules](https://mahkassem.github.io/fairlead/docs/guard.html).
21
+
22
+ ### Changed
23
+
24
+ - A plan's config digest leaves out `guard` and `hooks`, which never change a plan, so digests are the same as 0.3.0's for the same config.
25
+ - `[[guard.external]]` refuses `stages = ["write"]`: when the write hook runs, the file isn't written yet.
26
+
3
27
  ## 0.3.0 (2026-09-26)
4
28
 
5
29
  ### New
package/README.md CHANGED
@@ -107,10 +107,11 @@ commands. The [quick start](#quick-start) shows them, and the
107
107
 
108
108
  ## Status
109
109
 
110
- Pre-alpha. The latest release, v0.3.0, adds edges the imports don't show, a
111
- walk barrier, and replay of bun test output to v0.2.0's test plan, CI commands
112
- and action, replay, and config commands. Recall on real CI failures, with every
113
- miss and its cause, is in the [changelog](CHANGELOG.md) and on the
110
+ Pre-alpha. The latest release, v0.4.2, removes `npm-shrinkwrap.json` from the
111
+ generated npm package. v0.4.0 added guard rules and check, write and commit
112
+ hooks, guard compare and benchmark commands, and layered config environments.
113
+ Recall on real CI failures, with every miss and its cause, is in the
114
+ [changelog](CHANGELOG.md) and on the
114
115
  [benchmarks page](https://mahkassem.github.io/fairlead/docs/benchmarks.html).
115
116
  Claude Code comes first, then Codex. The [roadmap](https://mahkassem.github.io/fairlead/docs/roadmap.html)
116
117
  has milestones K0 to K6, each an [issue](https://github.com/mahkassem/fairlead/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "artifactDownloadUrls": [
3
- "https://github.com/mahkassem/fairlead/releases/download/v0.3.0"
3
+ "https://github.com/mahkassem/fairlead/releases/download/v0.4.2"
4
4
  ],
5
5
  "bin": {
6
6
  "fairlead": "run-fairlead.js"
@@ -90,7 +90,7 @@
90
90
  "zipExt": ".tar.xz"
91
91
  }
92
92
  },
93
- "version": "0.3.0",
93
+ "version": "0.4.2",
94
94
  "volta": {
95
95
  "node": "18.14.1",
96
96
  "npm": "9.5.0"
@@ -1,52 +0,0 @@
1
- {
2
- "lockfileVersion": 3,
3
- "name": "fairlead",
4
- "packages": {
5
- "": {
6
- "bin": {
7
- "fairlead": "run-fairlead.js"
8
- },
9
- "dependencies": {
10
- "detect-libc": "^2.1.2"
11
- },
12
- "devDependencies": {
13
- "prettier": "^3.8.3"
14
- },
15
- "engines": {
16
- "node": ">=14.14",
17
- "npm": ">=6"
18
- },
19
- "hasInstallScript": true,
20
- "license": "MIT OR Apache-2.0",
21
- "name": "fairlead",
22
- "version": "0.3.0"
23
- },
24
- "node_modules/detect-libc": {
25
- "engines": {
26
- "node": ">=8"
27
- },
28
- "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
29
- "license": "Apache-2.0",
30
- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
31
- "version": "2.1.2"
32
- },
33
- "node_modules/prettier": {
34
- "bin": {
35
- "prettier": "bin/prettier.cjs"
36
- },
37
- "dev": true,
38
- "engines": {
39
- "node": ">=14"
40
- },
41
- "funding": {
42
- "url": "https://github.com/prettier/prettier?sponsor=1"
43
- },
44
- "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
45
- "license": "MIT",
46
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
47
- "version": "3.8.3"
48
- }
49
- },
50
- "requires": true,
51
- "version": "0.3.0"
52
- }