cli: add --json flag to `convex insights` (#53126)
Adds a `--json` option to `npx convex insights` so machine consumers can parse deployment-health insights instead of scraping the human-formatted text.
- Output shape: `{ "deploymentName", "dashboardUrl", "insights": [...] }` — `insights` are the raw `fetchInsights` results, errors-first, untransformed. `--details` still passes `includeRecentEvents` through, so `--json --details` includes per-insight recent events.
- Emits via `logOutput(JSON.stringify(..., null, 2))`, mirroring the `function-spec` convention for machine-readable output.
- Without `--json`: byte-for-byte unchanged. Error paths (local deployment, deploy-key auth) keep their existing `ctx.crash` behavior, which fires before any JSON output.
- `npm run typecheck` in `npm-packages/convex` passes clean.
Motivation: the Claude Code Convex plugin ships a monitor that polls `insights` every 10 minutes to proactively alert the agent on new OCC conflicts and read-limit issues (get-convex/convex-backend-skill#5). Text-scraping is brittle; this gives it a stable contract.
GitOrigin-RevId: 4802a92d685e6eafb037751b0552f6e1a5bb4cea S
sethconvex committed
83d82530ccc77d30c79cc16e913b3fa0d1905eed
Parent: a29bf4f
Committed by Convex, Inc. <no-reply@convex.dev>
on 6/22/2026, 7:52:38 PM