mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
UpdateNotification() wrote to stdout via fmt.Printf, corrupting JSON output when --json was passed to commands like search. Machine consumers got invalid JSON with trailing human-readable text. Three-layer fix: 1. Move UpdateNotification output to os.Stderr (safety net for any caller that bypasses the main.go guard). 2. Add isStructuredOutput() that detects all machine-readable modes: --json, -j, and --format json/sarif/markdown. 3. Skip the update check and trailing newline entirely in main() when structured output is requested, honouring the contract that stdout = pure structured data and stderr = empty. Tests: - Unit: isStructuredOutput table test (9 cases) - Unit: UpdateNotification writes only to stderr - Integration: versioned binary (1.0.0) with seeded cache (9.9.9) exercises the real update path for search --json, list -j, and audit --format json — asserts valid JSON stdout + empty stderr. Closes #129