mirror of
https://github.com/harivansh-afk/forge.nvim.git
synced 2026-04-17 10:02:25 +00:00
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:
parent
9be38e3b00
commit
2af47b6cf4
6 changed files with 132 additions and 36 deletions
|
|
@ -12,6 +12,12 @@ local M = {
|
|||
pr_full = 'Merge Requests',
|
||||
ci = 'CI/CD',
|
||||
},
|
||||
capabilities = {
|
||||
draft = true,
|
||||
reviewers = true,
|
||||
per_pr_checks = false,
|
||||
ci_json = true,
|
||||
},
|
||||
}
|
||||
|
||||
---@param state string
|
||||
|
|
@ -112,7 +118,9 @@ function M:yank_branch(loc)
|
|||
local branch = vim.trim(vim.fn.system('git branch --show-current'))
|
||||
local base = forge.remote_web_url()
|
||||
local file, lines = loc:match('^(.+):(.+)$')
|
||||
vim.fn.setreg('+', ('%s/-/blob/%s/%s#L%s'):format(base, branch, file, lines))
|
||||
local url = ('%s/-/blob/%s/%s#L%s'):format(base, branch, file, lines)
|
||||
vim.fn.setreg('+', url)
|
||||
forge.log('URL copied')
|
||||
end
|
||||
|
||||
---@param loc string
|
||||
|
|
@ -120,7 +128,9 @@ function M:yank_commit(loc)
|
|||
local commit = vim.trim(vim.fn.system('git rev-parse HEAD'))
|
||||
local base = forge.remote_web_url()
|
||||
local file, lines = loc:match('^(.+):(.+)$')
|
||||
vim.fn.setreg('+', ('%s/-/blob/%s/%s#L%s'):format(base, commit, file, lines))
|
||||
local url = ('%s/-/blob/%s/%s#L%s'):format(base, commit, file, lines)
|
||||
vim.fn.setreg('+', url)
|
||||
forge.log('URL copied')
|
||||
end
|
||||
|
||||
---@param num string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue