@@ -4529,8 +4529,9 @@ private function renderWorktreeResult( string $operation, array $result, array $
45294529 function ( $ wt ) {
45304530 $ skipped = (array ) ( $ wt ['fields_skipped ' ] ?? array () );
45314531 $ dirty = $ wt ['dirty ' ] ?? null ;
4532+ $ unpushed = $ wt ['unpushed ' ] ?? null ;
45324533 $ size = $ wt ['size_bytes ' ] ?? null ;
4533- return array (
4534+ $ item = array (
45344535 'handle ' => $ wt ['handle ' ] ?? '' ,
45354536 'repo ' => $ wt ['repo ' ] ?? '' ,
45364537 'kind ' => ! empty ($ wt ['is_primary ' ]) ? 'primary ' : 'worktree ' ,
@@ -4562,12 +4563,21 @@ function ( $wt ) {
45624563 'task_full ' => $ wt ['task ' ] ?? null ,
45634564 'path ' => $ wt ['path ' ] ?? '' ,
45644565 );
4566+ if ( null !== $ dirty && null !== $ unpushed ) {
4567+ $ item ['safety ' ] = array (
4568+ 'dirty ' => 0 !== (int ) $ dirty ,
4569+ 'unpushed ' => 0 !== (int ) $ unpushed ,
4570+ 'primary ' => ! empty ($ wt ['is_primary ' ]),
4571+ );
4572+ }
4573+
4574+ return $ item ;
45654575 },
45664576 $ worktrees
45674577 );
45684578 $ fields = array ( 'handle ' , 'repo ' , 'kind ' , 'branch ' , 'head ' , 'dirty ' , 'state ' , 'liveness ' , 'last_seen_at ' , 'owner ' , 'agent ' , 'session ' , 'task ' , 'pr ' , 'age_days ' , 'size ' , 'artifacts ' , 'stale ' , 'path ' );
45694579 if ( in_array ( (string ) ( $ assoc_args ['format ' ] ?? '' ), array ( 'json ' , 'yaml ' ), true ) ) {
4570- $ fields = array ( 'handle ' , 'repo ' , 'kind ' , 'branch ' , 'head ' , 'dirty ' , 'state ' , 'created_at ' , 'liveness ' , 'liveness_reason ' , 'last_seen_at ' , 'owner_full ' , 'session_full ' , 'task_full ' , 'pr ' , 'age_days ' , 'size_bytes ' , 'artifact_size_bytes ' , 'artifact_paths ' , 'stale ' , 'fields_skipped ' , 'metadata ' , 'path ' );
4580+ $ fields = array ( 'handle ' , 'repo ' , 'kind ' , 'branch ' , 'head ' , 'dirty ' , 'safety ' , ' state ' , 'created_at ' , 'liveness ' , 'liveness_reason ' , 'last_seen_at ' , 'owner_full ' , 'session_full ' , 'task_full ' , 'pr ' , 'age_days ' , 'size_bytes ' , 'artifact_size_bytes ' , 'artifact_paths ' , 'stale ' , 'fields_skipped ' , 'metadata ' , 'path ' );
45714581 }
45724582 $ skipped_global = (array ) ( $ result ['fields_skipped ' ] ?? array () );
45734583 if ( ! empty ($ skipped_global ) && ! in_array ( (string ) ( $ assoc_args ['format ' ] ?? '' ), array ( 'json ' , 'yaml ' , 'csv ' ), true ) ) {
0 commit comments