// std/lint - run the Harn linter programmatically (#2851), so an agent / IDE /
// cloud caller gets the same diagnostics as `harn lint` without shelling out.
/**
* Lint a Harn source string and return its diagnostics.
*
* `params` is a dict:
*
* - `source`: the Harn source text to lint.
* - `disabled` (optional): a list of rule ids to suppress.
* - `severity` (optional): a dict mapping a rule id to `"error"` / `"warning"`
* / `"info"` to override that rule's reported severity.
*
* On success `result == "ok"` and `diagnostics` is a list of `{code, rule,
* message, severity, start_byte, end_byte, line, column}` — the same findings
* `harn lint` emits.
*
* @effects: [host]
* @allocation: heap
* @errors: [backend]
* @api_stability: experimental
* @example: lint_run({source: "fn f() { let x = (1) }"})
*/
pub fn lint_run(params) -> dict {
let payload = hostlib_lint_run(params ?? {}) ?? {}
return payload
.merge(
{ok: payload?.result ?? "" == "ok", provenance: {module: "std/lint", helper: "lint_run"}},
)
}