feat(forge): add validate option for forge ref validation on write (#138)

Problem: Typos in forge refs like `gh:user/repo#42` silently persist —
there's no feedback when a ref points to a nonexistent issue.

Solution: Add `forge.validate` config option. When enabled, `diff.apply()`
returns new/changed `ForgeRef[]` and `forge.validate_refs()` fetches
metadata for each, logging specific warnings for not-found, auth, or
CLI-missing errors.
This commit is contained in:
Barrett Ruth 2026-03-11 12:23:20 -04:00 committed by GitHub
parent 61d84f85b8
commit f198358819
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 163 additions and 19 deletions

View file

@ -489,9 +489,13 @@ function M._on_write(bufnr)
if #stack > UNDO_MAX then
table.remove(stack, 1)
end
diff.apply(lines, s, hidden)
local new_refs = diff.apply(lines, s, hidden)
M._recompute_counts()
buffer.render(bufnr)
if new_refs and #new_refs > 0 then
local forge = require('pending.forge')
forge.validate_refs(new_refs)
end
end
---@return nil