refactor(forge): replace curl/token auth with CLI-native API calls
Problem: Forge metadata fetching required manual token management — config fields, CLI token extraction, and curl with auth headers. Each forge had a different auth path, and Codeberg had no CLI support at all. Solution: Delete `get_token()` and `_api_url()`, replace with `_api_args()` that builds `gh api`, `glab api`, or `tea api` arg arrays. The CLIs handle auth internally. Add `warn_missing_cli` config (default true) that warns once per forge per session on failure. Add forge CLI checks to `:checkhealth`. Remove `token` from config/docs.
This commit is contained in:
parent
54f2eb50d9
commit
ecacb62674
5 changed files with 81 additions and 94 deletions
|
|
@ -46,6 +46,20 @@ function M.check()
|
|||
end
|
||||
end
|
||||
|
||||
vim.health.start('pending.nvim: forge')
|
||||
local forge_clis = {
|
||||
{ cmd = 'gh', name = 'GitHub', hint = 'gh auth login' },
|
||||
{ cmd = 'glab', name = 'GitLab', hint = 'glab auth login' },
|
||||
{ cmd = 'tea', name = 'Codeberg', hint = 'tea login add' },
|
||||
}
|
||||
for _, cli in ipairs(forge_clis) do
|
||||
if vim.fn.executable(cli.cmd) == 1 then
|
||||
vim.health.ok(('%s found'):format(cli.cmd))
|
||||
else
|
||||
vim.health.warn(('%s not found — run `%s`'):format(cli.cmd, cli.hint))
|
||||
end
|
||||
end
|
||||
|
||||
local sync_paths = vim.fn.globpath(vim.o.runtimepath, 'lua/pending/sync/*.lua', false, true)
|
||||
if #sync_paths == 0 then
|
||||
vim.health.info('No sync backends found')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue