
wkkkis-hooks
A tiny CLI for installing ready-to-use React/Next.js hooks from a public registry into your project.
Think of it as npm install — but only for hooks.
✨ Features
- 🚀 Install hooks directly from the wkkkis/hooks-registry
- 📂 Configurable install path (
src/hooks
by default)
- 🪝 Auto-update
index.ts
with exports
- 🔍 Search, list, update, remove hooks
- 🧹 Optional stripping of
"use client"
- 🔗 Path alias rewriting (e.g.
@/
→ relative paths)
- 🩺 Doctor check & README generator
📦 Installation
npm install -g wkkkis-hooks
Requires Node.js 18+.
🚀 Quick Start
# Initialize hooks.config.json in your project
wkkkis-hooks init
# Install a hook
wkkkis-hooks add use-debounce-callback
# List available hooks
wkkkis-hooks list
# Update a hook to the latest version
wkkkis-hooks update use-debounce-callback
# Remove a hook
wkkkis-hooks remove use-debounce-callback
⚙️ Configuration
The CLI creates a hooks.config.json
in your project root:
{
"baseDir": "src/hooks",
"addIndex": true,
"stripUseClient": false,
"aliasPrefix": "@/ ",
"aliasTarget": "src"
}
- baseDir — where hooks will be installed.
- addIndex — auto-maintain an
index.ts
with re-exports.
- stripUseClient — remove
"use client"
directive from installed hooks.
- aliasPrefix / aliasTarget — rewrite import paths from an alias (e.g.
@/components
) into relative paths when writing files.
📖 Commands
wkkkis-hooks <command>
init Initialize project config
list Show available hooks
info <hook> Show hook metadata and files
add <hook> [--path=..] Install a hook
update <hook> [--force] Update a hook to latest version
remove <hook> Remove a hook
readme Generate HOOKS.md with documentation
preset <name> Install a preset (e.g. "essentials")
search <query> Search hooks by id/name/description/tags
outdated Show hooks that have newer versions
doctor Validate installed hooks
migrate --path=<newDir> Move hooks to a new folder
📚 Example
wkkkis-hooks init --path=src/shared/hooks --alias-prefix=@/ --alias-target=src
wkkkis-hooks add use-toggle
wkkkis-hooks add use-copy-to-clipboard
Now you can import:
import { useBoolean, useClipboard } from "@/hooks";
🤝 Contributing
Issues and PRs are welcome!
Hooks themselves live in wkkkis/hooks-registry.
This CLI just installs them into your project.
📜 License
MIT © 2025 wkkkis