Class: ClaudeHooks::UserPromptSubmit
- Inherits:
-
Base
- Object
- Base
- ClaudeHooks::UserPromptSubmit
show all
- Defined in:
- lib/claude_hooks/user_prompt_submit.rb
Constant Summary
Constants inherited
from Base
Base::COMMON_INPUT_FIELDS
Instance Attribute Summary
Attributes inherited from Base
#config, #input_data, #logger, #output, #output_data
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#agent_id, #agent_type, #allow_continue!, #base_dir, #call, #clear_specifics!, #clear_system_message!, #cwd, #effort, #home_claude_dir, #home_path_for, #hook_event_name, #hook_type, #initialize, #log, #output_and_exit, #path_for, #permission_mode, #prevent_continue!, #project_claude_dir, #project_path_for, #prompt_id, #read_transcript, #session_id, #show_output!, #stringify_output, #suppress_output!, #system_message!, #terminal_sequence, #terminal_sequence!, #transcript_path
Class Method Details
.hook_type ⇒ Object
7
8
9
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 7
def self.hook_type
'UserPromptSubmit'
end
|
11
12
13
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 11
def self.input_fields
%w[prompt]
end
|
Instance Method Details
#add_additional_context!(context) ⇒ Object
Also known as:
add_context!
25
26
27
28
29
30
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 25
def add_additional_context!(context)
@output_data['hookSpecificOutput'] = {
'hookEventName' => hook_event_name,
'additionalContext' => context
}
end
|
#block_prompt!(reason = '') ⇒ Object
37
38
39
40
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 37
def block_prompt!(reason = '')
@output_data['decision'] = 'block'
@output_data['reason'] = reason
end
|
#empty_additional_context! ⇒ Object
33
34
35
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 33
def empty_additional_context!
@output_data['hookSpecificOutput'] = nil
end
|
#prompt ⇒ Object
Also known as:
user_prompt, current_prompt
17
18
19
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 17
def prompt
@input_data['user_prompt'] || @input_data['prompt']
end
|
#unblock_prompt! ⇒ Object
42
43
44
45
|
# File 'lib/claude_hooks/user_prompt_submit.rb', line 42
def unblock_prompt!
@output_data['decision'] = nil
@output_data['reason'] = nil
end
|