refactor(forge): simplify auth gating and rename gitea_backend
Problem: forge auth/warning logic was scattered through `fetch_metadata` — per-API-call auth status checks, `_warned` flags, and `warn_missing_cli` conditionals on every fetch. Solution: replace `_warned` with `_auth` (cached per session), add `is_configured()` to skip unconfigured forges entirely, extract `check_auth()` for one-time auth verification, and strip `fetch_metadata` to a pure API caller returning `ForgeFetchError`. Gate `refresh` and new `validate_refs` with both checks. Rename `gitea_backend` to `gitea_forge`.
This commit is contained in:
parent
3af2e0d4c1
commit
17774b1355
4 changed files with 185 additions and 70 deletions
|
|
@ -49,7 +49,9 @@ function M.check()
|
|||
vim.health.start('pending.nvim: forge')
|
||||
local forge = require('pending.forge')
|
||||
for _, backend in ipairs(forge.backends()) do
|
||||
if vim.fn.executable(backend.cli) == 1 then
|
||||
if not forge.is_configured(backend.name) then
|
||||
vim.health.info(('%s: not configured (skipped)'):format(backend.name))
|
||||
elseif vim.fn.executable(backend.cli) == 1 then
|
||||
vim.health.ok(('%s found'):format(backend.cli))
|
||||
else
|
||||
vim.health.warn(('%s not found — run `%s`'):format(backend.cli, backend.auth_cmd))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue