| 1 | package App::Briefing::Team; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Findings about a project's Claude Code agent team | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 131 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 131 | ▶ | use JSON::MaybeXS (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 131 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 131 | our $VERSION = '0.006000'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 131 | has briefing => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2527 | ▶ | sub _trim { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trim: called CC=2 SCAR=10.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | my ( $value ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trim: not called CC=2 SCAR=10.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | $value = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | $value =~ s/\A\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | $value =~ s/\s+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 277 | ▶ | sub _unquote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unquote: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | my ( $value ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unquote: not called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | $value = _trim($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if ($value =~ /\A"([^"]*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | if ($value =~ /\A'([^']*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | $value =~ s/[ \t]#.*\z//s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | return _trim($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # Reads only the frontmatter, like the team check always did: the lines between | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # a first line "---" (a BOM before it is fine) and the next "---". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 143 | ▶ | sub _parse_agent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_agent: called CC=25 SCAR=48.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my ( $text ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_agent: not called CC=25 SCAR=48.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my %agent = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | frontmatter => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | has_name => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | name => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | description => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | allowed => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | top_skills => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | bad_list => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | $text = '' unless defined $text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $text =~ s/\A\x{FEFF}//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my @lines = split /\r?\n/, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | return \%agent unless @lines && _trim( $lines[0] ) eq '---'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
@lines and _trim($lines[0]) eq "---"
@lines and _trim($lines[0]) eq "---"
MC/DC50%1/2
@lines and _trim($lines[0]) eq "---"
@lines
_trim($lines[0]) eq "---"
MC/DC0%0/2
@lines and _trim($lines[0]) eq "---"
@lines
_trim($lines[0]) eq "---"
Truth table66%2/3
A and B
A= @linesB= _trim($lines[0]) eq "---"
Truth table0%0/3
A and B
A= @linesB= _trim($lines[0]) eq "---"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $agent{frontmatter} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | shift @lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my ( $mode, $briefing_indent ) = ( '', -1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | for my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $trimmed = _trim($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | last if $trimmed eq '---'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | next if $trimmed eq '' || $trimmed =~ /\A#/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$trimmed eq "" or $trimmed =~ /\A#/
$trimmed eq "" or $trimmed =~ /\A#/
MC/DC0%0/2
$trimmed eq "" or $trimmed =~ /\A#/
$trimmed eq ""
$trimmed =~ /\A#/
MC/DC0%0/2
$trimmed eq "" or $trimmed =~ /\A#/
$trimmed eq ""
$trimmed =~ /\A#/
Truth table33%1/3
A or B
A= $trimmed eq ""B= $trimmed =~ /\A#/
Truth table0%0/3
A or B
A= $trimmed eq ""B= $trimmed =~ /\A#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ($line =~ /\A[ \t]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ($mode eq 'description') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $agent{description} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | elsif ($mode eq 'briefing') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my ($indent) = $line =~ /\A([ \t]*)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | $briefing_indent = length $indent if $briefing_indent == -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$trimmed =~ /\Askills:(.*)\z/s and length $indent == $briefing_indent
$trimmed =~ /\Askills:(.*)\z/s and length $indent == $briefing_indent
MC/DC50%1/2
$trimmed =~ /\Askills:(.*)\z/s and length $indent == $briefing_indent
$trimmed =~ /\Askills:(.*)\z/s
length $indent == $briefing_indent
MC/DC0%0/2
$trimmed =~ /\Askills:(.*)\z/s and length $indent == $briefing_indent
$trimmed =~ /\Askills:(.*)\z/s
length $indent == $briefing_indent
Truth table66%2/3
A and B
A= $trimmed =~ /\Askills:(.*)\z/sB= length $indent == $briefing_indent
Truth table0%0/3
A and B
A= $trimmed =~ /\Askills:(.*)\z/sB= length $indent == $briefing_indent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $trimmed =~ /\Askills:(.*)\z/s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | && length($indent) == $briefing_indent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $value = _trim($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | $agent{bad_list} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$value =~ /\A\[/ and not $value =~ /\]/
$value =~ /\A\[/ and not $value =~ /\]/
MC/DC100%2/2
$value =~ /\A\[/ and not $value =~ /\]/
$value =~ /\A\[/
not $value =~ /\]/
MC/DC0%0/2
$value =~ /\A\[/ and not $value =~ /\]/
$value =~ /\A\[/
not $value =~ /\]/
Truth table100%3/3
A and not(B)
A= $value =~ /\A\[/B= not $value =~ /\]/
Truth table0%0/3
A and not(B)
A= $value =~ /\A\[/B= not $value =~ /\]/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | if $value =~ /\A\[/ && $value !~ /\]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $mode = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | next unless $trimmed =~ /\A([^:]*):(.*)\z/s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my ( $key, $value ) = ( _trim($1), _trim($2) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if ($key eq 'name') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $agent{has_name} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $agent{name} = _unquote($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | elsif ($key eq 'description') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if ($value eq '' || $value =~ /\A[#>|]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$value eq "" or $value =~ /\A[#>|]/
$value eq "" or $value =~ /\A[#>|]/
MC/DC100%2/2
$value eq "" or $value =~ /\A[#>|]/
$value eq ""
$value =~ /\A[#>|]/
MC/DC0%0/2
$value eq "" or $value =~ /\A[#>|]/
$value eq ""
$value =~ /\A[#>|]/
Truth table100%3/3
A or B
A= $value eq ""B= $value =~ /\A[#>|]/
Truth table0%0/3
A or B
A= $value eq ""B= $value =~ /\A[#>|]/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $mode = 'description'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $agent{description} = 1 if length _unquote($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | elsif ($key eq 'allowed-tools') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $agent{allowed} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | elsif ($key eq 'skills') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $agent{top_skills} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | elsif ($key eq 'briefing') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ( $mode, $briefing_indent ) = ( 'briefing', -1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return \%agent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 67 | ▶ | sub _agent_files { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_agent_files: called CC=9 SCAR=30.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | my ( $self ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_agent_files: not called CC=9 SCAR=30.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $fs = $self->briefing->filesystem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $root = $fs->join_path( $self->briefing->cwd, '.claude', 'agents' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my @found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my @pending = (''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | while (@pending) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my $relative = shift @pending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $directory = length $relative ? $fs->join_path( $root, $relative ) : $root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | for my $name (@{ $fs->children($directory) }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $child = length $relative ? $relative.'/'.$name : $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $path = $fs->join_path( $root, $child ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ($fs->is_dir($path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | push @pending, $child; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ▶ | elsif ($name =~ /\.md\z/ && ($fs->is_file($path) || $fs->is_dangling_symlink($path))) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%4/12
$name =~ /\.md\z/ and $fs->is_file($path) || $fs->is_dangling_symlink($path)
$fs->is_file($path) or $fs->is_dangling_symlink($path)
$name =~ /\.md\z/ and $fs->is_file($path) || $fs->is_dangling_symlink($path)
$fs->is_file($path) or $fs->is_dangling_symlink($path)
MC/DC33%1/3
$name =~ /\.md\z/ and $fs->is_file($path) || $fs->is_dangling_symlink($path)
$name =~ /\.md\z/
$fs->is_file($path)
$fs->is_dangling_symlink($path)
MC/DC0%0/3
$name =~ /\.md\z/ and $fs->is_file($path) || $fs->is_dangling_symlink($path)
$name =~ /\.md\z/
$fs->is_file($path)
$fs->is_dangling_symlink($path)
Truth table75%3/4
A and B or C
A= $name =~ /\.md\z/B= $fs->is_file($path)C= $fs->is_dangling_symlink($path)
Truth table0%0/4
A and B or C
A= $name =~ /\.md\z/B= $fs->is_file($path)C= $fs->is_dangling_symlink($path)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | push @found, [ $child, $path ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return [ sort { $a->[0] cmp $b->[0] } @found ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 360 | ▶ | sub _finding { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_finding: called CC=2 SCAR=9.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my ( $what, $status, $name, $text ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_finding: not called CC=2 SCAR=9.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | my @fields = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | my $field = defined $_ ? $_ : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $field =~ s/\t/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $field =~ s/\r//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $field =~ s/\n/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } ( $what, $status, $name, $text ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return { what => $fields[0], status => $fields[1], name => $fields[2], text => $fields[3] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 67 | ▶ | sub _check_agents { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_agents: called CC=20 SCAR=42.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | my ( $self, $findings ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_agents: not called CC=20 SCAR=42.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $briefing = $self->briefing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $fs = $briefing->filesystem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my ( @agents, @pairs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | for my $entry (@{ $self->_agent_files }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my ( $relative, $path ) = @{$entry}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $base = $relative; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $base =~ s{\A.*/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $base =~ s/\.md\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $base =~ s/\A\.local\.(?=.)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($fs->is_dangling_symlink($path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | push @{$findings}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | _finding( 'agent', 'warn', $relative, 'dangling symlink (Claude Code cannot load it)' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $agent = _parse_agent( $fs->slurp_utf8($path) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if (!$agent->{frontmatter}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | push @{$findings}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | _finding( 'agent', 'warn', $relative, 'no frontmatter (Claude Code does not load it)' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | push @agents, { name => $base, file => $relative }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $skills = $briefing->claude_agent_skills($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my @problems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | if (!$agent->{has_name} || !length $agent->{name}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%2/6
$agent->{'has_name'} && length $agent->{'name'}
$agent->{'has_name'} && length $agent->{'name'}
MC/DC50%1/2
$agent->{'has_name'} && length $agent->{'name'}
$agent->{'has_name'}
length $agent->{'name'}
MC/DC0%0/2
$agent->{'has_name'} && length $agent->{'name'}
$agent->{'has_name'}
length $agent->{'name'}
Truth table66%2/3
A && B
A= $agent->{'has_name'}B= length $agent->{'name'}
Truth table0%0/3
A && B
A= $agent->{'has_name'}B= length $agent->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | push @problems, [ 'missing', 'no name' ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | elsif ($agent->{name} ne $base) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | push @problems, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | [ 'missing', "name '".$agent->{name}."' differs from the file name" ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | push @problems, [ 'missing', 'description is empty' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | unless $agent->{description}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | push @problems, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | [ 'missing', 'allowed-tools: ignored by Claude Code; use disallowedTools' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | if $agent->{allowed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | if ($agent->{bad_list}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | push @problems, [ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 'missing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 'briefing.skills is not readable (keep the list on one line or use one "- name" per line)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | elsif (!@{$skills}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | push @problems, [ 'warn', 'no briefing' ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | push @problems, [ 'warn', 'skills: briefing reads only briefing.skills' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if $agent->{top_skills}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if (@problems) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | push @{$findings}, _finding( 'agent', $_->[0], $relative, $_->[1] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | for @problems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | push @{$findings}, _finding( 'agent', 'ok', $relative, '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | push @pairs, [ $relative, $_ ] for @{$skills}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | push @{$findings}, _finding( 'agent', 'missing', '.claude/agents', 'no agent files' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | unless @agents; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | for my $pair (@pairs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $skill = $pair->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | next if $seen{$skill}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $reason = $briefing->skill_problem($skill); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if (!defined $reason) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | push @{$findings}, _finding( 'skill', 'ok', $skill, '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | for my $other (grep { $_->[1] eq $skill } @pairs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | push @{$findings}, _finding( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 'skill', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 'missing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | $skill, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | $other->[0].' declares it; '.$reason.'; briefing would refuse the spawn', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return \@agents; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 67 | ▶ | sub _check_hooks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_hooks: called CC=16 SCAR=41.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | my ( $self, $findings, $agents ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_hooks: not called CC=16 SCAR=41.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | return unless @{$agents}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my $briefing = $self->briefing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # Same role match as ack-team: NAME-worker or NAME-worker-SUFFIX; else the first agent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my ($worker) = grep { $_->{name} =~ /-worker(?:-.+)?\z/s } @{$agents}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | $worker = $agents->[0] unless $worker; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | for my $agent (@{$agents}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $name = $agent->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $guard = $briefing->process_hook( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | hook_event_name => 'PreToolUse', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | session_id => 'briefing-doctor', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | cwd => $briefing->cwd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | tool_name => 'Agent', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | tool_input => { subagent_type => $name, description => 'check' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | my $decision = ref $guard->{output} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | ? $guard->{output}{hookSpecificOutput} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (ref $decision eq 'HASH' && ( $decision->{permissionDecision} // '' ) eq 'deny') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition30%3/10
ref $decision eq "HASH" and ($decision->{"permissionDecision"} // "") eq "deny"
$decision->{"permissionDecision"} // ""
ref $decision eq "HASH" and ($decision->{"permissionDecision"} // "") eq "deny"
$decision->{"permissionDecision"} // ""
MC/DC50%1/2
ref $decision eq "HASH" and ($decision->{"permissionDecision"} // "") eq "deny"
ref $decision eq "HASH"
$decision->{"permissionDecision"}
MC/DC0%0/2
ref $decision eq "HASH" and ($decision->{"permissionDecision"} // "") eq "deny"
ref $decision eq "HASH"
$decision->{"permissionDecision"}
Truth table66%2/3
A and B
A= ref $decision eq "HASH"B= $decision->{"permissionDecision"}
Truth table0%0/3
A and B
A= ref $decision eq "HASH"B= $decision->{"permissionDecision"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | push @{$findings}, _finding( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%1/4
$decision->{"permissionDecisionReason"} // ""
$decision->{"permissionDecisionReason"} // ""
MC/DC0%0/1
$decision->{"permissionDecisionReason"} // ""
$decision->{"permissionDecisionReason"}
MC/DC0%0/1
$decision->{"permissionDecisionReason"} // ""
$decision->{"permissionDecisionReason"}
Truth table50%1/2
A
A= $decision->{"permissionDecisionReason"}
Truth table0%0/2
A
A= $decision->{"permissionDecisionReason"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 'hook', 'missing', $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | length( $decision->{permissionDecisionReason} // '' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ? $decision->{permissionDecisionReason} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | : 'the hook denied the spawn', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | next unless $agent == $worker; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my $start = $briefing->process_hook( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | hook_event_name => 'SubagentStart', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | session_id => 'briefing-doctor', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | cwd => $briefing->cwd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | agent_type => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | my $context = ref $start->{output} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | && ref $start->{output}{hookSpecificOutput} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ? $start->{output}{hookSpecificOutput}{additionalContext} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
ref $start->{"output"} eq "HASH" and ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
ref $start->{"output"} eq "HASH" and ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
MC/DC50%1/2
ref $start->{"output"} eq "HASH" and ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
ref $start->{"output"} eq "HASH"
ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
MC/DC0%0/2
ref $start->{"output"} eq "HASH" and ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
ref $start->{"output"} eq "HASH"
ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
Truth table66%2/3
A and B
A= ref $start->{"output"} eq "HASH"B= ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
Truth table0%0/3
A and B
A= ref $start->{"output"} eq "HASH"B= ref $start->{"output"}{"hookSpecificOutput"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | $context = '' unless defined $context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ($context =~ /could not be loaded: (.*?)\.\n/s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | push @{$findings}, _finding( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 'hook', 'missing', $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 'the hook reports skills that could not be loaded: '.$1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | elsif (length $context) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | push @{$findings}, _finding( 'hook', 'ok', $name, '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | push @{$findings}, _finding( 'hook', 'warn', $name, 'the hook briefs nothing for this agent' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 67 | ▶ | sub _check_settings { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_settings: called CC=14 SCAR=36.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | my ( $self, $findings ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_settings: not called CC=14 SCAR=36.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $fs = $self->briefing->filesystem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $name = '.claude/settings.json'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $file = $fs->join_path( $self->briefing->cwd, '.claude', 'settings.json' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if (!$fs->is_readable_file($file)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | push @{$findings}, _finding( 'settings', 'missing', $name, 'not found or not readable' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $settings = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | JSON::MaybeXS->new( utf8 => 0 )->decode( $fs->slurp_utf8($file) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | if (ref $settings ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | push @{$findings}, _finding( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 'settings', 'missing', $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 'the settings file is not a valid JSON object. Correct the JSON syntax and run briefing doctor again.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | my $enabled = ref $settings->{enabledPlugins} eq 'HASH' ? $settings->{enabledPlugins} : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | my $markets = ref $settings->{extraKnownMarketplaces} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ? $settings->{extraKnownMarketplaces} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my ( $bad, $briefing ) = ( 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | for my $key (sort keys %{$enabled}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my $value = $enabled->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | next unless JSON::MaybeXS::is_bool($value) && $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
JSON::MaybeXS::is_bool($value) and $value
JSON::MaybeXS::is_bool($value) and $value
MC/DC100%2/2
JSON::MaybeXS::is_bool($value) and $value
JSON::MaybeXS::is_bool($value)
$value
MC/DC0%0/2
JSON::MaybeXS::is_bool($value) and $value
JSON::MaybeXS::is_bool($value)
$value
Truth table100%3/3
A and B
A= JSON::MaybeXS::is_bool($value)B= $value
Truth table0%0/3
A and B
A= JSON::MaybeXS::is_bool($value)B= $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | $briefing = 1 if $key =~ /\Abriefing@/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | next unless $key =~ /\@([^@]*)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $market = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | next if $market eq 'claude-plugins-official' || exists $markets->{$market}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$market eq "claude-plugins-official" or exists $markets->{$market}
$market eq "claude-plugins-official" or exists $markets->{$market}
MC/DC100%2/2
$market eq "claude-plugins-official" or exists $markets->{$market}
$market eq "claude-plugins-official"
exists $markets->{$market}
MC/DC0%0/2
$market eq "claude-plugins-official" or exists $markets->{$market}
$market eq "claude-plugins-official"
exists $markets->{$market}
Truth table100%3/3
A or B
A= $market eq "claude-plugins-official"B= exists $markets->{$market}
Truth table0%0/3
A or B
A= $market eq "claude-plugins-official"B= exists $markets->{$market}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | push @{$findings}, _finding( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 'settings', 'missing', $key, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | "marketplace '".$market."' is not in extraKnownMarketplaces", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $bad = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | if (!$briefing) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | push @{$findings}, _finding( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 'settings', 'missing', 'briefing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 'the briefing plugin is not enabled in enabledPlugins', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $bad = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | push @{$findings}, _finding( 'settings', 'ok', $name, '' ) unless $bad; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 67 | ▶ | sub findings { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findings: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | my ( $self ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findings: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my @findings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $agents = $self->_check_agents( \@findings ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $self->_check_settings( \@findings ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $self->_check_hooks( \@findings, $agents ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return \@findings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 131 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||