| 1 | package Claude::Agent::Hook::Result; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use 5.020; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub proceed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proceed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | return {}; | |||||||||||||||||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | sub allow { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allow: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | return _permission('allow', %args); | |||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | sub deny { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deny: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | return _permission('deny', %args); | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | sub ask { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ask: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | return _permission('ask', %args); | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | sub defer { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | return _permission('defer', %args); | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 8 | ▶ | sub _permission { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_permission: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 8 | my ($decision, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | my %specific = ( | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 8 | ▶ | hookEventName => $args{event} // 'PreToolUse', | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"event"} // "PreToolUse"
MC/DC100%1/1
$args{"event"} // "PreToolUse"
$args{"event"}
Truth table100%2/2
A
A= $args{"event"}
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | permissionDecision => $decision, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 8 | ▶ | $specific{permissionDecisionReason} = $args{reason} if defined $args{reason}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | ▶ | $specific{updatedInput} = $args{updated_input} if defined $args{updated_input}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 8 | return { hookSpecificOutput => \%specific }; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | sub block { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
block: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | my $result = { decision => 'block' }; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | $result->{reason} = $args{reason} if defined $args{reason}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | sub stop { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stop: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | my $result = { continue => \0 }; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ▶ | $result->{stopReason} = $args{reason} if defined $args{reason}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | ▶ | sub add_context { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_context: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | my ($class, $text, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 58 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 59 | hookSpecificOutput => { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | ▶ | hookEventName => $args{event} // 'PreToolUse', | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"event"} // "PreToolUse"
MC/DC100%1/1
$args{"event"} // "PreToolUse"
$args{"event"}
Truth table100%2/2
A
A= $args{"event"}
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | additionalContext => $text, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | ▶ | sub update_tool_output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_tool_output: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | my ($class, $output, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 68 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 69 | hookSpecificOutput => { | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | ▶ | hookEventName => $args{event} // 'PostToolUse', | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"event"} // "PostToolUse"
MC/DC0%0/1
$args{"event"} // "PostToolUse"
$args{"event"}
Truth table50%1/2
A
A= $args{"event"}
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | updatedToolOutput => $output, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | ▶ | sub system_message { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | my ($class, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | return { systemMessage => $text }; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | sub suppress_output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
suppress_output: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | return { suppressOutput => \1 }; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | sub async { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
async: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | my $result = { async => \1 }; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | ▶ | $result->{asyncTimeout} = $args{timeout} if defined $args{timeout}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ▶ | sub merge { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | my ($class, @results) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | my %merged; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | for my $result (@results) { | |||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | ▶ | next unless ref $result eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | for my $key (keys %$result) { | |||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | ▶ | if ($key eq 'hookSpecificOutput' && ref $merged{$key} eq 'HASH' && ref $result->{$key} eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$key eq "hookSpecificOutput" and ref $merged{$key} eq "HASH" and ref $result->{$key} eq "HASH"
$key eq "hookSpecificOutput" and ref $merged{$key} eq "HASH"
MC/DC66%2/3
$key eq "hookSpecificOutput" and ref $merged{$key} eq "HASH" and ref $result->{$key} eq "HASH"
$key eq "hookSpecificOutput"
ref $merged{$key} eq "HASH"
ref $result->{$key} eq "HASH"
Truth table75%3/4
A and B and C
A= $key eq "hookSpecificOutput"B= ref $merged{$key} eq "HASH"C= ref $result->{$key} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | $merged{$key} = { %{$merged{$key}}, %{$result->{$key}} }; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | $merged{$key} = $result->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | return \%merged; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | __END__ | ||||||||||||||||||||||||||||||||||||||||||