hookscripts

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package hookscripts is the single source of truth for VaultMind's Claude Code hook scripts. The .sh files in this directory are embedded into the vaultmind binary at build time and are also the scripts THIS repo's own SessionStart hook invokes via the local path under $CLAUDE_PROJECT_DIR.

Two SSOT properties matter:

  • **One canonical source.** No copy of these scripts exists elsewhere in the vaultmind repo. The local repo's hook config points at `internal/hookscripts/<name>.sh` directly; the binary embeds the same files via `//go:embed`. Drift between a "disk version" and an "embedded version" is structurally impossible because there is no second disk version.

  • **Drift-detect across consumers.** Other projects that run `vaultmind hooks install` get COPIES written to their own `.claude/scripts/`. Those copies CAN drift from the binary as vaultmind ships new versions. The drift is bounded by `vaultmind doctor`'s hook-drift check — it hashes the installed copies against the embedded canonical and surfaces mismatches. The resolution is one command: `vaultmind hooks install --force`.

Adding a new hook: place the .sh file in this directory; the embed FS picks it up automatically. Update `Names()` if the caller needs to enumerate them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() map[string][]byte

All returns the embedded scripts as a map of base filename → bytes. Stable order via sorted keys when iterated; callers that need determinism should sort `Names()` or iterate the returned map via a sorted list.

func FS

func FS() fs.FS

FS exposes the embed.FS for callers that need fs.FS semantics (range-walk, custom predicates). Most callers should prefer All or Get; this is the escape hatch.

func Get

func Get(name string) ([]byte, bool)

Get returns the bytes of one embedded hook script by filename (e.g. "load-persona.sh"). Returns nil + false if not embedded. Lookup is exact-match on the base filename; no path traversal.

func Names

func Names() []string

Names returns the list of embedded hook script filenames in sorted order. Useful for callers that want a stable iteration (doctor's drift-check report, hooks install's per-file output).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL