feat(hooks): run boot.md on gateway startup
This commit is contained in:
1 parent
676d41d415
commit
11b07f4a29
12 files changed
+310
-10
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import type { CliDeps } from "../../../cli/deps.js";
|
||||
import { createDefaultDeps } from "../../../cli/deps.js";
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import { runBootOnce } from "../../../gateway/boot.js";
|
||||
import type { HookHandler } from "../../hooks.js";
|
||||
|
||||
type BootHookContext = {
|
||||
cfg?: ClawdbotConfig;
|
||||
workspaceDir?: string;
|
||||
deps?: CliDeps;
|
||||
};
|
||||
|
||||
const runBootChecklist: HookHandler = async (event) => {
|
||||
if (event.type !== "gateway" || event.action !== "startup") {
|
||||
return;
|
||||
}
|
||||
|
||||
const context = (event.context ?? {}) as BootHookContext;
|
||||
if (!context.cfg || !context.workspaceDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
const deps = context.deps ?? createDefaultDeps();
|
||||
await runBootOnce({ cfg: context.cfg, deps, workspaceDir: context.workspaceDir });
|
||||
};
|
||||
|
||||
export default runBootChecklist;
|
||||
Reference in new issue
Block a user