#11817: fix(build): compile bundled hook handlers into dist
stale
Cluster:
Hooks Enhancements and Fixes
#### Summary
Bundled hooks (boot-md, command-logger, session-memory, soul-evil) were missing their `handler.js` files in the npm package, causing `openclaw hooks list` to return "No hooks found" after installing v2026.2.6-3. The build only compiled main entry points via tsdown and copied `HOOK.md` files via `copy-hook-metadata.ts`, but never compiled the handler `.ts` files.
Closes #11810
Closes #11624
lobster-biscuit
#### Repro Steps
1. Install `openclaw@2026.2.6-3` via npm
2. Run `openclaw hooks list`
3. Result: "No hooks found" — `dist/hooks/bundled/*/` directories only contain `HOOK.md`, no `handler.js`
#### Root Cause
`tsdown.config.ts` only compiled main entry points (`src/index.ts`, `src/entry.ts`, etc.) but not the individual hook handler files. `scripts/copy-hook-metadata.ts` only copied `HOOK.md` files. The hook discovery code in `src/hooks/workspace.ts` looks for `handler.ts`/`handler.js` in each hook directory — with no `handler.js` present, hooks are silently skipped.
#### Behavior Changes
- All four bundled hook handlers (`boot-md`, `command-logger`, `session-memory`, `soul-evil`) are now compiled to `dist/hooks/bundled/*/handler.js` during the build
- `openclaw hooks list` will correctly discover bundled hooks after npm install
#### Codebase and GitHub Search
- Reviewed `tsdown.config.ts` for existing entry point patterns
- Reviewed `scripts/copy-hook-metadata.ts` to understand what was already copied
- Reviewed `src/hooks/bundled-dir.ts` for dist path resolution
- Reviewed `src/hooks/workspace.ts` for handler file discovery logic
- Confirmed no existing PRs for #11810 or #11624
#### Tests
- `pnpm build` succeeds; verified `dist/hooks/bundled/*/handler.js` exists for all 4 hooks
- All 88 hooks tests pass (`npx vitest run src/hooks/`)
- `pnpm check` passes for changed files (pre-existing doc format issues unrelated)
**Sign-Off**
- Models used: Claude (AI-assisted)
- Submitter effort: Traced build pipeline, identified gap, added tsdown entries, verified output
- Agent notes: Minimal change — single config file edit. The handler files import from the main codebase so they must be compiled (not just copied). tsdown bundles them with their dependencies into standalone handler.js files.
Made with [Cursor](https://cursor.com)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `tsdown.config.ts` to explicitly compile the four bundled hook handler entry points (boot-md, command-logger, session-memory, soul-evil) into `dist/hooks/bundled/*/handler.js`. This aligns the build output with the hook discovery logic (which looks for `handler.{ts,js}` alongside `HOOK.md`), fixing npm installs where only `HOOK.md` was present and `openclaw hooks list` found no bundled hooks.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Change is isolated to build configuration and adds explicit bundle entries for files that already exist in-tree; output paths match the runtime hook discovery expectations, and the dist/ directory is already included in the npm package files list.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#9914: fix(hooks): resolve bundled hook dist paths and packaging checks
by zimmra · 2026-02-05
87.2%
#14746: fix(hooks): use globalThis for handler registry to survive bundler ...
by openperf · 2026-02-12
85.3%
#11339: fix: resolve bundled hooks path on npm global install
by matthewpoe · 2026-02-07
83.9%
#16960: perf: skip cache-busting for bundled hooks, use mtime for workspace...
by mudrii · 2026-02-15
81.5%
#11153: refactor(hooks): replace console.warn/error with subsystem logger
by hclsys · 2026-02-07
81.4%
#23019: fix(hooks): use globalThis singleton for internal hooks handlers Map
by karmafeast · 2026-02-21
79.6%
#9947: fix: preserve agent-events as standalone entry point for hook consu...
by therealkaiharper-wq · 2026-02-05
79.5%
#3392: fix(hooks): remove debug console.log statements from session-memory...
by WinJayX · 2026-01-28
79.1%
#19021: fix(hooks): reject path traversal in hook pack manifest entries dur...
by moxunjinmu · 2026-02-17
77.3%
#6405: feat(security): Add HTTP API security hooks for plugin scanning
by masterfung · 2026-02-01
77.3%