@hasna/hooks 0.12.23 → 0.13.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/README.md +1 -0
- package/bin/hooks/scratch-lifecycle.js +5 -5
- package/bin/hooks/stop-review.js +2 -2
- package/bin/hooks-mcp.js +1246 -1134
- package/bin/index.js +2160 -1836
- package/bin/native-safety-entry.js +37 -37
- package/bin/native-safety-worker.cjs +37 -37
- package/bin/serve.js +115 -111
- package/dist/index.js +1633 -1453
- package/dist/lib/installer.d.ts +44 -5
- package/dist/lib/manifest.d.ts +21 -0
- package/dist/lib/native-target.d.ts +11 -2
- package/dist/lib/registry.d.ts +12 -0
- package/dist/lib/target-adapters.d.ts +151 -0
- package/dist/lib/targets.d.ts +99 -0
- package/dist/native-readiness.js +11 -11
- package/dist/native-safety.js +9 -9
- package/dist/opencode-stop-plugin.js +5 -5
- package/dist/sdk/index.js +7 -7
- package/dist/storage.js +34 -34
- package/dist/sumi-stop-plugin.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Open source hooks library for AI coding agents - Install safety, quality, and au
|
|
|
10
10
|
`@hasna/hooks` installs hooks into AI coding agents. A hook is a small program the agent runs at a fixed point: before a shell command, after a file edit, or when a turn ends. Hooks block a mistake, check the work, or automate a step. One CLI installs, lists, updates and removes them.
|
|
11
11
|
|
|
12
12
|
- **Agents.** Claude Code (the default target) and Codex. Compatible OpenCode and Sumi builds are supported for the stop-review hook. Gemini CLI is an install target (`--target gemini`), but the bundled shell guards do not yet recognise Gemini's tool names (`run_shell_command` rather than `Bash`), so do not rely on them there yet. Codewith targets remain for existing setups, but Codewith is deprecated.
|
|
13
|
+
- **Install targets.** `--target` also accepts `qwen`, `muse`, `kimi`, `pi` and `cursor`, each writing that harness's own config with an entry that calls `hooks run <hook> --target <name>`. They are not interchangeable: Muse hands over the final message as a quoted JSON string, which `hooks run --target muse` parses once; Kimi's stop payload carries no assistant text and Kimi blocks with exit 2 and stderr; Pi runs hooks through the `hasna-pi-hooks` bridge and receives no assistant text; Cursor's stop hook can neither block the turn nor carry the assistant text. A hook whose manifest sets `requires_final_message` or `requires_block` is refused at install on a target that cannot honour it, with the measured reason, instead of being installed to do nothing. `opencode` and `sumi` have no generic install path and are refused by name; their stop review is registered through `hooks install stop-review --target <opencode|sumi>`.
|
|
13
14
|
- **Catalog.** 57 bundled hooks in 10 categories, listed below. You can also install your own hooks from a local directory, a git URL or a manifest URL.
|
|
14
15
|
- **Safety core.** Guards that:
|
|
15
16
|
- block destructive git commands (gitguard);
|
|
@@ -492,10 +492,10 @@ async function main(argv = process.argv.slice(2), env = process.env, io = proces
|
|
|
492
492
|
if (import.meta.main)
|
|
493
493
|
await main();
|
|
494
494
|
export {
|
|
495
|
-
|
|
496
|
-
scratchpadRunner,
|
|
497
|
-
rootStation,
|
|
498
|
-
resolveScratchpadScript,
|
|
495
|
+
main,
|
|
499
496
|
readHookInput,
|
|
500
|
-
|
|
497
|
+
resolveScratchpadScript,
|
|
498
|
+
rootStation,
|
|
499
|
+
scratchpadRunner,
|
|
500
|
+
withBudget
|
|
501
501
|
};
|
package/bin/hooks/stop-review.js
CHANGED