hookset 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ofri Peretz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,204 @@
1
+ <p align="center">
2
+ <a href="https://github.com/ofri-peretz/burgee/tree/main/packages/hookset" target="blank">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ofri-peretz/burgee/main/brand-assets/hookset-lockup.svg" />
5
+ <img src="https://raw.githubusercontent.com/ofri-peretz/burgee/main/brand-assets/hookset-lockup-light.svg" alt="hookset" width="360" />
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ Every repo, the same hooks: the verification stations as lefthook presets and a Claude Code hook pack, pinned by tag.
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/hookset"><img src="https://img.shields.io/npm/v/hookset?style=flat-square&color=0a6b47" alt="hookset on npm: the latest version" /></a>
16
+ <a href="https://www.npmjs.com/package/hookset"><img src="https://img.shields.io/npm/dm/hookset?style=flat-square" alt="hookset downloads per month on npm" /></a>
17
+ <a href="https://github.com/ofri-peretz/burgee/actions/workflows/quality.yml?query=branch%3Amain"><img src="https://img.shields.io/github/actions/workflow/status/ofri-peretz/burgee/quality.yml?branch=main&style=flat-square&label=Quality%20Gate" alt="Quality Gate: the CI status of main" /></a>
18
+ <a href="https://app.codecov.io/gh/ofri-peretz/burgee/components"><img src="https://img.shields.io/codecov/c/github/ofri-peretz/burgee/main?component=hookset&style=flat-square" alt="hookset line coverage: its Codecov component" /></a>
19
+ <a href="https://scorecard.dev/viewer/?uri=github.com/ofri-peretz/burgee"><img src="https://img.shields.io/ossf-scorecard/github.com/ofri-peretz/burgee?style=flat-square&label=OpenSSF%20Scorecard" alt="OpenSSF Scorecard for the repository" /></a>
20
+ <a href="https://www.npmjs.com/package/hookset?activeTab=code"><img src="https://img.shields.io/npm/unpacked-size/hookset?style=flat-square" alt="Unpacked size of the latest hookset release on npm" /></a>
21
+ <a href="https://github.com/ofri-peretz/burgee/blob/main/packages/hookset/package.json"><img src="https://img.shields.io/badge/dependencies-1%20in%20family%2C%200%20outside-0a6b47?style=flat-square" alt="One dependency, all in the burgee family (burgee), none outside it" /></a>
22
+ <a href="https://github.com/ofri-peretz/burgee/blob/main/packages/hookset/package.json"><img src="https://img.shields.io/badge/types-included-blue?style=flat-square" alt="TypeScript types included for every entry point" /></a>
23
+ <a href="https://github.com/ofri-peretz/burgee/blob/main/packages/hookset/package.json"><img src="https://img.shields.io/badge/Node.js-22.13%2B-green?style=flat-square" alt="Node.js 22.13+" /></a>
24
+ <a href="https://github.com/ofri-peretz/burgee/blob/main/packages/hookset/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="License: MIT" /></a>
25
+ <a href="https://www.npmjs.com/package/hookset#provenance"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.npmjs.org%2Fhookset%2Flatest&query=%24.dist.attestations.provenance~&label=npm&style=flat-square&color=0a6b47" alt="npm provenance of the latest release, read live from its registry attestation" /></a>
26
+ </p>
27
+
28
+ <p align="center">
29
+ Docs: <a href="https://burgee.interlace.tools/docs/packages/hookset">https://burgee.interlace.tools/docs/packages/hookset</a><br />
30
+ Migrating from: <a href="https://github.com/ofri-peretz/burgee/tree/main/packages/hookset#migrating">husky</a>
31
+ </p>
32
+
33
+ **hookset** puts the same verification stations in every repository: lefthook presets for
34
+ `commit-msg`, `pre-commit` and `pre-push`, pulled through lefthook `remotes` at a pinned
35
+ `hookset@<version>` tag, and a Claude Code hook pack that denies a skipped hook, a moved
36
+ `core.hooksPath` and a hand-rolled CI polling loop. Each preset step calls the repository's own
37
+ script by a declared name, so the preset is the same everywhere and the repository decides what
38
+ runs. `hookset init` writes the smallest `lefthook.yml` that pulls them; `hookset check` fails a
39
+ repository whose hooks miss a station, pin no version, repeat a preset step or drift from the pack.
40
+
41
+ It covers the install half of **husky**: where husky keeps a hook script in each repository,
42
+ hookset keeps one pinned set for all of them and checks each repository against it. Every command
43
+ prints burgee's `--json` envelope, each problem with its `fix:` line, for a pipe or an agent.
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ npm install hookset
49
+ pnpm add hookset
50
+ yarn add hookset
51
+ bun add hookset
52
+ ```
53
+
54
+ Install it as a dev dependency (`-D`) beside lefthook. It needs git.
55
+
56
+ ## Quick start
57
+
58
+ ```bash
59
+ npm install hookset
60
+ ```
61
+
62
+ ```js
63
+ import { parseRemotes } from "hookset";
64
+
65
+ // The remote `hookset init` writes into lefthook.yml, pinned to a release tag.
66
+ const lefthook = `remotes:
67
+ - git_url: https://github.com/ofri-peretz/burgee
68
+ ref: hookset@0.2.1
69
+ configs:
70
+ - packages/hookset/presets/lefthook/pre-push.yml
71
+ `;
72
+ for (const remote of parseRemotes(lefthook)) console.log(`${remote.ref ?? "no ref"}: ${remote.configs.join(", ")}`);
73
+ ```
74
+
75
+ ```text
76
+ hookset@0.2.1: packages/hookset/presets/lefthook/pre-push.yml
77
+ ```
78
+
79
+ `hookset check` reads the same remotes and fails when one is pinned to a branch rather than a tag.
80
+
81
+ ## What it checks
82
+
83
+ ```sh
84
+ hookset init # the smallest lefthook.yml that pulls the presets, pinned to this version
85
+ hookset init --claude # and the Claude Code hook pack under .claude/hooks/
86
+ hookset check # the CI gate: exit 1 on any error, warnings listed
87
+ hookset check --json # the problems as data, one fix line each
88
+ ```
89
+
90
+ | Command | Exit 1 when |
91
+ | :-- | :-- |
92
+ | `init` | a `lefthook.yml` written by hand is already there and `--force` is not given |
93
+ | `check` | a station is missing, a remote pins no `hookset@<version>` tag, a preset step is repeated, or a vendored hook drifts from the pack |
94
+
95
+ ## Migrating
96
+
97
+ The switch is one command, `npx hookset init`, and husky's folder comes out:
98
+
99
+ ```diff
100
+ // package.json
101
+ "scripts": {
102
+ - "prepare": "husky",
103
+ + "prepare": "lefthook install",
104
+ }
105
+ ```
106
+
107
+ `npx hookset init` writes `lefthook.yml`; move each `.husky/<hook>` script into the
108
+ `hook:provedone`, `hook:staged` or `hook:verify` script its station calls, then delete `.husky/`.
109
+
110
+ ## Compatibility
111
+
112
+ Not graded: hookset reads and writes a repository's hook configuration, and no suite is graded
113
+ against it. It runs anywhere git and lefthook do.
114
+
115
+ ## Benchmarks
116
+
117
+ Every number here is produced by `npm run bench` and published at [burgee.interlace.tools/docs/benchmarks](https://burgee.interlace.tools/docs/benchmarks).
118
+
119
+ No suite is graded against this package yet, so there is no compatibility number to quote.
120
+
121
+ ## For agents
122
+
123
+ - **`hookset check --json`** and **`init --json`** print burgee's `--json` envelope, every
124
+ problem with a message that ends in `fix:`.
125
+ - **`--json`, `--schema` and an MCP server** come from one declaration on burgee:
126
+ `hookset --mcp` serves its commands as tools.
127
+ - **The Claude Code hook pack** is what an agent meets first: a denied `--no-verify` names the
128
+ hook to fix instead.
129
+ - **The docs are machine-readable** at
130
+ [burgee.interlace.tools/llms.txt](https://burgee.interlace.tools/llms.txt).
131
+
132
+ ## API
133
+
134
+ | Import | What it gives you |
135
+ | :-- | :-- |
136
+ | `hookset` | `parseRemotes()`, `checkRepo()`, `checkText()`, `initRepo()`, `lefthookTemplate()`, `loadStations()` and `program` |
137
+
138
+ The `hookset` bin is that API, declared once on burgee.
139
+
140
+ ## Requirements
141
+
142
+ Node 22.13 or later, git and lefthook.
143
+
144
+ ## Where it sits
145
+
146
+ It hosts no plugin key of its own.
147
+
148
+ Nothing in this family builds on it yet, and it builds on `burgee`.
149
+
150
+ ## The family
151
+
152
+ 18 packages, one repository, one release pipeline. Each installs and works on its own, and each owns
153
+ one job. Seven of them — `bellpull`, `closeout`, `linegauge`, `paratext`, `roundel`, `seniority`,
154
+ `truefit` — depend on nothing; the others depend only on packages in this table, and every
155
+ dependency points one way, down the [layers](https://burgee.interlace.tools/docs/concepts/family).
156
+
157
+ No package declares a dependency from outside the family; `react` and `react-reconciler` are
158
+ optional peers of `controlroom`, which npm does not install; `vitest` is an optional peer of
159
+ `oxmutate`, which npm does not install; `eslint` is an optional peer of `truepass`, which npm does
160
+ not install.
161
+ [`package-shape-lock`](https://github.com/ofri-peretz/burgee/blob/main/scripts/package-shape-lock.test.ts)
162
+ holds that for every manifest, and
163
+ [`independence-install-lock`](https://github.com/ofri-peretz/burgee/blob/main/scripts/independence-install-lock.test.ts)
164
+ installs each package alone and finds nothing but the family packages it declares.
165
+
166
+ Releases are published by one workflow through npm trusted publishing: no npm token is used, and
167
+ each release carries SLSA provenance, which `npm view <package> dist.attestations` shows.
168
+ [`trusted-publishing-lock`](https://github.com/ofri-peretz/burgee/blob/main/scripts/trusted-publishing-lock.test.ts)
169
+ keeps both true.
170
+
171
+ | Package | What it is | Migrates from |
172
+ | :-- | :-- | :-- |
173
+ | [burgee](https://burgee.interlace.tools/docs/packages/burgee) | The CLI framework: one declaration, every surface | commander, yargs and meow |
174
+ | [roundel](https://roundel.interlace.tools/docs) | Colour: one output policy, semantic tokens, a theme | chalk, colorette, kleur, picocolors, supports-color and yoctocolors |
175
+ | [flagstaff](https://flagstaff.interlace.tools/docs) | The frame loop: spinners, progress, boxes and tables | ora, log-update, boxen and cli-table3 |
176
+ | [caique](https://caique.interlace.tools/docs) | Prompts that are flags first, and never hang | @inquirer/core |
177
+ | [linegauge](https://linegauge.interlace.tools/docs) | Measuring, wrapping, truncating and slicing styled text | string-width, wrap-ansi, strip-ansi, slice-ansi, cli-truncate and widest-line |
178
+ | [paratext](https://paratext.interlace.tools/docs) | Hyperlinks, images, title, clipboard and notifications | ansi-escapes, terminal-link and term-img |
179
+ | [seniority](https://seniority.interlace.tools/docs) | Configuration precedence and discovery, with provenance | cosmiconfig, lilconfig, dotenv and rc |
180
+ | [closeout](https://closeout.interlace.tools/docs) | Exit handlers, terminal restore and a bounded shutdown | signal-exit, exit-hook, restore-cursor, cli-cursor and onetime |
181
+ | [bellpull](https://bellpull.interlace.tools/docs) | Subprocesses, and which executable actually ran | cross-spawn and which |
182
+ | [controlroom](https://controlroom.interlace.tools/docs) | Keyboard-driven terminal screens, inline or full-screen | ink |
183
+ | [oxmutate](https://oxmutate.interlace.tools/docs) | Mutation testing on the oxc engine, inside your own Vitest | Stryker |
184
+ | [truepass](https://burgee.interlace.tools/docs/packages/truepass) | Lint rules and a pre-push check that keep a test suite honest | @vitest/eslint-plugin |
185
+ | [contractdiff](https://burgee.interlace.tools/docs/packages/contractdiff) | API contracts: breaking-change diff, lint, and code from the spec | openapi-typescript |
186
+ | [truefit](https://burgee.interlace.tools/docs/packages/truefit) | Validation whose schemas are data, with no eval | zod |
187
+ | [provedone](https://burgee.interlace.tools/docs/packages/provedone) | A receipt for how every change was verified, and a gate that reads it | @commitlint/cli |
188
+ | [replz](https://burgee.interlace.tools/docs/packages/replz) | Recall of a reviewer and its checks, replayed on bugs that shipped | promptfoo |
189
+ | **hookset** (this package) | The same git and Claude Code hooks in every repository, pinned by tag | husky |
190
+ | [triggerlist](https://burgee.interlace.tools/docs/packages/triggerlist) | The review checklist a diff selects, read from the base branch | danger |
191
+
192
+ Every migration guide, and the family-wide [compatibility](https://burgee.interlace.tools/docs/compatibility)
193
+ and [benchmarks](https://burgee.interlace.tools/docs/benchmarks) pages, are on
194
+ [burgee.interlace.tools](https://burgee.interlace.tools/docs/packages).
195
+
196
+ ## Contributing
197
+
198
+ Issues and pull requests are welcome at [ofri-peretz/burgee](https://github.com/ofri-peretz/burgee/issues); read
199
+ [CONTRIBUTING.md](https://github.com/ofri-peretz/burgee/blob/main/CONTRIBUTING.md) first. Report a vulnerability privately, as
200
+ [SECURITY.md](https://github.com/ofri-peretz/burgee/blob/main/SECURITY.md) describes — never in a public issue.
201
+
202
+ ## Licence
203
+
204
+ MIT © Ofri Peretz — see [LICENSE](https://github.com/ofri-peretz/burgee/blob/main/packages/hookset/LICENSE).