Some parsers include metadata about the originating source location and file for entries in the JSON output. Rego policies can include this in the violation object returned to conftest. conftest would consume this and include it in a new field in the output.Result struct. Each outputter could decide on the best way to surface this to users.
For example, the github outputter may emit an additional line that points to the origin file, and update the message in the tested file.