mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 04:55:44 +00:00
fix: all bundled hooks broken since 2026.2.2 (tsdown migration) (#9295)
* fix: compile bundled hook handlers in tsdown build The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers from the build output. The copy-hook-metadata.ts script only copies HOOK.md metadata files, not the handler.ts source files. Without corresponding tsdown entry points, the handlers were never compiled to JS, causing `openclaw hooks list` to show 0 hooks on npm installs. This adds each bundled hook handler and the llm-slug-generator (dynamically imported by session-memory) as tsdown entry points: - src/hooks/bundled/session-memory/handler.ts - src/hooks/bundled/command-logger/handler.ts - src/hooks/bundled/boot-md/handler.ts - src/hooks/bundled/soul-evil/handler.ts - src/hooks/llm-slug-generator.ts Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked correctly under the previous tsc build. * refactor: use glob for bundled hook entries, fix dist output paths - Replace hardcoded entry list with glob pattern in tsdown.config.ts so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts) - Remove inconsistent comment block from tsdown.config.ts - Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled') relative to the chunk in dist/) - Update stale path comment in session-memory handler
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env tsx
|
#!/usr/bin/env tsx
|
||||||
/**
|
/**
|
||||||
* Copy HOOK.md files from src/hooks/bundled to dist/hooks/bundled
|
* Copy HOOK.md files from src/hooks/bundled to dist/bundled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
@@ -11,7 +11,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|||||||
const projectRoot = path.resolve(__dirname, "..");
|
const projectRoot = path.resolve(__dirname, "..");
|
||||||
|
|
||||||
const srcBundled = path.join(projectRoot, "src", "hooks", "bundled");
|
const srcBundled = path.join(projectRoot, "src", "hooks", "bundled");
|
||||||
const distBundled = path.join(projectRoot, "dist", "hooks", "bundled");
|
const distBundled = path.join(projectRoot, "dist", "bundled");
|
||||||
|
|
||||||
function copyHookMetadata() {
|
function copyHookMetadata() {
|
||||||
if (!fs.existsSync(srcBundled)) {
|
if (!fs.existsSync(srcBundled)) {
|
||||||
|
|||||||
@@ -36,4 +36,10 @@ export default defineConfig([
|
|||||||
fixedExtension: false,
|
fixedExtension: false,
|
||||||
platform: "node",
|
platform: "node",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
entry: ["src/hooks/bundled/*/handler.ts", "src/hooks/llm-slug-generator.ts"],
|
||||||
|
env,
|
||||||
|
fixedExtension: false,
|
||||||
|
platform: "node",
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user