@@ -335,12 +335,18 @@ function prepareUploadConfig(
335335 console . error ( "Tip: run 'postgresai auth' or pass --api-key / set PGAI_API_KEY" ) ;
336336 return null ; // Signal to exit
337337 }
338- // No credentials and upload not explicitly requested: fall back to
339- // local-only mode, but say so prominently — skipping the upload silently
340- // hides the fact that results never reach the Console.
341- console . error ( "Notice: no API key configured — results will NOT be uploaded to PostgresAI." ) ;
342- console . error ( " To upload: run 'postgresai auth login' or pass --api-key / set PGAI_API_KEY." ) ;
343- console . error ( " To run locally without this notice, pass --no-upload." ) ;
338+ if ( opts . markdown ) {
339+ console . error ( "Notice: no API key configured — regular report upload is disabled." ) ;
340+ console . error ( " The full report JSON will still be sent to the PostgresAI API for markdown conversion." ) ;
341+ console . error ( " To avoid sending report data, replace --markdown with --no-upload and --json or --output." ) ;
342+ } else {
343+ // No credentials and upload not explicitly requested: fall back to
344+ // local-only mode, but say so prominently — skipping the upload silently
345+ // hides the fact that results never reach the Console.
346+ console . error ( "Notice: no API key configured — results will NOT be uploaded to PostgresAI." ) ;
347+ console . error ( " To upload: run 'postgresai auth login' or pass --api-key / set PGAI_API_KEY." ) ;
348+ console . error ( " To run locally without this notice, pass --no-upload." ) ;
349+ }
344350 return undefined ; // Skip upload, run checks locally
345351 }
346352
@@ -1996,7 +2002,7 @@ program
19962002 "project name or ID for remote upload (used with --upload; defaults to config defaultProject; auto-generated on first run)"
19972003 )
19982004 . option ( "--json" , "output JSON to stdout" )
1999- . option ( "--markdown" , "output markdown to stdout " )
2005+ . option ( "--markdown" , "output markdown via PostgresAI API (transmits the full report JSON) " )
20002006 . addHelpText (
20012007 "after" ,
20022008 [
@@ -2010,7 +2016,7 @@ program
20102016 " postgresai checkup postgresql://user:pass@host:5432/db --check-id H002" ,
20112017 " postgresai checkup postgresql://user:pass@host:5432/db --output ./reports" ,
20122018 " postgresai checkup postgresql://user:pass@host:5432/db --no-upload --json" ,
2013- " postgresai checkup postgresql://user:pass@host:5432/db --no-upload -- markdown" ,
2019+ " postgresai checkup postgresql://user:pass@host:5432/db --markdown" ,
20142020 ] . join ( "\n" )
20152021 )
20162022 . action ( async ( checkIdOrConn : string | undefined , connArg : string | undefined , opts : CheckupOptions , cmd : Command ) => {
@@ -2060,9 +2066,14 @@ program
20602066 process . exitCode = 1 ;
20612067 return ;
20622068 }
2063- // Note: --json, --markdown and --upload/--no-upload are independent flags.
2064- // Use --no-upload to explicitly disable upload when using --json or --markdown.
20652069 const uploadExplicitlyDisabled = opts . upload === false ;
2070+ if ( uploadExplicitlyDisabled && shouldConvertMarkdown ) {
2071+ console . error ( "Error: --no-upload and --markdown are mutually exclusive" ) ;
2072+ console . error ( "Markdown conversion is performed by the PostgresAI API and transmits the full report JSON." ) ;
2073+ console . error ( "Drop --no-upload to allow transmission, or use --json or --output for local-only output." ) ;
2074+ process . exitCode = 1 ;
2075+ return ;
2076+ }
20662077 let shouldUpload = ! uploadExplicitlyDisabled ;
20672078
20682079 // Preflight: validate/create output directory BEFORE connecting / running checks.
@@ -2308,7 +2319,9 @@ program
23082319
23092320 console . log ( '\nFor details:' ) ;
23102321 console . log ( ' --json Output JSON' ) ;
2311- console . log ( ' --markdown Output markdown' ) ;
2322+ if ( ! uploadExplicitlyDisabled ) {
2323+ console . log ( ' --markdown Output markdown via PostgresAI API' ) ;
2324+ }
23122325 console . log ( ' --output <dir> Save to directory' ) ;
23132326 }
23142327 } catch ( error ) {
0 commit comments