feat: add capabilities system and per-forge compatibility

Problem: forge.nvim silently ignored unsupported features on
non-GitHub forges. Codeberg `pr_for_branch_cmd` blocked all PR
creation, CI picker had zero actions, `repo_info` was hardcoded,
and the compose buffer showed draft/reviewer fields that did nothing.

Solution: add `forge.Capabilities` declaration (`draft`, `reviewers`,
`per_pr_checks`, `ci_json`) to each source. Compose buffer hides
unsupported fields. Per-PR checks falls back to repo-wide CI with
a notification. Fix Codeberg `pr_for_branch_cmd` to filter by branch
via jq, implement `repo_info` and `list_runs_json_cmd` via Gitea API,
add `default_branch_cmd` fallback, and add yank notifications for
GitLab/Codeberg.
This commit is contained in:
Barrett Ruth 2026-03-28 14:36:32 -04:00
parent 9be38e3b00
commit 2af47b6cf4
No known key found for this signature in database
GPG key ID: A6C96C9349D2FC81
6 changed files with 132 additions and 36 deletions

View file

@ -106,7 +106,14 @@ local function dispatch(args)
elseif action == 'worktree' then
pickers.pr_actions(f, num)._by_name.worktree()
elseif action == 'ci' then
pickers.checks(f, num)
if f.capabilities.per_pr_checks then
pickers.checks(f, num)
else
require('forge').log(
('per-%s checks unavailable on %s, showing repo CI'):format(f.labels.pr_one, f.name)
)
pickers.ci(f)
end
elseif action == 'browse' then
f:view_web(f.kinds.pr, num)
elseif action == 'manage' then