Skip to content

Add Flymake/Flycheck diagnostic aggregation commands #2

@morinim

Description

@morinim

Summary

Add a command that collects current buffer diagnostics from Flymake or Flycheck and sends them to Codex as a structured batch for root-cause analysis.

The existing my-codex-explain-region-as-error command works on manually selected text. A diagnostics-aware command would let Codex inspect the actual warnings/errors reported by Emacs and identify common causes, cascades, and the smallest likely fix.

Proposed commands

  • my-codex-explain-buffer-diagnostics
  • Optional later: my-codex-explain-project-diagnostics

Behavior

The buffer-level command should:

  • Prefer Flymake when flymake-mode is active.
  • Fall back to Flycheck when flycheck-mode is active.
  • Include file path, line, column, severity, backend/checker, and message.
  • Sort diagnostics by line and column.
  • Cap the number of diagnostics, for example at 100, and mention truncation.
  • Ask Codex to analyze diagnostics as a batch instead of one-by-one.

Prompt intent

The prompt should ask Codex to identify:

  • common root causes
  • cascade errors
  • missing imports/includes/types/configuration
  • the smallest fix likely to remove the largest number of diagnostics

It should discourage proposing one fix per diagnostic unless the diagnostics are genuinely unrelated.

Notes

A project-wide command may be useful later, but it should be scoped carefully. Flymake and Flycheck generally expose diagnostics for buffers that are open and have already been checked, so a project command would likely aggregate visible project buffers rather than represent full project health.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions