Documentation
¶
Index ¶
- Constants
- func Encode(settings map[string]any) ([]byte, error)
- func EntryPresent(entry any, shellCommand string) bool
- func MergeAgentHook(path, shellCommand string) ([]byte, bool, error)
- func MergeSessionStart(path, shellCommand string) ([]byte, bool, error)
- func WriteAtomically(path string, document []byte) error
- func WriteAtomicallyInjected(path string, document []byte, inj *filewrite.Injector) error
Constants ¶
const AgentMatcher = "Bash|Write|Edit|MultiEdit|NotebookEdit|Agent|Task"
Variables ¶
This section is empty.
Functions ¶
func EntryPresent ¶
EntryPresent reports whether one hooks-list entry already carries a handler running shellCommand. It only inspects the "hooks" handlers, not "matcher", so it applies to any hook event's entry shape — SessionStart's entries carry no matcher at all (see skills_hook_install.go).
func MergeAgentHook ¶
MergeAgentHook returns the settings document with the guard registered, and reports whether anything changed.
The document is decoded into generic maps rather than a typed struct so an unrelated key WB has never heard of survives the round trip untouched. A settings file is the user's, not WB's.
func MergeSessionStart ¶
MergeSessionStart returns the settings document with the SessionStart hook registered, and reports whether anything changed.
Decoded into generic maps, the same as mergeAgentHookSettings, so any key this command has never heard of -- including every other hook event -- survives the round trip untouched.
func WriteAtomically ¶
WriteAtomically replaces the settings file through a temporary file in the same directory, so an interrupted write can never leave the user without a settings file.
func WriteAtomicallyInjected ¶
WriteAtomicallyInjected is WriteAtomically's test seam (task-9 PR-2): every production call site reaches it only through WriteAtomically, which always passes a nil *filewrite.Injector, so production behaviour is unchanged; a test passes its own Injector directly to reach a create/write/close/chmod/rename failure branch deterministically. The chmod runs path-based, after close, exactly as before -- unlike this PR's other sites, which chmod the still-open fd -- so it uses filewrite.ChmodPath rather than filewrite.Chmod.
Types ¶
This section is empty.