feat(cli): add markdown output and improve checkup UX

Summary

Adds --markdown flag to checkup command and improves default output with summary-first approach.

Key Changes

Markdown Output

  • Added --markdown flag to convert checkup reports to markdown format
  • Works without API key (returns partial markdown with observations only)
  • With API key: returns full markdown reports
  • Prevents --json and --markdown from being used together

Summary-First UX

  • Created cli/lib/checkup-summary.ts module for local summary generation
  • Default output now shows brief summaries instead of requiring flags
  • Filters generic info messages (only shows warnings, ok statuses, and info with concrete data)
  • Groups unimportant checks into "N other checks completed"

Output Improvements

  • Added spinner for all checkup operations (not just upload/markdown)
  • Removed status icons for cleaner text output
  • Fixed console path from "Support" to "Checkup"
  • Cleaned up upload output (removed intermediate logs that interfered with spinner)

Implementation Details

  • Express mode checks: A002, A003, A004, A007, A013, D001, D004, F001, G001, G003, H001, H002, H004
  • Settings-based checks now show count of collected settings
  • Index checks show count and size of issues found
  • Version checks show PostgreSQL version with upgrade recommendations for old versions
  • G003 special case: shows deadlock warnings if detected

Testing

  • Comprehensive test coverage: 100% functions, 96.30% lines for checkup-summary.ts
  • 19 new tests covering all summary functions and edge cases
  • CLI integration tests for --markdown flag

Example Output

Default summary (no flags): ``` Checkup completed: 13 checks

A002 (Postgres major version): PostgreSQL 17 A003 (Postgres settings): 415 settings collected A004 (Cluster information): 6 databases analyzed A007 (Altered settings): 110 settings altered from defaults A013 (Postgres minor version): Version 17.6 (Ubuntu 17.6-2.pgdg22.04+1) H001 (Invalid indexes): Found 6 invalid indexes (1.1 GiB) H002 (Unused indexes): Found 26 unused indexes (18.4 GiB) H004 (Redundant indexes): Found 10 redundant indexes (5.9 GiB) 5 other checks completed

For details: --json Output JSON --markdown Output markdown --output

Save to directory ```

Upload summary: ``` Checkup report uploaded

Project: project_1c106073abbf Report ID: 2579 View in Console: console.postgres.ai → Checkup → checkup reports

A002 (Postgres major version): PostgreSQL 17 A003 (Postgres settings): 415 settings collected ... ```

https://gitlab.com/postgres-ai/platform/-/issues/346

Design Decisions

  1. API key validation removed from postRpc() - Intentional to allow partial markdown without auth. API returns 401/403 for endpoints requiring authentication.

  2. Local summary generation - Offline-first approach for better performance and UX without requiring API calls.

  3. `any` types in checkup-summary.ts - Maintains flexibility with dynamic JSON schema from API. Future improvement: define proper TypeScript interfaces.

Test Plan

  • All existing tests passing
  • New tests for summary generation (100% function coverage)
  • CLI integration tests for --markdown flag
  • Edge case testing (empty data, missing fields, etc.)

Generated with Claude Code

Edited by Bogdan Tsechoev

Merge request reports

Loading