Documentation
¶
Index ¶
Constants ¶
const CommitMatcher = "Bash(git commit*)"
CommitMatcher is the hook matcher string that chunk manages.
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.