lib/Skilletor/Report.pm

filter: Statementstmt 97.3% 222 / 228 Branchbran 78.8% 71 / 90 Conditioncond 87.3% 62 / 71 MC/DCmcdc 72.2% 26 / 36 Subroutinesub 100% 26 / 26 Podpod 100% 12 / 12 totaltotal 90.5% 419 / 463 CC 100 SCAR 28.1
CC
100
Cov
91%
status_text
34.0
report_hook
26.0
report_text
21.8
CRAP 16.7
« /usr/local/lib/perl5/5.44.0/x86_64-linux/IO.pm ↑ Summary /usr/local/lib/perl5/site_perl/5.44.0/Role/Tiny.pm »
1 package Skilletor::Report;
2 # ABSTRACT: The reports of sync, check and status – their shape, their text, their exit codes (spec §8)
3  
4 464 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 464 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 464 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 464 ▶use Exporter qw( import );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 464 ▶use Skilletor::Briefing qw( briefing_warning );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 464 ▶use Skilletor::JSON qw( js_ordered js_stringify );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 464 ▶use Skilletor::Lock qw( parse_lock_key );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 464 our $VERSION = '0.008000';
14  
15 464 our @EXPORT_OK = qw(
16 ACTIVATION empty_scope_report display_safe backend_label conflict_hint has_changes has_notable
17 report_json report_text report_hook status_text check_text exit_code
18 );
19  
20 # Per item type: when Claude Code sees an item a sync installed (spec §12).
21 464 ▶use constant ACTIVATION => {
Subroutine BEGIN: called CC=1 SCAR=0.0
22 skill => 'active now',
23 agent => 'active after /reload-plugins or restart',
24 rule => 'active after /reload-plugins or restart',
25 464 };
26  
27 464 my %HARNESS_ACTIVATION = ( codex => 'active from the next Codex session', hermes => 'active from the next Hermes session' );
28  
29 1296 ▶sub _activation_of {
Subroutine _activation_of: called CC=3 SCAR=11.0
30 1296 my ( $it ) = @_;
31 1296 my $harness = parse_lock_key( $it->{key} )->{harness};
32 1296 ▶ return ( defined $harness ? $HARNESS_ACTIVATION{$harness} : undef ) // ACTIVATION->{ $it->{type} };
Branch: 1 branch
BranchTrueFalseTotal
defined $harness ? : 1295 1 1296
Condition66%2/3
(defined $harness ? $HARNESS_ACTIVATION{$harness} : undef) // {"agent" => "active after /reload-plugins or restart","rule" => "active after /reload-plugins or restart","skill" => "active now"}->{$it->{"type"}}
l!l&&r!l&&!r
6966000
MC/DC0%0/2
(defined $harness ? $HARNESS_ACTIVATION{$harness} : undef) // {"agent" => "active after /reload-plugins or restart","rule" => "active after /reload-plugins or restart","skill" => "active now"}->{$it->{"type"}}
(defined $harness ? $HARNESS_ACTIVATION{$harness} : undef) {"agent" => "active after /reload-plugins or restart","rule" => "active after /reload-plugins or restart","skill" => "active now"}->{$it->{"type"}}
Truth table66%2/3
A // B
A= (defined $harness ? $HARNESS_ACTIVATION{$harness} : undef)B= {"agent" => "active after /reload-plugins or restart","rule" => "active after /reload-plugins or restart","skill" => "active now"}->{$it->{"type"}}
ABresult
1X1
011
000
33 }
34  
35 # A string's truthiness in JavaScript: set and not empty ("0" counts).
36 2355 ▶sub _truthy { defined $_[0] && length $_[0] }
Subroutine _truthy: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] and length $_[0] 7 2348 2355
37  
38 5137 ▶sub empty_scope_report {
Subroutine empty_scope_report: called CC=1 SCAR=0.0
Pod documented
39 5137 my ( $scope ) = @_;
40 5137 return js_ordered(
41 scope => $scope, added => [], updated => [], removed => [], unchanged => [], skipped => [], conflicts => [], overwritten => [],
42 warnings => [], trustRequests => [],
43 );
44 }
45  
46 464 my %C0 = ( "\b" => '\\b', "\f" => '\\f', "\n" => '\\n', "\r" => '\\r' );
47  
48 # One display line safe for a terminal and a model's context: control characters but tab, the
49 # bidi controls, the line and paragraph separators, the zero-width space, word joiner and BOM
50 # escaped the JSON way.
51 6631 ▶sub display_safe {
Subroutine display_safe: called CC=3 SCAR=11.0
Pod documented
52 6631 my ( $line ) = @_;
53 6631 $line =~ s{((?!\t)[\p{Cc}\p{Bidi_Control}\x{200B}\x{2028}\x{2029}\x{2060}\x{FEFF}])}{
54 454 my $c = $1;
55 454 ▶ ord($c) < 0x20 ? ( $C0{$c} // sprintf( '\\u%04x', ord $c ) ) : sprintf( '\\u%04x', ord $c );
Branch: 1 branch
BranchTrueFalseTotal
ord $c < 32 ? : 319 135 454
Condition100%2/2
$C0{$c} // sprintf("\\u%04x", ord $c)
l!l
93226
MC/DC100%1/1
$C0{$c} // sprintf("\\u%04x", ord $c)
$C0{$c}
Truth table100%2/2
A
A= $C0{$c}
Aresult
11
00
56 }ge;
57 6631 return $line;
58 }
59  
60 26 ▶sub backend_label {
Subroutine backend_label: called CC=1 SCAR=0.0
Pod documented
61 26 my ( $b ) = @_;
62 26 return $b->{kind}.' '.$b->{url};
63 }
64  
65 7 ▶sub conflict_hint {
Subroutine conflict_hint: called CC=3 SCAR=11.0
Pod documented
66 7 my ( $c ) = @_;
67 7 ▶ return 'is not a file (move or remove it yourself; --force leaves it)' if $c->{notFile};
Branch: 1 branch
BranchTrueFalseTotal
if $c->{"notFile"} 2 5 7
68 5 ▶ return 'already exists (use --force to '.( $c->{replace} ? 'replace it' : 'adopt' ).')';
Branch: 1 branch
BranchTrueFalseTotal
$c->{'replace'} ? : 2 3 5
69 }
70  
71 1176 ▶sub has_changes {
Subroutine has_changes: called CC=4 SCAR=13.9
Pod documented
72 1176 my ( $r ) = @_;
73 1176 ▶ return ( grep { @{ $_->{added} } || @{ $_->{updated} } || @{ $_->{removed} } } @{ $r->{scopes} } ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({@{$_->{'added'};} or @{$_->{'updated'};} or @{$_->{'removed'};};} @{$$r{'scopes'};}) ? : 659 517 1176
Condition83%5/6
@{$_->{'added'};} || @{$_->{'updated'};} || @{$_->{'removed'};}
l!l&&r!l&&!r
840281245
@{$_->{"added"};} or @{$_->{"updated"};}
l!l&&r!l&&!r
84001273
MC/DC66%2/3
@{$_->{'added'};} || @{$_->{'updated'};} || @{$_->{'removed'};}
@{$_->{"added"};} @{$_->{"updated"};} @{$_->{'removed'};}
Truth table75%3/4
A or B || C
A= @{$_->{"added"};}B= @{$_->{"updated"};}C= @{$_->{'removed'};}
ABCresult
1XX1
01X1
0011
0000
74 }
75  
76 2703 ▶sub _is_notable {
Subroutine _is_notable: called CC=11 SCAR=24.0
77 2703 my ( $s ) = @_;
78 2703 return ( @{ $s->{added} } || @{ $s->{updated} } || @{ $s->{removed} } || @{ $s->{conflicts} } || @{ $s->{overwritten} }
79 2703 ▶ || @{ $s->{warnings} } || @{ $s->{trustRequests} } || @{ $s->{gitignoreUpdated} // [] } || $s->{settingsUpdated} ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
@{$s->{'added'};} || @{$s->{'updated'};} || @{$s->{'removed'};} || @{$s->{'conflicts'};} || @{$s->{'overwritten'};} || @{$s->{'warnings'};} || @{$s->{'trustRequests'};} || @{$s->{'gitignoreUpdated'} // [];} || $s->{'settingsUpdated'} ? : 1278 1425 2703
Condition96%25/26
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};} or @{$s->{"overwritten"};} or @{$s->{"warnings"};} or @{$s->{"trustRequests"};} or @{$s->{"gitignoreUpdated"} // [];} or $s->{"settingsUpdated"}
l!l&&r!l&&!r
127711425
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};} or @{$s->{"overwritten"};} or @{$s->{"warnings"};} or @{$s->{"trustRequests"};} or @{$s->{"gitignoreUpdated"} // [];}
l!l&&r!l&&!r
127341426
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};} or @{$s->{"overwritten"};} or @{$s->{"warnings"};} or @{$s->{"trustRequests"};}
l!l&&r!l&&!r
1251221430
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};} or @{$s->{"overwritten"};} or @{$s->{"warnings"};}
l!l&&r!l&&!r
1173781452
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};} or @{$s->{"overwritten"};}
l!l&&r!l&&!r
117211530
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};}
l!l&&r!l&&!r
116931531
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};}
l!l&&r!l&&!r
1141281534
@{$s->{"added"};} or @{$s->{"updated"};}
l!l&&r!l&&!r
114101562
$s->{"gitignoreUpdated"} // []
l!l
41426
MC/DC88%8/9
@{$s->{"added"};} or @{$s->{"updated"};} or @{$s->{"removed"};} or @{$s->{"conflicts"};} or @{$s->{"overwritten"};} or @{$s->{"warnings"};} or @{$s->{"trustRequests"};} or @{$s->{"gitignoreUpdated"} // [];} or $s->{"settingsUpdated"}
@{$s->{"added"};} @{$s->{"updated"};} @{$s->{"removed"};} @{$s->{"conflicts"};} @{$s->{"overwritten"};} @{$s->{"warnings"};} @{$s->{"trustRequests"};} @{$s->{"gitignoreUpdated"} // [];} $s->{"settingsUpdated"}
MC/DC100%1/1
$s->{"gitignoreUpdated"} // []
$s->{"gitignoreUpdated"}
Truth table90%9/10
A or B or C or D or E or F or G or H or I
A= @{$s->{"added"};}B= @{$s->{"updated"};}C= @{$s->{"removed"};}D= @{$s->{"conflicts"};}E= @{$s->{"overwritten"};}F= @{$s->{"warnings"};}G= @{$s->{"trustRequests"};}H= @{$s->{"gitignoreUpdated"} // [];}I= $s->{"settingsUpdated"}
ABCDEFGHIresult
1XXXXXXXX1
01XXXXXXX1
001XXXXXX1
0001XXXXX1
00001XXXX1
000001XXX1
0000001XX1
00000001X1
0000000011
0000000000
Truth table100%2/2
A
A= $s->{"gitignoreUpdated"}
Aresult
11
00
80 }
81  
82 1176 ▶sub has_notable {
Subroutine has_notable: called CC=3 SCAR=11.0
Pod documented
83 1176 my ( $r ) = @_;
84 1176 ▶ return ( _truthy( $r->{error} ) || grep { _is_notable($_) } @{ $r->{scopes} } ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
_truthy($r->{'error'}) || grep({_is_notable($_);} @{$$r{'scopes'};}) ? : 765 411 1176
Condition66%2/3
_truthy($r->{"error"}) or grep {_is_notable($_);} @{$$r{"scopes"};}
l!l&&r!l&&!r
0765411
MC/DC50%1/2
_truthy($r->{"error"}) or grep {_is_notable($_);} @{$$r{"scopes"};}
_truthy($r->{"error"}) grep {_is_notable($_);} @{$$r{"scopes"};}
Truth table66%2/3
A or B
A= _truthy($r->{"error"})B= grep {_is_notable($_);} @{$$r{"scopes"};}
ABresult
1X1
011
000
85 }
86  
87 913 ▶sub _commit_hint { $_[0].' updated — commit it' }
Subroutine _commit_hint: called CC=1 SCAR=0.0
88  
89 3 ▶sub _settings_hint {
Subroutine _settings_hint: called CC=4 SCAR=13.9
90 3 my ( $u ) = @_;
91 3 my @what;
92 3 ▶ push @what, 'enables '.join( ', ', @{ $u->{enabled} } ) if @{ $u->{enabled} };
Branch: 1 branch
BranchTrueFalseTotal
if @{$u->{"enabled"};} 2 1 3
93 3 ▶ push @what, 'declares marketplace'.( @{ $u->{declared} } > 1 ? 's' : '' ).' '.join( ', ', @{ $u->{declared} } ) if @{ $u->{declared} };
Branch: 2 branches
BranchTrueFalseTotal
if @{$u->{"declared"};} 3 0 3
@{$u->{'declared'};} > 1 ? : 2 1 3
94 3 return $u->{path}.' updated ('.join( '; ', @what ).') — commit it';
95 }
96  
97 # A report as `--json` prints it: JSON.stringify(report, null, 2), each line display-safe (the
98 # CLI's printText); no final newline.
99 175 ▶sub report_json {
Subroutine report_json: called CC=1 SCAR=0.0
Pod documented
100 175 my ( $r ) = @_;
101 175 return join "\n", map { display_safe($_) } split /\n/, js_stringify( $r, 2 ), -1;
102 }
103  
104 # The sync report as the CLI prints it; empty when there is nothing to say.
105 774 ▶sub report_text {
Subroutine report_text: called CC=21 SCAR=30.8
Pod documented
106 774 my ( $r ) = @_;
107 774 ▶ return display_safe( 'skilletor: config error, nothing changed — '.$r->{error} ) if defined $r->{error};
Branch: 1 branch
BranchTrueFalseTotal
if defined $r->{"error"} 62 712 774
108 712 my @lines;
109 712 for my $s ( @{ $r->{scopes} } ) {
110 # Skips are informational: shown here, but not notable.
111 590 ▶ next if !_is_notable($s) && !@{ $s->{skipped} };
Branch: 1 branch
BranchTrueFalseTotal
unless _is_notable($s) or @{$s->{"skipped"};} 289 301 590
Condition66%2/3
_is_notable($s) or @{$s->{"skipped"};}
l!l&&r!l&&!r
3010289
MC/DC50%1/2
_is_notable($s) or @{$s->{"skipped"};}
_is_notable($s) @{$s->{"skipped"};}
Truth table66%2/3
A or B
A= _is_notable($s)B= @{$s->{"skipped"};}
ABresult
1X1
011
000
112 0 my %skipped = map { ( $_->{key} => 1 ) } @{ $s->{skipped} };
113 301 push @lines, 'skilletor: '.$s->{scope}.' scope';
114 301 push @lines, ' + '.$_->{key}.' ('._activation_of($_).')' for @{ $s->{added} };
115 301 push @lines, ' ~ '.$_->{key}.' ('._activation_of($_).')' for @{ $s->{updated} };
116 301 ▶ push @lines, ' - '.$_->{key}.' ('.( $skipped{ $_->{key} } ? 'removed: renders empty' : 'removed' ).')' for @{ $s->{removed} };
Branch: 1 branch
BranchTrueFalseTotal
$skipped{$_->{'key'}} ? : 0 0 0
117 0 my %removed = map { ( $_->{key} => 1 ) } @{ $s->{removed} };
118 0 push @lines, ' · '.$_->{key}.' skipped (renders empty)' for grep { !$removed{ $_->{key} } } @{ $s->{skipped} };
119 301 push @lines, ' overwrote local change: '.$_->{path} for @{ $s->{overwritten} };
120 301 push @lines, ' conflict: '.$_->{path}.' '.conflict_hint($_) for @{ $s->{conflicts} };
121 301 push @lines, ' trust: source "'.$_->{name}.'" ('.backend_label($_).') — run: skilletor trust '.$_->{name} for @{ $s->{trustRequests} };
122 301 ▶ push @lines, ' '._commit_hint($_) for @{ $s->{gitignoreUpdated} // [] };
Condition100%2/2
$s->{"gitignoreUpdated"} // []
l!l
1300
MC/DC100%1/1
$s->{"gitignoreUpdated"} // []
$s->{"gitignoreUpdated"}
Truth table100%2/2
A
A= $s->{"gitignoreUpdated"}
Aresult
11
00
123 301 ▶ push @lines, ' '._settings_hint( $s->{settingsUpdated} ) if $s->{settingsUpdated};
Branch: 1 branch
BranchTrueFalseTotal
if $s->{"settingsUpdated"} 0 301 301
124 301 push @lines, ' warning: '.$_ for @{ $s->{warnings} };
125 }
126 712 ▶ push @lines, 'skilletor: warning: '.$_ for @{ $r->{warnings} // [] };
Condition100%2/2
$r->{"warnings"} // []
l!l
186526
MC/DC100%1/1
$r->{"warnings"} // []
$r->{"warnings"}
Truth table100%2/2
A
A= $r->{"warnings"}
Aresult
11
00
127 712 ▶ push @lines, 'skilletor: note: '.$_ for @{ $r->{notes} // [] };
Condition100%2/2
$r->{"notes"} // []
l!l
201511
MC/DC100%1/1
$r->{"notes"} // []
$r->{"notes"}
Truth table100%2/2
A
A= $r->{"notes"}
Aresult
11
00
128 712 return join "\n", map { display_safe($_) } @lines;
129 }
130  
131 # The report without its briefing warnings – and without the settings warnings of a scope whose
132 # settings file this run left as it was: the hooks show them only in a run that changed something.
133 517 ▶sub _without_repeats {
Subroutine _without_repeats: called CC=6 SCAR=17.9
134 517 my ( $r ) = @_;
135 517 my $out = js_ordered( map { ( $_ => $r->{$_} ) } keys %$r );
136 $out->{scopes} = [
137 map {
138 981 my $s = $_;
139 981 ▶ my @settings = $s->{settingsUpdated} ? () : @{ $s->{settingsSkipped} // [] };
Branch: 1 branch
BranchTrueFalseTotal
$s->{'settingsUpdated'} ? : 3 978 981
Condition100%2/2
$s->{"settingsSkipped"} // []
l!l
2976
MC/DC100%1/1
$s->{"settingsSkipped"} // []
$s->{"settingsSkipped"}
Truth table100%2/2
A
A= $s->{"settingsSkipped"}
Aresult
11
00
140 981 ▶ my @briefing = @{ $s->{briefingMissing} // [] };
Condition100%2/2
$s->{"briefingMissing"} // []
l!l
4977
MC/DC100%1/1
$s->{"briefingMissing"} // []
$s->{"briefingMissing"}
Truth table100%2/2
A
A= $s->{"briefingMissing"}
Aresult
11
00
141 981 ▶ if ( !@briefing && !@settings ) { $s }
Branch: 1 branch
BranchTrueFalseTotal
if (not @briefing || @settings) { } 977 4 981
Condition100%3/3
@briefing || @settings
l!l&&r!l&&!r
31977
MC/DC100%2/2
@briefing || @settings
@briefing @settings
Truth table100%3/3
A || B
A= @briefingB= @settings
ABresult
1X1
011
000
142 else {
143 4 my %lines = map { ( $_ => 1 ) } ( map { briefing_warning( parse_lock_key( $_->{key} )->{name}, $_->{harness}, $_->{missing} ) } @briefing ),
144 @settings;
145 4 my $rest = js_ordered( map { ( $_ => $s->{$_} ) } grep { $_ ne 'briefingMissing' } keys %$s );
146 4 $rest->{warnings} = [ grep { !$lines{$_} } @{ $s->{warnings} } ];
147 4 $rest;
148 }
149 517 } @{ $r->{scopes} }
150 ];
151 517 return $out;
152 }
153  
154 # The hooks' output of a sync report: a one-line systemMessage and a terse additionalContext,
155 # every line display-safe; a config error alone, as one line. Nothing to say: an empty hash.
156 1179 ▶sub report_hook {
Subroutine report_hook: called CC=26 SCAR=32.6
Pod documented
157 1179 my ( $report ) = @_;
158 1179 ▶ return js_ordered( systemMessage => display_safe( 'skilletor: '.$report->{error} ) ) if _truthy( $report->{error} );
Branch: 1 branch
BranchTrueFalseTotal
if _truthy($report->{"error"}) 3 1176 1179
159 1176 ▶ my $r = has_changes($report) ? $report : _without_repeats($report);
Branch: 1 branch
BranchTrueFalseTotal
has_changes($report) ? : 659 517 1176
160 1176 ▶ return js_ordered() unless has_notable($r);
Branch: 1 branch
BranchTrueFalseTotal
unless has_notable($r) 411 765 1176
161 765 my ( @changed, @gitignores );
162 765 my ( $warnings, $removed ) = ( 0, 0 );
163 765 for my $s ( @{ $r->{scopes} } ) {
164 1313 push @changed, @{ $s->{added} }, @{ $s->{updated} };
165 1313 $warnings += @{ $s->{warnings} } + @{ $s->{conflicts} } + @{ $s->{trustRequests} } + @{ $s->{overwritten} };
166 1313 $removed += @{ $s->{removed} };
167 1313 ▶ push @gitignores, @{ $s->{gitignoreUpdated} // [] }, ( $s->{settingsUpdated} ? $s->{settingsUpdated}{path} : () );
Branch: 1 branch
BranchTrueFalseTotal
$s->{'settingsUpdated'} ? : 3 1310 1313
Condition100%2/2
$s->{"gitignoreUpdated"} // []
l!l
361952
MC/DC100%1/1
$s->{"gitignoreUpdated"} // []
$s->{"gitignoreUpdated"}
Truth table100%2/2
A
A= $s->{"gitignoreUpdated"}
Aresult
11
00
168 }
169  
170 765 my @parts;
171 765 ▶ push @parts, scalar(@changed).' item(s) updated' if @changed;
Branch: 1 branch
BranchTrueFalseTotal
if @changed 648 117 765
172 765 ▶ push @parts, $removed.' removed' if $removed;
Branch: 1 branch
BranchTrueFalseTotal
if $removed 28 737 765
173 765 ▶ push @parts, $warnings.' warning(s)' if $warnings;
Branch: 1 branch
BranchTrueFalseTotal
if $warnings 107 658 765
174 765 ▶ push @parts, join( ', ', @gitignores ).' updated — commit '.( @gitignores > 1 ? 'them' : 'it' ) if @gitignores;
Branch: 2 branches
BranchTrueFalseTotal
if @gitignores 362 403 765
@gitignores > 1 ? : 359 3 362
175 765 ▶ my $out = js_ordered( systemMessage => display_safe( 'skilletor: '.( @parts ? join( ', ', @parts ) : 'changes applied' ) ) );
Branch: 1 branch
BranchTrueFalseTotal
@parts ? : 765 0 765
176  
177 765 my @ctx;
178 765 ▶ if (@changed) {
Branch: 1 branch
BranchTrueFalseTotal
if (@changed) 648 117 765
179 648 push @ctx, 'skilletor synced items:';
180 648 for my $it (@changed) {
181 # Claude Code's items are unmarked; another harness's are named.
182 935 my $harness = parse_lock_key( $it->{key} )->{harness};
183 935 ▶ my $mark = defined $harness && $harness ne 'claude' ? ' ('.$harness.')' : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $harness && $harness ne 'claude' ? : 663 272 935
Condition100%3/3
defined $harness and $harness ne "claude"
!ll&&!rl&&r
1271663
MC/DC100%2/2
defined $harness and $harness ne "claude"
defined $harness $harness ne "claude"
Truth table100%3/3
A and B
A= defined $harnessB= $harness ne "claude"
ABresult
0X0
100
111
184 935 push @ctx, '- '.$it->{type}.' '.$it->{name}.'@'.$it->{source}.$mark.': '._activation_of($it);
185 }
186 }
187 # One line per counted warning; the scope says which `.claude` a path is relative to.
188 765 for my $s ( @{ $r->{scopes} } ) {
189 1313 push @ctx, '- overwrote local change in '.$s->{scope}.' scope: '.$_->{path} for @{ $s->{overwritten} };
190 1313 push @ctx, '- conflict in '.$s->{scope}.' scope: '.$_->{path}.' '.conflict_hint($_) for @{ $s->{conflicts} };
191 1313 push @ctx, '- untrusted source '.$_->{name}.' ('.backend_label($_).'); run: skilletor trust '.$_->{name} for @{ $s->{trustRequests} };
192 1313 ▶ push @ctx, '- '._commit_hint($_) for @{ $s->{gitignoreUpdated} // [] };
Condition100%2/2
$s->{"gitignoreUpdated"} // []
l!l
361952
MC/DC100%1/1
$s->{"gitignoreUpdated"} // []
$s->{"gitignoreUpdated"}
Truth table100%2/2
A
A= $s->{"gitignoreUpdated"}
Aresult
11
00
193 1313 ▶ push @ctx, '- '._settings_hint( $s->{settingsUpdated} ) if $s->{settingsUpdated};
Branch: 1 branch
BranchTrueFalseTotal
if $s->{"settingsUpdated"} 3 1310 1313
194 1313 push @ctx, '- warning: '.$_ for @{ $s->{warnings} };
195 }
196 765 ▶ $out->{additionalContext} = join "\n", map { display_safe($_) } @ctx if @ctx;
Branch: 1 branch
BranchTrueFalseTotal
if @ctx 755 10 765
197 765 return $out;
198 }
199  
200 # The status report as `skilletor status` prints it.
201 39 ▶sub status_text {
Subroutine status_text: called CC=20 SCAR=35.3
Pod documented
202 39 my ( $r ) = @_;
203 39 ▶ return display_safe( 'skilletor: config error — '.$r->{error} ) if defined $r->{error};
Branch: 1 branch
BranchTrueFalseTotal
if defined $r->{"error"} 0 39 39
204 39 my @lines;
205 39 for my $s ( @{ $r->{scopes} } ) {
206 39 my @t = @{ $s->{targets} };
207 39 ▶ my $claude_only = @t == 1 && $t[0] eq 'claude';
Condition33%1/3
@t == 1 && $t[0] eq 'claude'
!ll&&!rl&&r
0039
MC/DC0%0/2
@t == 1 && $t[0] eq 'claude'
@t == 1 $t[0] eq 'claude'
Truth table33%1/3
A && B
A= @t == 1B= $t[0] eq 'claude'
ABresult
0X0
100
111
208 39 ▶ push @lines, $claude_only ? $s->{scope}.' scope:' : $s->{scope}.' scope ('.( @t ? join( ', ', @t ) : 'no targets' ).'):';
Branch: 2 branches
BranchTrueFalseTotal
$claude_only ? : 39 0 39
@t ? : 0 0 0
209 39 for my $d ( @{ $s->{declared} } ) {
210 78 ▶ my $mark = $d->{installed} ? '✓' : $d->{skipped} ? '-' : '·';
Branch: 2 branches
BranchTrueFalseTotal
$d->{'installed'} ? : 78 0 78
$d->{'skipped'} ? : 0 0 0
211 my $note = ( $d->{skipped} ? ' (skipped: renders empty)' : '' ).( $d->{partial} ? ' (partial: the last sync stopped midway)' : '' )
212 0 ▶ .( $d->{briefingMissing} ? ' (briefing skills not installed: '.join( ', ', @{ $d->{briefingMissing} } ).')' : '' );
Branch: 3 branches
BranchTrueFalseTotal
$d->{'skipped'} ? : 0 78 78
$d->{'partial'} ? : 0 78 78
$d->{'briefingMissing'} ? : 0 78 78
213 78 ▶ push @lines, ' '.$mark.' '.$d->{key}.' @'.$d->{source}.( defined $d->{via} ? ' via '.$d->{via} : '' ).$note;
Branch: 1 branch
BranchTrueFalseTotal
defined $d->{'via'} ? : 0 78 78
214 }
215 39 for my $w ( @{ $s->{wildcards} } ) {
216 0 ( my $pattern = substr( $w->{entry}, 0, rindex( $w->{entry}, '@' ) ) ) =~ s/\A[a-z]+://;
217 0 push @lines, ' * '.$w->{type}.'s/'.$pattern.' @'.$w->{source}.' ('.$w->{installed}.' installed)';
218 }
219 39 push @lines, ' * bundle:'.$_->{name}.'@'.$_->{source}.' ('.$_->{installed}.' installed)' for @{ $s->{bundles} };
220 39 push @lines, ' ? '.$_.' (in lock, not declared)' for @{ $s->{orphans} };
221 39 push @lines, ' trust: '.$_->{name}.' ('.backend_label($_).')' for @{ $s->{trustRequests} };
222 }
223 39 ▶ push @lines, 'project scope: none (the project directory is the home directory)' if $r->{projectIsHome};
Branch: 1 branch
BranchTrueFalseTotal
if $r->{"projectIsHome"} 0 39 39
224 39 ▶ push @lines, 'warning: '.$_ for @{ $r->{warnings} // [] };
Condition50%1/2
$r->{"warnings"} // []
l!l
039
MC/DC0%0/1
$r->{"warnings"} // []
$r->{"warnings"}
Truth table50%1/2
A
A= $r->{"warnings"}
Aresult
11
00
225 39 return join "\n", map { display_safe($_) } @lines;
226 }
227  
228 # The check verdict as `skilletor check` prints it.
229 40 ▶sub check_text {
Subroutine check_text: called CC=3 SCAR=11.7
Pod documented
230 40 my ( $r ) = @_;
231 40 ▶ return display_safe( 'skilletor: '.$r->{error} ) if defined $r->{error};
Branch: 1 branch
BranchTrueFalseTotal
if defined $r->{"error"} 0 40 40
232 40 ▶ return $r->{changed} ? 'changed' : 'up to date';
Branch: 1 branch
BranchTrueFalseTotal
$r->{'changed'} ? : 40 0 40
233 }
234  
235 # The CLI's exit code for a report: 2 on an error; `check` 1 when a sync is due; else 0.
236 119 ▶sub exit_code {
Subroutine exit_code: called CC=4 SCAR=13.9
Pod documented
237 119 my ( $op, $r ) = @_;
238 119 ▶ return 2 if defined $r->{error};
Branch: 1 branch
BranchTrueFalseTotal
if defined $r->{"error"} 39 80 119
239 80 ▶ return ( $op eq 'check' && $r->{changed} ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$op eq 'check' && $r->{'changed'} ? : 40 40 80
Condition66%2/3
$op eq "check" and $r->{"changed"}
!ll&&!rl&&r
40040
MC/DC50%1/2
$op eq "check" and $r->{"changed"}
$op eq "check" $r->{"changed"}
Truth table66%2/3
A and B
A= $op eq "check"B= $r->{"changed"}
ABresult
0X0
100
111
240 }
241  
242 464 1;
243  
244 __END__
« /usr/local/lib/perl5/5.44.0/x86_64-linux/IO.pm ↑ Summary /usr/local/lib/perl5/site_perl/5.44.0/Role/Tiny.pm »