Documentation
¶
Index ¶
Constants ¶
const CommitIfFilter = "Bash(git commit*)"
CommitIfFilter is the per-entry "if" condition that restricts hook entries to git commit commands. The Bash(pattern) syntax is evaluated as a glob against the bash command string, not the tool name.
const CommitMatcher = "Bash"
CommitMatcher is the PreToolUse hook group matcher that chunk manages. It targets the Bash tool by name; per Claude Code's hook spec, matcher filters only on tool name. Command-content filtering is done via CommitIfFilter on individual hook entries.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build generates .claude/settings.json content from commands. It creates:
- A PreToolUse hook matching "Bash(git commit*)" that runs each command before commits.
- A Stop hook that runs "chunk validate" after every session.
func BuildCodex ¶ added in v0.7.85
BuildCodex generates .codex/hooks.json content from commands. Produces the same hook structure as Build but without Claude Code-specific metadata ($schema, _comment) and without a permissions block. Commands run as-is; Codex sets CWD to the project root before invoking hooks.
Types ¶
type MergeResult ¶
type MergeResult struct {
Original []byte // existing settings.json content (re-marshaled for normalized formatting)
Merged []byte // merged result
Changed bool // false if already up to date
}
MergeResult holds the computed merge without performing any I/O.
func Merge ¶
func Merge(existing, generated []byte) (*MergeResult, error)
Merge computes the merged settings from existing and generated JSON bytes. It preserves all unknown keys in the existing settings and applies chunk's generated keys on top. Returns data only — display and file writing are the caller's responsibility.
func MergeCodex ¶ added in v0.7.85
func MergeCodex(existing, generated []byte) (*MergeResult, error)
MergeCodex computes the merged .codex/hooks.json from existing and generated bytes. It preserves all unknown keys and hook types, replaces the chunk-managed PreToolUse group by matcher, and replaces the chunk-managed Stop hook group by command.