| id | 2607082052 |
|---|---|
| title | SARIF output format for `mdsmith check` |
| status | ✅ |
| model | sonnet |
| summary | Add `-f sarif` to `mdsmith check` (and `fix --dry-run`) so its diagnostics land in the same GitHub Code Scanning dashboard APM's `apm audit --ci -f sarif` feeds. Generalize the SARIF machinery that the security-review engine already ships. Opportunity G-2. |
| depends-on |
Let mdsmith check emit SARIF. Its findings then
show up as GitHub Code Scanning alerts on a PR. That
is where APM's apm audit --ci already uploads its
own findings.
The documented APM CI pattern is apm audit --ci --policy org -f sarif -o report.sarif, uploaded via
github/codeql-action/upload-sarif, so agent-context
findings appear as Code Scanning alerts.
mdsmith check
emits only text or json, so its diagnostics on
the same .apm/ files cannot join that dashboard.
This is opportunity G-2 in the
APM opportunity catalogue.
mdsmith already renders SARIF today. The
security-review engine
and the
release audit
both emit it. So the renderer exists; it is just not
wired to the check command. This plan moves those
structs into a shared package and routes the check
command's diagnostics through them. That makes the
work partial, not new.
- Changing the default format.
textstays the default; SARIF is opt-in. - SARIF for the LSP surface. Editor diagnostics already flow through LSP; this plan is the CLI output path.
- New diagnostic data. SARIF maps the file, line, column, rule id, and severity the JSON format already carries.
- Red/green: extract the SARIF structs shared by
internal/secreviewandinternal/releaseinto a shared internal package with a stable rendering test. - Red/green:
formatDiagnosticstests for asarifformat that maps each diagnostic to a SARIF 2.1.0 result —ruleId = MDS###,physicalLocationregion from file/line/column,levelfrom severity. - Emit one
reportingDescriptorper fired rule with ahelpUrito the rule's doc page, andtool.driver.name = mdsmithwith the build version. - Add
sarifto the-f/--formatvalue set oncheckand onfix --dry-run; update check.md and fix.md. - Show the GitHub Actions upload snippet in the
checkreference page (coexist-with-APM guide landing in plan 2607082050). - Run
mdsmith fix PLAN.mdandmdsmith check ..
-
mdsmith check -f sarif docs/emits valid SARIF 2.1.0 with one result per diagnostic and correct file/line/column regions. - Each fired rule appears once in
tool.driver.ruleswith ahelpUri. -
fix --dry-run -f sarifemits the same shape for the diagnostics it would fix. -
textremains the default when-fis omitted. - The
checkandfixreference pages list thesarifvalue. - All tests pass:
go test ./... -
go tool -modfile=tools/go.mod golangci-lint runreports no issues. -
mdsmith check .— 0 failures.