@@ -100,6 +100,55 @@ describe("plugins cli list", () => {
100100 expect ( runtimeLogs ) . toContain ( cleanDoctorMessage ) ;
101101 } ) ;
102102
103+ it . each ( [
104+ {
105+ description : "a required plugin is missing" ,
106+ diagnostic : {
107+ level : "warn" as const ,
108+ pluginId : "calendar" ,
109+ message : 'plugin "calendar" requires plugin "contacts"; install "contacts" to use it' ,
110+ } ,
111+ expected : 'calendar: plugin "calendar" requires plugin "contacts"' ,
112+ } ,
113+ {
114+ description : "discovery cannot read an extensions directory" ,
115+ diagnostic : {
116+ level : "warn" as const ,
117+ message : "failed to read extensions dir: /tmp/plugins (permission denied)" ,
118+ } ,
119+ expected : "failed to read extensions dir: /tmp/plugins (permission denied)" ,
120+ } ,
121+ ] ) (
122+ "reports actionable discovery warnings when $description" ,
123+ async ( { diagnostic, expected } ) => {
124+ buildPluginDiagnosticsReport . mockReturnValue ( { plugins : [ ] , diagnostics : [ diagnostic ] } ) ;
125+
126+ await runPluginsCommand ( [ "plugins" , "doctor" ] ) ;
127+
128+ const output = runtimeLogs . join ( "\n" ) ;
129+ expect ( output ) . toContain ( "Diagnostics:" ) ;
130+ expect ( output ) . toContain ( expected ) ;
131+ expect ( output ) . not . toContain ( cleanDoctorMessage ) ;
132+ } ,
133+ ) ;
134+
135+ it ( "keeps actionable discovery warnings alongside existing errors" , async ( ) => {
136+ buildPluginDiagnosticsReport . mockReturnValue ( {
137+ plugins : [ ] ,
138+ diagnostics : [
139+ { level : "error" , pluginId : "broken" , message : "plugin manifest invalid" } ,
140+ { level : "warn" , pluginId : "calendar" , message : "required plugin contacts is missing" } ,
141+ ] ,
142+ } ) ;
143+
144+ await runPluginsCommand ( [ "plugins" , "doctor" ] ) ;
145+
146+ const output = runtimeLogs . join ( "\n" ) ;
147+ expect ( output ) . toContain ( "broken: plugin manifest invalid" ) ;
148+ expect ( output ) . toContain ( "calendar: required plugin contacts is missing" ) ;
149+ expect ( output ) . not . toContain ( cleanDoctorMessage ) ;
150+ } ) ;
151+
103152 it ( "reports stale plugin config in doctor output without claiming full plugin health" , async ( ) => {
104153 const sourceConfig = {
105154 plugins : {
0 commit comments