vigiles API reference
    Preparing search index...

    Function experimental_hookState

    • Experimental

      Seed and read a compiled hook's named state from a test.

      — the store LAYOUT is not a stable contract (this handle exists so you never depend on it), and the hook vocabulary it serves is itself experimental_. See docs/compiled-hooks.md § Status / pending.

      Pass the hook file exactly as the wiring names it, and the same cwd the hook will run under — the store's location is derived from both, so a handle built with a different root points at a different (empty) store.

      import { experimental_hookState, runHook } from "vigiles";

      const st = experimental_hookState(hookFile, { cwd });
      st.clear();
      st.seed("retro.nagged", { ago: "4d" });
      const r = runHook(`npx vigiles hook-runtime run-program ${hookFile}`, event, { cwd });

      Parameters

      • hookFile: string
      • opts: { cwd?: string } = {}

      Returns HookStateHandle