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 +21 -0
- package/README.md +204 -0
- package/claude/guard-bash.mjs +559 -0
- package/claude/stop-after-3.mjs +158 -0
- package/dist/bin.js +4 -0
- package/dist/cli.js +54 -0
- package/dist/core.d.ts +86 -0
- package/dist/core.js +299 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/runtime.js +1 -0
- package/package.json +75 -1
- package/presets/lefthook/commit-msg.yml +11 -0
- package/presets/lefthook/pre-commit.yml +7 -0
- package/presets/lefthook/pre-push.yml +22 -0
- package/stations.json +28 -0
package/package.json
CHANGED
|
@@ -1 +1,75 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "hookset",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Git hooks presets for AI coding agents: lefthook presets pulled by a pinned tag, a Claude Code hook pack that denies skipped hooks, and `hookset init` and `check`. No dependency outside the burgee family. A husky migration path.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"git-hooks",
|
|
8
|
+
"lefthook",
|
|
9
|
+
"pre-commit",
|
|
10
|
+
"pre-push",
|
|
11
|
+
"commit-msg",
|
|
12
|
+
"claude-code",
|
|
13
|
+
"ai-agents",
|
|
14
|
+
"verification",
|
|
15
|
+
"cli"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://burgee.interlace.tools",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/ofri-peretz/burgee.git",
|
|
22
|
+
"directory": "packages/hookset"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/ofri-peretz/burgee/issues"
|
|
26
|
+
},
|
|
27
|
+
"author": "Ofri Peretz <ofriperetzdev@gmail.com>",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.13.0"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"hookset": "dist/bin.js"
|
|
34
|
+
},
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"!dist/**/*.map",
|
|
47
|
+
"!dist/**/*.test.*",
|
|
48
|
+
"presets",
|
|
49
|
+
"claude",
|
|
50
|
+
"stations.json"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -p tsconfig.build.json && node ../../scripts/strip-comments.mjs dist && node ../../scripts/declaration-reach.mts --prune",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"coverage": "vitest run --coverage.enabled",
|
|
57
|
+
"lint": "eslint src"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"burgee": "^2.1.3"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"vitest": "^5.0.1"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public",
|
|
67
|
+
"provenance": true
|
|
68
|
+
},
|
|
69
|
+
"sideEffects": [
|
|
70
|
+
"./dist/bin.js"
|
|
71
|
+
],
|
|
72
|
+
"typesVersions": {
|
|
73
|
+
"*": {}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# hookset preset — commit-msg. Pulled through lefthook `remotes` at a pinned `hookset@<version>`
|
|
2
|
+
# tag; never copy it into a repo (`hookset check` fails on a copy). The PATH tail is for GUI git
|
|
3
|
+
# clients that start hooks without the shell's PATH.
|
|
4
|
+
commit-msg:
|
|
5
|
+
commands:
|
|
6
|
+
hookset-commitlint:
|
|
7
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npx --no -- commitlint --edit {1}
|
|
8
|
+
fail_text: "The message must be <type>(<scope>): <subject>, with a scope from commitlint.config. Fix it and commit again."
|
|
9
|
+
hookset-provedone:
|
|
10
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent hook:provedone -- {1}
|
|
11
|
+
fail_text: "No receipt. Add `Verified-by: <command> -> exit 0`, or `Verified-by: none (<why no check applies>)`, and commit again."
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# hookset preset — pre-commit. Staged files only, under 10 seconds: anything slower belongs on
|
|
2
|
+
# pre-push. The repo declares what `hook:staged` runs; lefthook hands it the staged paths.
|
|
3
|
+
pre-commit:
|
|
4
|
+
commands:
|
|
5
|
+
hookset-staged:
|
|
6
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent hook:staged -- {staged_files}
|
|
7
|
+
fail_text: "A staged file fails lint or format. Run the repo's fix script, re-stage, and commit again."
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# hookset preset — pre-push. `hook:verify` is required (typecheck, the affected tests, the build:
|
|
2
|
+
# the repo decides how). The rest are wired with --if-present: a station a repo has not declared
|
|
3
|
+
# yet passes, and `hookset check` lists it. Stations in observe ship that way until they pass on a
|
|
4
|
+
# clean main everywhere.
|
|
5
|
+
pre-push:
|
|
6
|
+
commands:
|
|
7
|
+
hookset-verify:
|
|
8
|
+
priority: 1
|
|
9
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent hook:verify
|
|
10
|
+
fail_text: "typecheck, tests or build failed. Fix what it reports; never push with --no-verify."
|
|
11
|
+
hookset-mutation:
|
|
12
|
+
priority: 2
|
|
13
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent --if-present hook:mutation
|
|
14
|
+
hookset-test-integrity:
|
|
15
|
+
priority: 3
|
|
16
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent --if-present hook:test-integrity
|
|
17
|
+
hookset-proofline:
|
|
18
|
+
priority: 4
|
|
19
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent --if-present hook:proofline
|
|
20
|
+
hookset-triggerlist:
|
|
21
|
+
priority: 5
|
|
22
|
+
run: PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" npm run --silent --if-present hook:triggerlist
|
package/stations.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "The verification stations hookset wires, as data. proofline reads the same ids for its Checked line. A station in observe mode is wired with --if-present, so a repo that has not declared its script passes.",
|
|
3
|
+
"remote": "https://github.com/ofri-peretz/burgee",
|
|
4
|
+
"tagPrefix": "hookset@",
|
|
5
|
+
"presets": {
|
|
6
|
+
"commit-msg": "packages/hookset/presets/lefthook/commit-msg.yml",
|
|
7
|
+
"pre-commit": "packages/hookset/presets/lefthook/pre-commit.yml",
|
|
8
|
+
"pre-push": "packages/hookset/presets/lefthook/pre-push.yml"
|
|
9
|
+
},
|
|
10
|
+
"stations": [
|
|
11
|
+
{ "id": "commitlint", "hook": "commit-msg", "mode": "enforce", "command": "hookset-commitlint", "detail": "the message follows the repo's commitlint config" },
|
|
12
|
+
{ "id": "provedone", "hook": "commit-msg", "mode": "enforce", "command": "hookset-provedone", "script": "hook:provedone", "detail": "the commit carries a Verified-by receipt, or none with a reason" },
|
|
13
|
+
{ "id": "staged", "hook": "pre-commit", "mode": "enforce", "command": "hookset-staged", "script": "hook:staged", "detail": "lint and format the staged files only, under 10 s" },
|
|
14
|
+
{ "id": "verify", "hook": "pre-push", "mode": "enforce", "command": "hookset-verify", "script": "hook:verify", "detail": "typecheck, the affected tests and the build" },
|
|
15
|
+
{ "id": "mutation", "hook": "pre-push", "mode": "optional", "command": "hookset-mutation", "script": "hook:mutation", "detail": "changed-lines mutation testing" },
|
|
16
|
+
{ "id": "test-integrity", "hook": "pre-push", "mode": "observe", "command": "hookset-test-integrity", "script": "hook:test-integrity", "detail": "no .only, .skip or weakened assertion in the diff" },
|
|
17
|
+
{ "id": "proofline", "hook": "pre-push", "mode": "observe", "command": "hookset-proofline", "script": "hook:proofline", "detail": "the change carries its Checked line" },
|
|
18
|
+
{ "id": "triggerlist", "hook": "pre-push", "mode": "observe", "command": "hookset-triggerlist", "script": "hook:triggerlist", "detail": "protected paths changed only with their trigger" }
|
|
19
|
+
],
|
|
20
|
+
"claude": {
|
|
21
|
+
"files": ["guard-bash.mjs", "stop-after-3.mjs"],
|
|
22
|
+
"hooks": [
|
|
23
|
+
{ "event": "PreToolUse", "matcher": "Bash", "file": "guard-bash.mjs" },
|
|
24
|
+
{ "event": "PreToolUse", "matcher": "Edit|Write|MultiEdit|NotebookEdit", "file": "guard-bash.mjs" },
|
|
25
|
+
{ "event": "PostToolUse", "matcher": "Bash", "file": "stop-after-3.mjs" }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|