Skip to content

Commit c5207f3

Browse files
committed
docs: update CLAUDE.md for Phase 1 file split
Architecture > Core Componentsセクションと「Adding a New Hook Type」 ワークフローを、Phase 1で実施したファイル分割に合わせて更新 - Hook Execution: hooks.go → 4ファイル分割を説明 - Action Executors: executor.go → 2ファイル分割を説明 - Utilities: utils.go → 3ファイル分割を説明 - ワークフロー手順を新ファイル構成に対応
1 parent e3292fa commit c5207f3

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

CLAUDE.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,30 +151,31 @@ The application follows a modular architecture with clear separation of concerns
151151
- Tool-specific parsing for PreToolUse/PostToolUse (complex tool_input handling)
152152
- Returns both structured data and raw JSON for template processing
153153

154-
**Hook Execution** (`hooks.go`)
155-
- Event-specific hook execution functions
156-
- Matcher checking (partial string matching with pipe separation)
157-
- Condition evaluation per event type
158-
- Dry-run mode for debugging configurations
154+
**Hook Execution**
155+
- `hooks_dispatch.go`: Entry points and routing for all hook types
156+
- `hooks_execute.go`: Standard event hook execution (8 events: Notification, SubagentStart, Stop, SubagentStop, PreCompact, SessionStart, UserPromptSubmit, SessionEnd)
157+
- `hooks_tool_permission.go`: Tool and permission related hooks (PreToolUse, PostToolUse, PermissionRequest)
158+
- `hooks_dryrun.go`: Dry-run mode implementations for all 11 event types
159159

160160
**Action Execution** (`actions.go`)
161161
- Command execution via shell
162162
- Output handling with exit status control
163163
- ExitError creation for blocking execution (PreToolUse only)
164164

165+
**Action Executors**
166+
- `executor.go`: ActionExecutor struct and standard event action execution (8 events with adjacent checkUnsupportedFields functions)
167+
- `executor_tool_permission.go`: Tool and permission related action execution (PreToolUse, PostToolUse, PermissionRequest)
168+
165169
**Template Engine** (`template_jq.go`)
166170
- Unified `{.field}` syntax for JSON field access
167171
- Full jq query support within template braces
168172
- Query caching for performance
169173
- Error handling with `[JQ_ERROR: ...]` format
170174

171-
**Utilities** (`utils.go`)
172-
- Condition checking functions per event type with `(bool, error)` return
173-
- Sentinel error pattern (`ErrConditionNotHandled`) for unknown condition types
174-
- Command execution wrapper
175-
- File existence, extension, and URL pattern matching
176-
- Prompt regex matching for UserPromptSubmit events
177-
- Transcript file parsing for `every_n_prompts` condition using json.Decoder
175+
**Utilities**
176+
- `conditions.go`: Condition checking functions per event type with `(bool, error)` return and sentinel error pattern (`ErrConditionNotHandled`)
177+
- `validation.go`: Output validation functions for all event types using JSON schema
178+
- `utils.go`: General utilities (file/directory existence, git operations, command execution, matcher checking)
178179

179180
### Data Flow
180181

@@ -1019,9 +1020,17 @@ Available reason values:
10191020
1. Define the input structure in `types.go` with embedded BaseInput
10201021
2. Add condition types if needed in `types.go` using the opaque struct pattern
10211022
3. Implement parsing logic in `parser.go`
1022-
4. Add hook execution function in `hooks.go`
1023-
5. Implement condition checking in `utils.go` with `(bool, error)` return
1024-
6. Add tests in corresponding `*_test.go` files
1023+
4. Add hook execution functions in appropriate hooks files:
1024+
- Standard events: `hooks_execute.go`
1025+
- Tool/permission events: `hooks_tool_permission.go`
1026+
- Dry-run implementations: `hooks_dryrun.go`
1027+
- Entry points: `hooks_dispatch.go`
1028+
5. Add action execution in appropriate executor files:
1029+
- Standard events: `executor.go`
1030+
- Tool/permission events: `executor_tool_permission.go`
1031+
6. Implement condition checking in `conditions.go` with `(bool, error)` return
1032+
7. Add output validation in `validation.go` using JSON schema
1033+
8. Add tests in corresponding `*_test.go` files
10251034

10261035
### Testing Template Processing
10271036
Template processing can be tested independently:

0 commit comments

Comments
 (0)