35b9df9eba
## Why
Cloning plugins from git ties the editor to GitHub uptime and moving branches; archives at a pinned version from our own registry are reproducible and reachable offline.
## How
- Add a registry resolver interface `(spec, registry) -> {url, headers, filename, sha256?}` with builtin `template` and `artifactapi` kinds, a per-plugin registry override and a `url` escape hatch.
- Take auth tokens only from an env var or a `token_cmd`; reject a literal token at setup.
- Download with curl, verify an optional sha256, extract to a staging dir and rename into `pack/vimpack/{start,opt}/<name>`, restoring the previous tree if the swap fails.
- Track installed name/version/sha256 in `stdpath('data')/vimpack/manifest.json` and skip plugins already at the wanted version.
- Add `:VimpackInstall`, `:VimpackUpdate`, `:VimpackClean` and `:VimpackStatus`, running downloads through `vim.system` under a concurrency cap.
- Hash with a pure-Lua SHA-256; `vim.fn.sha256()` rejects binary archives with E976.
- Add a dependency-free `tests/minimal.lua` harness and 57 specs covering resolution, auth, manifest, planning, checksum mismatch, orphan detection and end-to-end install.
- Add `.woodpecker/{test,lint,pre-commit}.yaml`, luacheck/stylua config and pre-commit hooks.
25 lines
862 B
Lua
25 lines
862 B
Lua
if vim.g.loaded_vimpack then
|
|
return
|
|
end
|
|
vim.g.loaded_vimpack = true
|
|
|
|
local function complete()
|
|
return require('vimpack').plugin_names()
|
|
end
|
|
|
|
vim.api.nvim_create_user_command('VimpackInstall', function(opts)
|
|
require('vimpack').install(opts.fargs)
|
|
end, { nargs = '*', complete = complete, desc = 'Install missing or drifted vimpack plugins' })
|
|
|
|
vim.api.nvim_create_user_command('VimpackUpdate', function(opts)
|
|
require('vimpack').update(opts.fargs)
|
|
end, { nargs = '*', complete = complete, desc = 'Re-fetch vimpack plugins' })
|
|
|
|
vim.api.nvim_create_user_command('VimpackClean', function()
|
|
require('vimpack').clean()
|
|
end, { nargs = 0, desc = 'Remove installed plugins no longer in the spec' })
|
|
|
|
vim.api.nvim_create_user_command('VimpackStatus', function()
|
|
require('vimpack').status()
|
|
end, { nargs = 0, desc = 'Show installed vs wanted plugin versions' })
|